ArkoPDF
← SDK API reference

ipdf_pageobject.h

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

Interface descriptions keep the original English from the headers, so you can match them against the code you are reading.

Constants

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

Methods(20)

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

Parameters

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

Parameters

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

Parameters

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

Move the page object.

Parameters

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

Parameters

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

Copy the page object.

Returns:1 for success, 0 for failure.

class IPDF_TextObject

PDF text object interface.

Methods(4)

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

Parameters

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

Returns:The length of received text.

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

Get origin position of text object.

Parameters

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

Parameters

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

Set font size to text object.

Parameters

  • font_size(in) — The new font size .

class IPDF_ImageObject

PDF image object interface.

Methods(11)

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

Returns:The image source type, 0 for bitmap, 1 for JPG.

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

Get image source data.

Parameters

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

Returns:The received data length.

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

Save image to disk.

Parameters

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

Returns:Less zero for failure, 1 for success.

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

Save image to disk.

Parameters

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

Returns:Less zero for failure, 1 for success.

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

Fit image to a rectangle.

Parameters

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

Parameters

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

Parameters

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

Returns:An bitmap which render the image into.

class IPDF_PathObject

PDF path object interface.

Methods(3)

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

Parameters

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

Returns:1 for rectangle, 0 for not.

class IPDF_FormObject

PDF form object interface.

Methods(4)

SignatureDescription
GetPageObjCount()—
GetPageObj(int index)—
DeletePageObj(IPDF_PageObject* obj)—
GetPageObjAtPoint(PDSDK_FloatPoint point)—