ArkoPDF
← SDK API 參考

ipdf_pageobject.h

页面对象:文字/图像/路径等页面元素的查询与修改。

介面說明保留標頭檔裡的英文原文 —— 照文件寫程式時要能一眼對上程式碼裡的註解。

常數

簽章ValueDescription
PDF_PAGEOBJ_TEXT1text object.
PDF_PAGEOBJ_PATH2path object.
PDF_PAGEOBJ_IMAGE3image object.
PDF_PAGEOBJ_SHADING4shading object.
PDF_PAGEOBJ_FORM5form object.
PDF_PAGEOBJ_INLINES6inline image object.
PDF_PATHFLAG_CLOSE0x01Specifies 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_LINETO0x02Specifies that a line is to be drawn from the current position to this point, and then becomes the new current position.
PDF_PATHFLAG_BEZIERTO0x04Specifies that this point is a control point or ending point for a B��zier line.
PDF_PATHFLAG_MOVETO0x06Specifies that this point starts a figure. This point becomes the new current position.
PDF_PATHFLAG_TYPE0x06Denotes point type mask. Point types are: #PDF_PATHFLAG_MOVETO/#PDF_PATHFLAG_LINETO/#PDF_PATHFLAG_BEZIERTO.

class IPDF_PageObject

PDF page object interface.

方法(20)

簽章說明
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.

參數

  • 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.

參數

  • 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.

參數

  • matrix(in) — The transform matrix used to transform.
Offset
void Offset(float dx, float dy) = 0;

Move the page object.

參數

  • 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.

參數

  • angle(in) — The radian.
Copy
int Copy(IPDF_PageObject* pSrcObj) = 0;

Copy the page object.

傳回值:1 for success, 0 for failure.

class IPDF_TextObject

PDF text object interface.

方法(4)

簽章說明
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.

參數

  • unicode_buf(in) — A buffer used to receive the unicode text.
  • buf_len(in) — The buffer lenght.

傳回值:The length of received text.

GetBaseLine
void GetBaseLine(float* x, float* y) = 0;

Get origin position of text object.

參數

  • 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.

參數

  • font(in) — The new font to be setted.
SetFontSize
void SetFontSize(float font_size) = 0;

Set font size to text object.

參數

  • font_size(in) — The new font size .

class IPDF_ImageObject

PDF image object interface.

方法(11)

簽章說明
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.

傳回值:The image source type, 0 for bitmap, 1 for JPG.

GetImgData
int GetImgData(unsigned char* buf, int buf_len) = 0;

Get image source data.

參數

  • buf(out) — A buffer to receiv the image sourse data bytes.
  • buf_len(in) — The buffer length in bytes..

傳回值:The received data length.

SaveImgAsJpeg
int SaveImgAsJpeg(const wchar_t* path) = 0;

Save image to disk.

參數

  • path(in) — The destinate jpg file path(unicode).

傳回值:Less zero for failure, 1 for success.

SaveImgAsJpegUTF8
int SaveImgAsJpegUTF8(const char* path_utf8) = 0;

Save image to disk.

參數

  • path(in) — The destinate jpg file path(utf8).

傳回值:Less zero for failure, 1 for success.

FitRect
void FitRect(float left, float bottom, float right, float top) = 0;

Fit image to a rectangle.

參數

  • 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.

參數

  • 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.

參數

  • dest_width(in) — The pixel width.
  • dest_height(in) — The pixel height.

傳回值:An bitmap which render the image into.

class IPDF_PathObject

PDF path object interface.

方法(3)

簽章說明
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.

參數

  • index(in) — The zero-based index, range is zero to GetPathPointCount().
  • flag(out) — The point flag. @see Point flags
  • point(out) — To receiv the point data.
PathIsRect
int PathIsRect() = 0;

Test whether the path is a rectangle.

傳回值:1 for rectangle, 0 for not.

class IPDF_FormObject

PDF form object interface.

方法(4)

簽章說明
GetPageObjCount()—
GetPageObj(int index)—
DeletePageObj(IPDF_PageObject* obj)—
GetPageObjAtPoint(PDSDK_FloatPoint point)—