-
Notifications
You must be signed in to change notification settings - Fork 2
API: Page
HPDF_STATUS HPDF_Page_SetWidth (HPDF_Page page, HPDF_REAL value);
Description
HPDF_Page_SetWidth() changes the width of a page.
Parameters
page - The handle of a page object.
value - The new page width. Valid value are between 3 and 14400.
Returns
HPDF_Page_SetWidth() returns a handle of document object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_PAGE_INVALID_SIZE - An invalid size was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
HPDF_STATUS HPDF_Page_SetHeight (HPDF_Page page, HPDF_REAL value);
Description
HPDF_Page_SetHeight() changes the height of a page.
Parameters
page - The handle of a page object.
value - The new page height. Valid values are between 3 and 14400.
Returns
HPDF_Page_SetHeight() returns a handle of document object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_PAGE_INVALID_SIZE - An invalid size was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
HPDF_STATUS HPDF_Page_SetSize (HPDF_Page page, HPDF_PageSizes size, HPDF_PageDirection direction);
Description
HPDF_Page_SetSize() changes the size and direction of a page to a predefined size.
Parameters
page - Specify the handle of a page object.
size - Specify a predefined page-size value. The following values are available.
Value Size (mm or inches) Size (in pixels) ------------------------------------------------------------------- HPDF_PAGE_SIZE_LETTER 8.5 x 11 (inches) 612 x 792 HPDF_PAGE_SIZE_LEGAL 8.5 x 14 (inches) 612 x 1008 HPDF_PAGE_SIZE_A3 297 x 420 (mm) 841.89 x 1199.551 HPDF_PAGE_SIZE_A4 210 x 297 (mm) 595.276 x 841.89 HPDF_PAGE_SIZE_A5 148 x 210 (mm) 419.528 x 595.276 HPDF_PAGE_SIZE_B4 250 x 353 (mm) 708.661 x 1000.63 HPDF_PAGE_SIZE_B5 176 x 250 (mm) 498.898 x 708.661 HPDF_PAGE_SIZE_EXECUTIVE 7.25 x 10.5 (inches) 522 x 756 HPDF_PAGE_SIZE_US4x6 4 x 6 (inches) 288 x 432 HPDF_PAGE_SIZE_US4x8 4 x 8 (inches) 288 x 576 HPDF_PAGE_SIZE_US5x7 5 x 7 (inches) 360 x 504 HPDF_PAGE_SIZE_COMM10 4.125 x 9.5 (inches) 297 x 684 -------------------------------------------------------------------
direction - Specify the direction of the page.
Value Description ----------------------------------------------------------- HPDF_PAGE_PORTRAIT Set the longer value to vertical. HPDF_PAGE_LANDSCAPE Set the longer value to horizontal. -----------------------------------------------------------
Returns
When HPDF_Page_SetHeight() succeeds, it returns HPDF_OK. Otherwise, it returns error-code and error-handler is called.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_PAGE_INVALID_SIZE - An invalid size was set.
- HPDF_PAGE_INVALID_DIRECTION - An invalid direction was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
HPDF_Page_SetRotate (HPDF_Page page, HPDF_UINT16 angle);
Description
HPDF_Page_SetRotate() sets rotation angle of the page.
Parameters
page - Specify the handle of a page object.
angle - Specify the rotation angle of the page. It must be a multiple of 90 Degrees.
Returns
HPDF_Page_SetRotate() returns a handle of document object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_PAGE_INVALID_ROTATE_VALUE - An invalid rotation angle was set.
HPDF_REAL HPDF_Page_GetWidth (HPDF_Page page);
Description
HPDF_Page_GetWidth() gets the width of the page.
Parameters
page - Specify the handle of a page object.
Returns
When HPDF_Page_GetWidth() succeed, it returns the width of the page. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetHeight (HPDF_Page page);
Description
HPDF_Page_GetHeight() gets the height of a page.
Parameters
page - Specify the handle of a page object.
Returns
When HPDF_Page_GetHeight() succeed, it returns the height of a page. Otherwise it returns 0.
HPDF_Destination HPDF_Page_CreateDestination (HPDF_Page page);
Description
HPDF_Page_CreateDestination() creates a new destination object for the page.
Parameters
page - Specify the handle of a page object.
Returns
HPDF_Page_CreateDestination() returns a handle of the new destination object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
HPDF_Annotation HPDF_Page_CreateTextAnnot (HPDF_Page page, HPDF_Rect rect, const char *text, HPDF_Encoder encoder);
Description
HPDF_Page_CreateTextAnnot() creates a new text annotation object for the page.
Parameters
page - Specify the handle of a page object.
rect - A Rectangle where the annotation is displayed.
text - The text to be displayed.
encoder - An encoder handle which is used to encode the text. If it is null, PDFDocEncoding is used.
Returns
HPDF_Page_CreateTextAnnot() returns a handle of the new annotation object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
- HPDF_INVALID_ENCODER - An invalid encoder handle is specified..
HPDF_Annotation HPDF_Page_CreateLinkAnnot (HPDF_Page page, HPDF_Rect rect, HPDF_Destination dst);
Description
HPDF_Page_CreateLinkAnnot() creates a new link annotation object for the page.
Parameters
page - Specify the handle of a page object.
rect - A rectangle of clickable area.
dst - A handle of destination object to jump to.
Returns
HPDF_Page_CreateLinkAnnot() returns a handle of the new annotation object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
- HPDF_INVALID_DESTINATION - An invalid destination handle is specified.
HPDF_Annotation HPDF_Page_CreateURILinkAnnot (HPDF_Page page, HPDF_Rect rect, const char *uri);
Description
HPDF_Page_CreateURILinkAnnot() creates a new web link annotation object for the page.
Parameters
page - Specify the handle of a page object.
rect - A rectangle of clickable area.
uri - URL of destination to jump to.
Returns
HPDF_Page_CreateURILinkAnnot() returns a handle of the new annotation object. If it failed, it returns NULL.
Error codes
- HPDF_INVALID_PAGE - An invalid page handle was set.
- HPDF_FAILD_TO_ALLOC_MEM - Memory allocation failed.
HPDF_REAL HPDF_Page_TextWidth (HPDF_Page page, const char *text);
Description
HPDF_Page_TextWidth() gets the width of the text in current fontsize, character spacing and word spacing.
Parameters
page - The handle of a page object.
text - The text to get width.
Returns
When HPDF_Page_TextWidth() succeed, it returns the width of the text in current fontsize, character spacing and word spacing. Otherwise it returns ZERO and error-handler is called.
HPDF_UINT HPDF_Page_MeasureText (HPDF_Page page, const char *text, HPDF_REAL width, HPDF_BOOL wordwrap, HPDF_REAL *real_width);
Description
HPDF_Page_MeasureText() calculates the byte length which can be included within the specified width.
Parameters
page - The handle of a page object.
text - The text to get width.
width - The width of the area to put the text.
wordwrap - When there are three words of "ABCDE", "FGH", and "IJKL", and the substring until "J" can be included within the width, if word_wrap parameter is HPDF_FALSE it returns 12, and if word_wrap parameter is HPDF_TRUE, it returns 10 (the end of the previous word).
real_width - If this parameter is not NULL, the real widths of the text is set. An application can set it to NULL, if it is unnecessary.
Returns
When HPDF_Page_Font_MeasureText() succeed, it returns the byte length which can be included within the specified width in current fontsize, character spacing and word spacing. Otherwise it returns ZERO and error-handler is called.
HPDF_UINT16 HPDF_Page_GetGMode (HPDF_Page page);
Description
HPDF_Page_GetGMode() gets the current graphics mode.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetGMode() succeed, it returns the current graphics mode of the page. Otherwise it returns 0.
HPDF_Point HPDF_Page_GetCurrentPos (HPDF_Page page);
Description
HPDF_Page_GetCurrentPos() gets the current position for path painting. An application can invoke HPDF_Page_GetCurrentPos() only when graphics mode is HPDF_GMODE_PATH_OBJECT.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCurrentPos() succeed, it returns a HPDF_Point struct indicating the current position for path painting of the page. Otherwise it returns a HPDF_Point struct of {0, 0}.
HPDF_Point HPDF_Page_GetCurrentTextPos (HPDF_Page page);
Description
HPDF_Page_GetCurrentTextPos() gets the current position for text showing. An application can invoke HPDF_Page_GetCurrentTextPos() only when graphics mode is HPDF_GMODE_TEXT_OBJECT.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCurrentTextPos() succeed, it returns a HPDF_Point struct indicating the current position for text showing of the page. Otherwise it returns a HPDF_Point struct of {0, 0}.
HPDF_Font HPDF_Page_GetCurrentFont (HPDF_Page page);
Description
HPDF_Page_GetCurrentFont() gets the handle of the page's current font.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCurrentFont() succeed, it returns the handle of the page's current font. Otherwise it returns NULL.
HPDF_REAL HPDF_Page_GetCurrentFontSize (HPDF_Page page);
Description
HPDF_Page_GetCurrentFontSize() gets the size of the page's current font.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCurrentFont() succeed, it returns the size of the page's current font. Otherwise it returns 0.
HPDF_TransMatrix HPDF_Page_GetTransMatrix (HPDF_Page page);
Description
HPDF_Page_GetTransMatrix() gets the current transformation matrix of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetTransMatrix() succeed, it returns a HPDF_TransMatrix struct of current transformation matrix of the page.
See Also
HPDF_Real HPDF_Page_GetLineWidth (HPDF_Page page);
Description
HPDF_Page_GetLineWidth() gets the current line width of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetLineWidth() succeed, it returns the current line width for path painting of the page. Otherwise it returns HPDF_DEF_LINEWIDTH.
HPDF_LineCap HPDF_Page_GetLineCap (HPDF_Page page);
Description
HPDF_Page_GetLineCap() gets the current line cap style of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetLineCap() succeed, it returns the current line cap style of the page. Otherwise it returns HPDF_DEF_LINECAP.
HPDF_LineJoin HPDF_Page_GetLineJoin (HPDF_Page page);
Description
HPDF_Page_GetLineJoin() gets the current line join style of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetLineJoin() succeed, it returns the current line join style of the page. Otherwise it returns HPDF_DEF_LINEJOIN.
HPDF_REAL HPDF_Page_GetMiterLimit (HPDF_Page page);
Description
HPDF_Page_GetMiterLimit() gets the current value of the page's miter limit.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetLineJoin() succeed, it returns the current value of the page's miter limit. Otherwise it returns HPDF_DEF_MITERLIMIT.
typedef struct _HPDF_DashMode { HPDF_UINT16 ptn[8]; HPDF_UINT num_ptn; HPDF_UINT phase; } HPDF_DashMode; HPDF_DashMode HPDF_Page_GetMiterLimit (HPDF_Page page);
Description
HPDF_Page_GetMiterLimit() gets the current pattern of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetMiterLimit() succeeds, it returns a HPDF_DashMode struct of the current pattern of the page.
HPDF_REAL HPDF_Page_GetMiterLimit (HPDF_Page page);
Description
HPDF_Page_GetMiterLimit() gets the current value of the page's flatness.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetLineJoin() succeed, it returns the current value of the page's miter limit. Otherwise it returns HPDF_DEF_MITERLIMIT.
HPDF_REAL HPDF_Page_GetCharSpace (HPDF_Page page);
Description
HPDF_Page_GetCharSpace() gets the current value of the page's character spacing.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCharSpace() succeed, it returns the current value of the page's character spacing. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetWordSpace (HPDF_Page page);
Description
HPDF_Page_GetWordSpace() returns the current value of the page's word spacing.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetWordSpace() succeed, it returns the current value of the page's word spacing. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetHorizontalScalling (HPDF_Page page);
Description
HPDF_Page_GetHorizontalScalling() returns the current value of the page's horizontal scalling for text showing.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetHorizontalScalling() succeed, it returns the current value of the page's horizontal scalling. Otherwise it returns HPDF_DEF_HSCALING.
HPDF_REAL HPDF_Page_GetTextLeading (HPDF_Page page);
Description
HPDF_Page_GetTextLeading() returns the current value of the page's line spacing.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetTextLeading() succeed, it returns the current value of the line spacing. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetTextRenderingMode (HPDF_Page page);
Description
HPDF_Page_GetTextRenderingMode() returns the current value of the page's text rendering mode.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetTextRenderingMode() succeed, it returns the current value of the text rendering mode. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetTextRise (HPDF_Page page);
Description
HPDF_Page_GetTextRise() returns the current value of the page's text rising.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetTextRise() succeed, it returns the current value of the text rising. Otherwise it returns 0.
typedef struct _HPDF_RGBColor { HPDF_REAL r; HPDF_REAL g; HPDF_REAL b; } HPDF_RGBColor; HPDF_RGBColor HPDF_Page_GetRGBFill (HPDF_Page page);
Description
HPDF_Page_GetRGBFill() returns the current value of the page's filling color. HPDF_Page_GetRGBFill() is valid only when the page's filling color space is HPDF_CS_DEVICE_RGB.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetRGBFill() succeed, it returns the current value of the page's filling color. Otherwise it returns {0, 0, 0}.
typedef struct _HPDF_RGBColor { HPDF_REAL r; HPDF_REAL g; HPDF_REAL b; } HPDF_RGBColor; HPDF_RGBColor HPDF_Page_GetRGBStroke (HPDF_Page page);
Description
HPDF_Page_GetRGBStroke() returns the current value of the page's stroking color. HPDF_Page_GetRGBStroke() is valid only when the page's stroking color space is HPDF_CS_DEVICE_RGB.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetRGBStroke() succeed, it returns the current value of the page's stroking color. Otherwise it returns {0, 0, 0}.
typedef struct _HPDF_CMYKColor { HPDF_REAL c; HPDF_REAL m; HPDF_REAL y; HPDF_REAL k; } HPDF_CMYKColor; HPDF_CMYKColor HPDF_Page_GetCMYKFill (HPDF_Page page);
Description
HPDF_Page_GetCMYKFill() returns the current value of the page's filling color. HPDF_Page_GetCMYKFill() is valid only when the page's filling color space is HPDF_CS_DEVICE_CMYK.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCMYKFill() succeed, it returns the current value of the page's filling color. Otherwise it returns {0, 0, 0, 0}.
typedef struct _HPDF_CMYKColor { HPDF_REAL c; HPDF_REAL m; HPDF_REAL y; HPDF_REAL k; } HPDF_CMYKColor; HPDF_CMYKColor HPDF_Page_GetCMYKStroke (HPDF_Page page);
Description
HPDF_Page_GetCMYKStroke() returns the current value of the page's stroking color. HPDF_Get_CMYKStroke() is valid only when the page's stroking color space is HPDF_CS_DEVICE_CMYK.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetCMYKStroke() succeed, it returns the current value of the page's stroking color. Otherwise it returns {0, 0, 0, 0}.
HPDF_REAL HPDF_Page_GetGrayFill (HPDF_Page page);
Description
HPDF_Page_GetGrayFill() returns the current value of the page's filling color. HPDF_Page_GetGrayFill() is valid only when the page's stroking color space is HPDF_CS_DEVICE_GRAY.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetGrayFill() succeed, it returns the current value of the page's filling color. Otherwise it returns 0.
HPDF_REAL HPDF_Page_GetGrayStroke (HPDF_Page page);
Description
HPDF_Page_GetGrayStroke() returns the current value of the page's stroking color. HPDF_Page_GetGrayStroke() is valid only when the page's stroking color space is HPDF_CS_DEVICE_GRAY.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetGrayStroke() succeed, it returns the current value of the page's stroking color. Otherwise it returns 0.
HPDF_ColorSpace HPDF_Page_GetStrokingColorSpace (HPDF_Page page);
Description
HPDF_Page_GetStrokingColorSpace() returns the current value of the page's stroking color space.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetStrokingColorSpace() succeed, it returns the current value of the page's stroking color space. Otherwise it returns HPDF_CS_EOF.
HPDF_ColorSpace HPDF_Page_GetFillingColorSpace (HPDF_Page page);
Description
HPDF_Page_GetFillingColorSpace() returns the current value of the page's stroking color space.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetFillingColorSpace() succeed, it returns the current value of the page's stroking color space. Otherwise it returns HPDF_CS_EOF.
HPDF_TransMatrix HPDF_Page_GetTextMatrix (HPDF_Page page);
Description
HPDF_Page_GetTextMatrix() gets the current text transformation matrix of the page.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetTextMatrix() succeed, it returns a HPDF_TransMatrix struct of current text transformation matrix of the page.
HPDF_UINT HPDF_Page_GetGStateDepth (HPDF_Page page);
Description
HPDF_Page_GetGStateDepth() returns the number of the page's graphics state stack.
Parameters
page - The handle of a page object.
Returns
When HPDF_Page_GetGStateDepth() succeed, it returns the number of the page's graphics state stack. Otherwise it returns 0.
HPDF_STATUS HPDF_Page_SetSlideShow (HPDF_Page page, HPDF_PageSlideShow type, HPDF_REAL disp_time, HPDF_REAL trans_time);
Description
HPDF_Page_SetSlideShow() configures the setting for slide transition of the page.
Parameters
page - The handle of a page object. type - The transition style. The following values are available.
- HPDF_TS_WIPE_RIGHT
- HPDF_TS_WIPE_UP
- HPDF_TS_WIPE_LEFT
- HPDF_TS_WIPE_DOWN
- HPDF_TS_BARN_DOORS_HORIZONTAL_OUT
- HPDF_TS_BARN_DOORS_HORIZONTAL_IN
- HPDF_TS_BARN_DOORS_VERTICAL_OUT
- HPDF_TS_BARN_DOORS_VERTICAL_IN
- HPDF_TS_BOX_OUT
- HPDF_TS_BOX_IN
- HPDF_TS_BLINDS_HORIZONTAL
- HPDF_TS_BLINDS_VERTICAL
- HPDF_TS_DISSOLVE
- HPDF_TS_GLITTER_RIGHT
- HPDF_TS_GLITTER_DOWN
- HPDF_TS_GLITTER_TOP_LEFT_TO_BOTTOM_RIGHT
- HPDF_TS_REPLACE
Returns
When HPDF_Page_SetSlideShow() succeed, it returns HPDF_OK, otherwise it returns error code and error-handler is invoked.
HPDF_STATUS HPDF_Page_New_Content_Stream (HPDF_Page page, HPDF_Dict* new_stream);
Description
Call HPDF_Page_New_Content_Stream whenever you want to change to a new content stream on the page. The call can return a reference to the new content stream in new_stream. This reference can be used on a later page to call HPDF_Page_Insert_Shared_Content_Stream.
The use case is when you need to place a considerable amount of identical content on multiple pages. On the first occurrence of the content, call HPDF_Page_New_Content_Stream before you start creating the content, in order to place the content in a separate stream. Call HPDF_Page_New_Content_Stream again after you have finished the content. Then, on subsequent pages, call HPDF_Page_Insert_Shared_Content_Stream to place the content on that page.
Parameters
page - The handle of a page object.
new_stream - A reference to a HPDF_Dict that identifies the new stream.
Returns
When HPDF_Page_New_Content_Stream() succeed, it returns HPDF_OK, otherwise it returns an error code.
HPDF_STATUS HPDF_Page_Insert_Shared_Content_Stream (HPDF_Page page, HPDF_Dict* shared_stream);
Description
Call HPDF_Page_New_Content_Stream whenever you want to change to a new content stream on the page. The call can return a reference to the new content stream in new_stream. This reference can be used on a later page to call HPDF_Page_Insert_Shared_Content_Stream.
The use case is when you need to place a considerable amount of identical content on multiple pages. On the first occurrence of the content, call HPDF_Page_New_Content_Stream before you start creating the content, in order to place the content in a separate stream. Call HPDF_Page_New_Content_Stream again after you have finished the content. Then, on subsequent pages, call HPDF_Page_Insert_Shared_Content_Stream to place the content on that page.
Parameters
page - The handle of a page object.
shared_stream - A reference to a HPDF_Dict previously returned from HPDF_Page_New_Content_Stream.
Returns
When HPDF_Page_Insert_Shared_Content_Stream() succeed, it returns HPDF_OK, otherwise it returns an error code.