ipdf_pageobject.h
页面对象:文字/图像/路径等页面元素的查询与修改。
Les descriptions d'interface restent en anglais, telles quelles dans les en-têtes : vous pouvez les comparer directement au code.
Constantes
| Signature | Value | Description |
|---|---|---|
| PDF_PAGEOBJ_TEXT | 1 | text object. |
| PDF_PAGEOBJ_PATH | 2 | path object. |
| PDF_PAGEOBJ_IMAGE | 3 | image object. |
| PDF_PAGEOBJ_SHADING | 4 | shading object. |
| PDF_PAGEOBJ_FORM | 5 | form object. |
| PDF_PAGEOBJ_INLINES | 6 | inline image object. |
| PDF_PATHFLAG_CLOSE | 0x01 | Specifies that the figure is automatically closed after the #PDF_PATHFLAG_LINETO or #PDF_PATHFLAG_BEZIERTO type for this point is done. A line is drawn from this point to the most recent #PDF_PATHFLAG_MOVETO point. |
| PDF_PATHFLAG_LINETO | 0x02 | Specifies that a line is to be drawn from the current position to this point, and then becomes the new current position. |
| PDF_PATHFLAG_BEZIERTO | 0x04 | Specifies that this point is a control point or ending point for a B��zier line. |
| PDF_PATHFLAG_MOVETO | 0x06 | Specifies that this point starts a figure. This point becomes the new current position. |
| PDF_PATHFLAG_TYPE | 0x06 | Denotes point type mask. Point types are: #PDF_PATHFLAG_MOVETO/#PDF_PATHFLAG_LINETO/#PDF_PATHFLAG_BEZIERTO. |
class IPDF_PageObject
PDF page object interface.
Méthodes(20)
| Signature | Description |
|---|---|
| GetType() | Get page object type.@see Page objects |
| GetObjID() | Get page object unique ID. |
| SetObjID(int nID) | Set page object unique ID. |
| GetBBox(PDSDK_FloatRect* box) | Get page object bounding box in user space. |
| GetTextObject() | Get text object interface. |
| GetImageObject() | Get image object interface. |
| GetPathObject() | Get path object interface. |
| GetFormObject() | Get form object interface. |
| GetShadingObject() | Get shading object interface. |
| GetStrokeColor() | Get the stroke color used in page object. return A RGB color, if equal ((DWORD)-1), means no stroke color be used. |
| SetStrokeColor(unsigned int stroke_rgb) | Set stroke color to page object. |
| GetFillColor() | Get the fill color used in page object. return A RGB color, if equal ((DWORD)-1), means no fill color be used. |
| SetFillColor(unsigned int fill_rgb) | Set fill color to page object. |
| Transform(IPDF_Matrix* matrix) | Transform the page object. such as Rotating, shearring, or moveing object. |
| Offset(float dx, float dy) | Move the page object. |
| Rotate(float angle) | Rotate the page object at the center of bounding box. |
| Clone() | Clone an page object. return The cloned page object. NOTE:if not call IPDF_Page::AddPageObject() to add page, we should call Release() to free it. |
| Copy(IPDF_PageObject* pSrcObj) | Copy the page object. |
| Release() | Release the page object. NOTE: Just the page object which call Clone() to cloned and have not been added to page can be release. |
| ToXML(const wchar_t* temp_img_file) | Serial image object to XML |
SetStrokeColor
void SetStrokeColor(unsigned int stroke_rgb) = 0;
Set stroke color to page object.
Paramètres
stroke_rgb(in) — The RGB stroke color, use the macro COLOR_MAKERGB to make a RGB format color. return A new image object.
SetFillColor
void SetFillColor(unsigned int fill_rgb) = 0;
Set fill color to page object.
Paramètres
fill_rgb(in) — The RGB fill color, use the macro COLOR_MAKERGB to make a RGB format color.
Transform
void Transform(IPDF_Matrix* matrix) = 0;
Transform the page object. such as Rotating, shearring, or moveing object.
Paramètres
matrix(in) — The transform matrix used to transform.
Offset
void Offset(float dx, float dy) = 0;
Move the page object.
Paramètres
dx(in) — x-direction detal.dy(in) — y-direction detal.
Rotate
void Rotate(float angle) = 0;
Rotate the page object at the center of bounding box.
Paramètres
angle(in) — The radian.
Copy
int Copy(IPDF_PageObject* pSrcObj) = 0;
Copy the page object.
Retour:1 for success, 0 for failure.
class IPDF_TextObject
PDF text object interface.
Méthodes(4)
| Signature | Description |
|---|---|
| GetText(unsigned short* unicode_buf, int buf_len) | Get the text of text object. |
| GetBaseLine(float* x, float* y) | Get origin position of text object. |
| SetFont(IPDF_Font* font) | Set font to text object. |
| SetFontSize(float font_size) | Set font size to text object. |
GetText
public: virtual int GetText(unsigned short* unicode_buf, int buf_len) = 0;
Get the text of text object.
Paramètres
unicode_buf(in) — A buffer used to receive the unicode text.buf_len(in) — The buffer lenght.
Retour:The length of received text.
GetBaseLine
void GetBaseLine(float* x, float* y) = 0;
Get origin position of text object.
Paramètres
x(out) — The x-coordinate in user space.y(out) — The y-coordinate in user space.
SetFont
void SetFont(IPDF_Font* font) = 0;
Set font to text object.
Paramètres
font(in) — The new font to be setted.
SetFontSize
void SetFontSize(float font_size) = 0;
Set font size to text object.
Paramètres
font_size(in) — The new font size .
class IPDF_ImageObject
PDF image object interface.
Méthodes(11)
| Signature | Description |
|---|---|
| GetImgType() | Get image source type. |
| GetImgData(unsigned char* buf, int buf_len) | Get image source data. |
| SaveImgAsJpeg(const wchar_t* path) | Save image to disk. |
| SaveImgAsJpegUTF8(const char* path_utf8) | Save image to disk. |
| FlipImg_H() | Flip image object on horizontal. |
| FlipImg_V() | Flip image object on vertical. |
| FitRect(float left, float bottom, float right, float top) | Fit image to a rectangle. |
| SetClip(float left, float bottom, float right, float top) | Set the clip box to iamge object. |
| GetPixelWidth() | Get the pixel width. |
| GetPixelHeight() | Get the pixel height. |
| GetBitmap(int dest_width, int dest_height) | Render image object into memory bitmap. |
GetImgType
public: virtual int GetImgType() = 0;
Get image source type.
Retour:The image source type, 0 for bitmap, 1 for JPG.
GetImgData
int GetImgData(unsigned char* buf, int buf_len) = 0;
Get image source data.
Paramètres
buf(out) — A buffer to receiv the image sourse data bytes.buf_len(in) — The buffer length in bytes..
Retour:The received data length.
SaveImgAsJpeg
int SaveImgAsJpeg(const wchar_t* path) = 0;
Save image to disk.
Paramètres
path(in) — The destinate jpg file path(unicode).
Retour:Less zero for failure, 1 for success.
SaveImgAsJpegUTF8
int SaveImgAsJpegUTF8(const char* path_utf8) = 0;
Save image to disk.
Paramètres
path(in) — The destinate jpg file path(utf8).
Retour:Less zero for failure, 1 for success.
FitRect
void FitRect(float left, float bottom, float right, float top) = 0;
Fit image to a rectangle.
Paramètres
left(in) — The x-coordinate of the left-bottom corner.left(in) — The y-coordinate of the left-bottom corner.right(in) — The x-coordinate of the right-top corner.top(in) — The y-coordinate of the right-top corner.
SetClip
void SetClip(float left, float bottom, float right, float top) = 0;
Set the clip box to iamge object.
Paramètres
left(in) — The x-coordinate of the left-bottom corner.left(in) — The y-coordinate of the left-bottom corner.right(in) — The x-coordinate of the right-top corner.top(in) — The y-coordinate of the right-top corner.
GetBitmap
IPDF_DIBitmap* GetBitmap(int dest_width, int dest_height) = 0;
Render image object into memory bitmap.
Paramètres
dest_width(in) — The pixel width.dest_height(in) — The pixel height.
Retour:An bitmap which render the image into.
class IPDF_PathObject
PDF path object interface.
Méthodes(3)
| Signature | Description |
|---|---|
| GetPathPointCount() | Get path point count. |
| GetPathPoint(int index, int* flag, PDSDK_FloatPoint* point) | Get path points. |
| PathIsRect() | Test whether the path is a rectangle. |
GetPathPoint
void GetPathPoint(int index, int* flag, PDSDK_FloatPoint* point) = 0;
Get path points.
Paramètres
index(in) — The zero-based index, range is zero to GetPathPointCount().flag(out) — The point flag. @see Point flagspoint(out) — To receiv the point data.
PathIsRect
int PathIsRect() = 0;
Test whether the path is a rectangle.
Retour:1 for rectangle, 0 for not.
class IPDF_FormObject
PDF form object interface.
Méthodes(4)
| Signature | Description |
|---|---|
| GetPageObjCount() | — |
| GetPageObj(int index) | — |
| DeletePageObj(IPDF_PageObject* obj) | — |
| GetPageObjAtPoint(PDSDK_FloatPoint point) | — |