-
Notifications
You must be signed in to change notification settings - Fork 3
Home
This wiki is direct adaptation of https://github.com/libharu/libharu/wiki for Sciter.
Doc doesn't have any Properties.
-
Description
addPage() creates a new page and adds it after the last page of a document.
-
Return Value
addPage() returns the handle of created page object on success. Otherwise, it returns error-code and error-handler is called.
-
Description
newDoc() creates a new document. If Doc object already has a document, the current document is revoked.
-
Return Value
newDoc () returns HPDF_OK on success. Otherwise, it returns error-code and error-handler is called.
-
Description
save() saves the current document to a file.
-
Parameters
file_name - The name of file to save.
-
Return Value
Returns HPDF_OK on success, otherwise it returns error-code and error-handler is called.
-
Description
loadTTFontFromFile() loads a TrueType font from an external file and register it to a document object.
-
Parameters
file_name - A path of a TrueType font file (.ttf).
embedding - If this parameter is set to true, the glyph data of the font is embedded, otherwise only the matrix data is included in PDF file.
-
Return Value
When loadTTFontFromFile() succeeds, it returns the name of a font. Otherwise, it returns NULL and error-handler is called.
-
Description
getFont gets the handle of a requested font object.
-
Parameters
font_name - A valid font name. encoding_name - A valid encoding name.
-
Return Value
When getFont() succeeds, it returns the handle of a font object. Otherwise, it returns NULL and error-handler is called.
-
Description
setPassword() sets a password for the document. If the password is set, document contents are encrypted.
-
Parameters
owner_password - The password for the owner of the document. The owner can change the permission of the document. NULL, zero length string, and the same value as user password are not allowed.
user_password - The password for the user of the document. The user_password may be set to NULL or zero length string.
-
Return Value
When setPassword() succeeds, it returns HPDF_OK. Otherwise, it returns error code and error-handler is called.
-
Description
loadPngImageFromFile() loads an external PNG image file.
-
Parameters
filename - A path to a PNG image file.
-
Return Value
When loadPngImageFromFile() succeeds, it returns the handle of an image object. Otherwise, it returns NULL and error-handler is called.
-
Description
loadJpegImageFromFile() loads an external JPEG image file.
-
Parameters
filename - Path to a JPEG image file.
-
Return Value
When loadJpegImageFromFile() succeeds, it returns the handle of an image object. Otherwise, it returns NULL and error-handler is called.
- Description
free() revokes a document object and all resources.
Page doesn't have any Properties.
- Description
getWidth() gets the width of the page.
- Returns
When getWidth() succeed, it returns the width of the page. Otherwise it returns 0.
- Description
setWidth() changes the width of a page.
- Parameters
width - The new page width. Valid value are between 3 and 14400.
- Returns
returns a handle of document object. If it failed, it returns NULL.
- Description
setHeight() changes the height of a page.
- Parameters
height - The new page height. Valid values are between 3 and 14400.
- Returns
returns a handle of document object. If it failed, it returns NULL.
- Description
setSize() changes the size and direction of a page to a predefined size.
- Parameters
size - Specify a predefined page-size value. The following values are available.
Value | Size (mm or inches) | Size (in pixels) |
---|---|---|
Page.SIZE_LETTER | 8.5 x 11 (inches) | 612 x 792 |
Page.SIZE_LEGAL | 8.5 x 14 (inches) | 612 x 1008 |
Page.SIZE_A3 | 297 x 420 (mm) | 841.89 x 1199.551 |
Page.SIZE_A4 | 210 x 297 (mm) | 595.276 x 841.89 |
Page.SIZE_A5 | 148 x 210 (mm) | 419.528 x 595.276 |
Page.SIZE_B4 | 250 x 353 (mm) | 708.661 x 1000.63 |
Page.SIZE_B5 | 176 x 250 (mm) | 498.898 x 708.661 |
Page.SIZE_EXECUTIVE | 7.25 x 10.5 (inches) | 522 x 756 |
Page.SIZE_US4x6 | 4 x 6 (inches) | 288 x 432 |
Page.SIZE_US4x8 | 4 x 8 (inches) | 288 x 576 |
Page.SIZE_US5x7 | 5 x 7 (inches) | 360 x 504 |
Page.SIZE_COMM10 | 4.125 x 9.5 (inches) | 297 x 684 |
direction - Specify the direction of the page.
Value | Description |
---|---|
Page.PORTRAIT | Set the longer value to vertical. |
Page,LANDSCAPE | Set the longer value to horizontal. |
- Returns
When setSize() succeeds, it returns HPDF_OK. Otherwise, it returns error-code and error-handler is called.
- Description
setLineWidth() sets the width of the line used to stroke a path.
- Parameter
width - The width of line.
- Returns
When setLineWidth() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
- Description
rectangle() appends a rectangle to the current path.
- Parameter
x, y - The lower-left point of the rectangle. width - The width of the rectangle. height - The height of the rectangle.
- Returns
When rectangle() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
- Description
stroke() paints the current path.
- Returns
When stroke() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
- Description
beginText() begins a text object and sets the current text position to the point (0, 0).
- Returns
When beginText() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
- Description
endText() ends a text object.
- Returns
When endText() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
textOut() prints the text on the specified position.
-
Parameter
x, y - The point position where the text is displayed. text - The text to show.
-
Returns
When textOut() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
moveTextPos() moves the current text position to the start of the next line with using specified offset values. If the start position of the current line is (x1, y1), the start of the next line is (x1 + x, y1 + y).
-
Parameter
x, y - The offset of the start of the next line. text - The text to show.
-
Returns
When moveTextPos() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
showText() prints the text at the current position on the page.
-
Parameter
text - The text to print.
-
Returns
When showText() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setFontAndSize() sets the type of font and size leading.
-
Parameter
font - The handle of a font object. size - The size of a font.
-
Returns
When setFontAndSize() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
moveTo() starts a new subpath and move the current point for drawing path, moveTo() sets the start point for the path to the point (x, y) and changes the graphics mode to HPDF_GMODE_PATH_OBJECT.
-
Parameter
x, y - The start point for drawing path
-
Returns
When moveTo() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
lineTo() appends a path from the current point to the specified point.
-
Parameter
x, y - The end point of the path
-
Returns
When lineTo() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
measureText() calculates the byte length which can be included within the specified width.
-
Parameters
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).
-
Returns
When 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.
-
Description
textRect() print the text inside the specified region.
-
Parameter
{left, top, right, bottom} : Object - Coordinates of corners of the region to output text.
text - The text to show.
align - The alignment of the text. VALUE Page.TALIGN_LEFT - The text is aligned to left. Page.TALIGN_RIGHT - The text is aligned to right. Page.TALIGN_CENTER - The text is aligned to center. Page.TALIGN_JUSTIFY - Add spaces between the words to justify both left and right side.
-
Returns
When textRect() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setRGBStroke() sets the stroking color.
-
Parameter
r, g, b - The level of each color element. They must be between 0 and 1.
-
Returns
When setRGBStroke() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setRGBFill() sets the fill color.
-
Parameter
r, g, b - The level of each color element. They must be between 0 and 1.
-
Returns
When setRGBFill() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
fill() fills the current path using the nonzero winding number rule.
-
Returns
When fill() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setCharSpace() sets the character spacing for text showing. The initial value of character spacing is 0.
-
Parameter
value - The value of character spacing.
-
Returns
When setCharSpace() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setWordSpace() sets the word spacing for text showing. The initial value of word spacing is 0.
-
Parameter
value - The value of word spacing.
-
Returns
When setWordSpace() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setTextLeading() sets the text leading (line spacing) for text showing. The initial value of leading is 0.
-
Parameter
value - The value of text leading.
-
Returns
When setTextLeading() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
drawImage() shows an image in one operation.
-
Parameter
image - The handle of an image object.
x, y - The lower-left point of the region where image is displayed. w - The width of the region where image is displayed. h - The height of the region where image is displayed.
-
Returns
When drawImage() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
circle() appends a circle to the current path.
-
Parameter
x, y - The center point of the circle. radius - The radius of the circle.
-
Returns
When circle() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
-
Description
setDash() sets the dash pattern for lines in the page.
-
Parameter
dash_pattern - Pattern of dashes and gaps used to stroke paths. num_elem - Number of elements in dash_pattern. 0 <= num_param <= 8. phase - The phase in which the pattern begins (default is 0).
-
Returns
When setDash() succeed, it returns HPDF_OK, Otherwise it returns error code and error-handler is invoked.
Image doesn't have any Properties.
- Description
getSize() gets the size of the image of an image object.
- Returns
When getSize() succeed, it returns an Object {width, height} which includes the size of the image. Otherwise, it returns a Object {width, height} whose value is (0, 0).
- Description
getWidth() gets the width of the image of an image object.
- Returns
When getWidth() succeed, it returns the width of the image. Otherwise, it returns 0.
- Description
getHeight() gets the height of the image of an image object.
- Returns
When getHeight() succeed, it returns the height of the image. Otherwise, it returns 0.
-
Description
setMaskImage() sets the mask image.
-
Parameters
mask_image - Specify the handle of an image object which is used as image-mask. This image must be 1bit gray-scale color image.
-
Returns
When setMaskImage() succeed, it returns HPDF_OK. Otherwise it returns error code and an error-handler will be invoked.
Font doesn't have any Properties.
-
Description
getUnicodeWidth() gets the width of a Unicode character in a specific font. Actual width of the character on the page can be calculated as follows: char_width = Font.getUnicodeWidth(UNICODE); let actual_width = char_width * FONT_SIZE / 1000;
-
Parameters
code - A Unicode character.
-
Returns
Returns character width on success. Otherwise, returns null.