Struct pdfsdk::PDFGen
Properties Methods Events Config Settings Errors
The PDFGen struct creates PDF documents from scratch.
Syntax
pdfsdk::PDFGen
Remarks
PDFGen is a versatile document generation struct that can be used to create PDF documents in a highly customizable way.
Preparing the document for editing is as easy as calling create_new. Before calling this method, optionally configure baseline properties that you would like to apply to the new document, such as its page dimensions (set_layout), page numbering (set_document_property), or PDF/A compliance requirements (pdfa_conformance_level). Then start composing the document by adding content. When finished, call close to close the document and save the changes to either output_file or output_data.
The example below configures page numbers in the right header, adds a centered title with bold and underline formatting, and finally adds a left-aligned paragraph.
PDFGen pdfgen = new PDFGen();
pdfgen.OutputFile = "output.pdf";
pdfgen.SetDocumentProperty("PageRightHeader", "%PAGENUMBER%");
pdfgen.CreateNew();
pdfgen.SetAlignment((int)HorizontalAlignments.haCenter, (int)VerticalAlignments.vaTop);
pdfgen.SetFont("Arial", "20", "bold underline", "forestgreen");
pdfgen.AddText("The Preface", false);
pdfgen.SetFont("Times New Roman", "14", "regular", "black");
pdfgen.AddBreak(0, 2);
pdfgen.SetAlignment((int)HorizontalAlignments.haLeft, (int)VerticalAlignments.vaTop);
pdfgen.AddParagraph("The artist is the creator of beautiful things. To reveal art and conceal the artist is art's aim. The critic is he who can translate into another manner or a new material his impression of beautiful things.");
pdfgen.Close();
Canvases and the Editing Process
Every editing operation performed by PDFGen goes through a canvas, which is an editing window with a set of rules and operations defined for it that is either:
- A text canvas, which can be thought of as a multi-line rich text editor;
- A drawing canvas, a rectangular random-access drawing area; or
- A table canvas, a rectangular grid of rows and columns.
The canvas types are distinct, meaning only one of them can be used at a time to create a specific piece of content. Canvases of different types can be grouped together or used as part of other canvases, which provides a powerful and flexible tool for creating content of various types and complexities. For example, a drawing canvas containing a graphic can be embedded into a text canvas containing the document body.
When create_new is called, the struct automatically creates a page-wide text canvas (a "page canvas") so you can start adding content right away. This canvas takes into account the dimensions of the page and any margins configured. One-inch margins are set by default. Upon reaching the end of the page, the struct closes the corresponding canvas, creates a new one for the next page (thus "turning the page" behind the scenes), and continues until all the content has been added.
You can always create your own canvases (and sub-canvases) should you need to add non-standard kinds of content that go beyond the traditional document layout, such as marginal notes, watermarks, or signatures.
Additionally, a canvas exists in one of three states:
- Open, where it is in the process of editing and the content can still be changed;
- Closed, where editing has been completed and the content has been finalized ("committed"); or
- Rendered, where the content has been serialized from its internal closed representation into a PDF graphics stream.

Changes made to an open canvas may influence how the content is represented in the document when the canvas is eventually rendered. For example, any text added to a center-aligned line in a text canvas will cause existing text to move leftward. Any text added to a drawing canvas - which is random access and does not offer the capability of formatting - will not affect any other content added to it previously.
A closed canvas resembles an opaque rectangle filled with visual elements. Once a canvas is closed, all such elements become locked and their dimensions are known, which enables their absolute positions and sizes to be calculated unambiguously as the struct can be certain that they will not change.

During the editing process, PDFGen creates pieces of content, fills them in, closes them, and renders them onto the page. It adds content to the document sequentially like a typewriter: once added, content cannot be deleted. However, unlike a typewriter, content can be automatically formatted by the struct on a later stage. For example, updating the dimensions of a text canvas may cause elements added to it previously to be rearranged, similar to how expanding a text area control in a browser form rearranges its content.
Text Canvases
A text canvas is a vertical series of lines, each comprised of a horizontal series of elements. It is analogous to a traditional text editor and is used for creating structured (mostly textual) content, which is added element by element, line by line. Pages, signature fields added via add_signature_field, and table cells are all kinds of text canvases.Random access is not allowed in text canvases; instead, the struct stacks elements in the current line and arranges them as they are added. This means that in general, the dimensions of a text canvas (its canvas_width and canvas_height) are not fixed and may expand horizontally and vertically.
If the current line is full and cannot accommodate a subsequent element (and the chosen constraints do not allow for it to be expanded), in most cases the struct completes the current line, adds a new one, places the cursor at the beginning of the new line, and adds the element there. However, if the element's width exceeds canvas_max_width, it will not fit in the new line either, so the on_out_of_space event fires to give your code a chance to forcefully expand the canvas or cancel the insertion of the element altogether.
Similarly, exceeding canvas_max_height also causes the struct to automatically wrap to the next default canvas (e.g., the next page or column) or trigger on_out_of_space. Subscribe to that event to recover from failed calls in a flexible way.
Drawing Canvases
A drawing canvas is analogous to a drawing board and is used for creating free-form vector content in two-dimensional Cartesian space. A drawing canvas provides random access: primitives can be placed anywhere within its bounds in any order, and all coordinates are specified relative to the bottom-left corner of the canvas.Content is built from path primitives, which include lines, curves, and closed shapes that can be stroked, filled, or used to define clipping regions. Common shapes such as rectangles, circles, and polygons are also supported directly, as is importing SVG path data via add_drawing and placing bitmaps via add_bitmap.
The visual appearance of each primitive is controlled by the active pen and brush at the time the path is started. The pen governs the stroke (color, thickness, style, line cap, and line join) and the brush governs the fill (color and opacity). Use set_pen and set_brush to configure these properties; they remain in effect until changed.
The dimensions of a drawing canvas are fixed at creation time. Content that exceeds these bounds is clipped. When committed to its parent canvas via end_drawing, the drawing canvas can be scaled, skewed, and rotated as needed.
When committed to a text canvas, a drawing canvas is treated as an inline element and flows with surrounding content, just like text and bitmaps. When committed to another drawing canvas, it is positioned at explicit coordinates within that canvas.
Table Canvases
A table canvas is used for creating grid-based content organized into rows and columns. The column count is fixed at creation time; rows and cells are added sequentially, and the layout engine resolves all column widths and row heights when the table is committed to its parent canvas via end_table.Each cell is itself a text canvas, so any content that can be added to a page can also be added to a cell, including paragraphs, bitmaps, and nested drawing canvases. Cells can span multiple columns or rows, which the layout engine automatically accounts for when distributing space.
Width constraints can be specified at both the table and cell level. When no preferred width is given, the layout engine distributes available space proportionally across columns based on their content. Row heights follow the same principle: the height of each row is determined by the tallest cell it contains, unless a fixed or minimum height is specified via start_table_row.
The pen and brush active when a cell is opened determine its border style and background fill. Individual cell borders can be suppressed via a bitmask passed to start_table_cell, allowing any combination of top, right, bottom, and left borders to be hidden independently.
Object Lifetime
The new() method returns a mutable reference to a struct instance. The object itself is kept in the global list maintained by PDFSDK. Due to this, the PDFGen struct cannot be disposed of automatically. Please, call the dispose(&self) method of PDFGen when you have finished using the instance.
Property List
The following is the full list of the properties of the struct with short descriptions. Click on the links for further details.
| attachment_count | The number of records in the Attachment arrays. |
| attachment_af_relationship | The value of the AFRelationship key for the attachment, for example Alternative or Source . |
| attachment_type | The type of the attachment. |
| attachment_content_type | The content type of the attachment. |
| attachment_creation_date | The creation date of the attachment. |
| attachment_data | The raw data of the attachment. |
| attachment_description | A textual description of the attachment. |
| attachment_file_name | The path and filename of the attachment. |
| attachment_modification_date | The date and time of the file's last modification. |
| attachment_name | The name of the attachment. |
| attachment_size | The attachment's size in bytes. |
| brush_color | The fill color of the brush in hash-prefixed hexadecimal format or as a name. |
| brush_opacity | The opacity of the brush fill, from 0 (fully transparent) to 1 (fully opaque). |
| canvas_type | The type of the canvas. |
| canvas_content_anchor | This property is currently unsupported. |
| canvas_drawing | Whether the canvas is a random-access drawing canvas. |
| canvas_drawing_mode | How paths interact with the drawing canvas. |
| canvas_height | The current height of the canvas in points. |
| canvas_horizontal_alignment | The current horizontal alignment for text content in the text canvas. |
| canvas_max_height | The maximum height of the canvas in points. |
| canvas_max_width | The maximum width of the canvas in points. |
| canvas_min_height | The minimum height of the canvas in points. |
| canvas_min_width | The minimum width of the canvas in points. |
| canvas_vertical_alignment | The current vertical alignment for text content in the text canvas. |
| canvas_width | The current width of the canvas in points. |
| canvas_x | The X coordinate of the canvas in points. |
| canvas_y | The Y coordinate of the canvas in points. |
| font_color | The color of the current font in hash-prefixed hexadecimal format or as a name. |
| font_name | The name of the current font. |
| font_path | The full file path to the current font, for example C:\\Windows\\Fonts\\times. |
| font_size | The size of the current font in points. |
| font_style | The style of the current font. |
| layout_col_count | The number of columns on the page. |
| layout_content_anchor | This property is currently unsupported. |
| layout_height | The height of the page in points. |
| layout_size | The size of the page. |
| layout_width | The width of the page in points. |
| output_data | A byte array containing the PDF document after processing. |
| output_file | The path to a local file where the output is written. |
| overwrite | Whether the struct should overwrite files. |
| pdfa_conformance_level | The PDF/A conformance level of the document. |
| pen_color | The stroke color of the pen in hash-prefixed hexadecimal format or as a name. |
| pen_opacity | The opacity of the pen stroke, from 0 (fully transparent) to 1 (fully opaque). |
| pen_style | The style of the pen. |
| pen_thickness | The line width of the pen stroke in points. |
Method List
The following is the full list of the methods of the struct with short descriptions. Click on the links for further details.
| add_attachment | Adds an attachment to the document. |
| add_bitmap | Adds a bitmap image to the current canvas. |
| add_break | Adds a number of breaks to the text canvas. |
| add_button | Adds a button field to the form. |
| add_check_box | Adds a checkbox field to the form. |
| add_combo_box | Adds a combo box field to the form. |
| add_copy | Adds a copy of a previously saved element to the current canvas. |
| add_drawing | Adds a vector drawing described by an SVG path string to the current canvas. |
| add_heading | Adds a heading to the text canvas. |
| add_link | Adds a hyperlink to the current canvas. |
| add_list_box | Adds a list box field to the form. |
| add_list_item | Adds an item to a list, combo box, or list box. |
| add_paragraph | Adds a paragraph of text to the text canvas. |
| add_radio_button | Adds a radio button to the form. |
| add_signature_field | Adds a signature field to the form. |
| add_special | Adds a special element to the text canvas. |
| add_table_cell | Adds a single-paragraph cell to the current table row. |
| add_text | Adds a piece of text to the current canvas. |
| add_text_box | Adds a text box field to the form. |
| add_title | Adds a title to the text canvas. |
| cancel | Cancels the current canvas. |
| close | Closes the new document. |
| config | Sets or retrieves a configuration setting. |
| create_new | Creates a new PDF document. |
| draw_circle | Draws an ellipse or circle on the drawing canvas. |
| draw_curve_to | Adds a cubic Bezier curve segment to the current path. |
| draw_line_to | Adds a straight line segment to the current path. |
| draw_polygon | Draws a polygon on the drawing canvas. |
| draw_rectangle | Draws a rectangle on the drawing canvas. |
| end_combo_box | Completes the combo box field. |
| end_content | Completes the logical section. |
| end_drawing | Finalizes the drawing canvas and commits it to the parent canvas. |
| end_editing | Finalizes the text canvas and commits it to the parent canvas. |
| end_form | Completes and closes the current interactive form. |
| end_list | Completes the list. |
| end_list_box | Completes the list box field. |
| end_list_item | Completes the list item. |
| end_paragraph | Completes the paragraph. |
| end_path | Completes the current path and applies it to the drawing canvas. |
| end_signature_field | Completes the signature field. |
| end_table | Finalizes the table canvas and commits it to the parent canvas. |
| end_table_cell | Completes the current table cell. |
| end_table_row | Completes the current table row. |
| get_document_property | Returns the value of a document property. |
| get_field_property | Returns the value of a field property. |
| get_page_property | Returns the value of a page property. |
| move_to | Sets the current pen position on the drawing canvas. |
| remove_attachment | Removes an attachment from the document. |
| reset | Resets the struct. |
| save_style | Saves the currently configured font, pen, and brush as a named style. |
| scroll | Inserts a vertical gap into the text canvas. |
| set_alignment | Sets the alignment for subsequent text insertion operations. |
| set_brush | Sets the fill properties used when drawing shapes and cell backgrounds. |
| set_document_property | Sets the value of a document property. |
| set_field_property | Sets the value of a field property. |
| set_font | Sets the font properties to be applied to text. |
| set_layout | Sets the layout for new pages. |
| set_margin | Sets the margin for a typical element. |
| set_page_property | Sets the value of a page property. |
| set_pen | Sets the stroke properties used when drawing lines, paths, and borders. |
| set_style | Applies a previously saved style or one of the built-in styles. |
| start_combo_box | Begins a new combo box field for editing. |
| start_content | Begins a new logical section. |
| start_drawing | Initiates a new drawing canvas of the given dimensions. |
| start_editing | Initiates a new text canvas for editing. |
| start_form | Begins a new form. |
| start_list | Begins a new list for editing. |
| start_list_box | Begins a new list box field for editing. |
| start_list_item | Begins a new list item for editing. |
| start_paragraph | Begins a new paragraph for editing. |
| start_path | Starts a new vector path on the drawing canvas. |
| start_signature_field | Begins a new signature field for editing. |
| start_table | Initiates a new table canvas with a fixed number of columns. |
| start_table_cell | Begins a new cell in the current table row. |
| start_table_row | Begins a new row in the current table. |
Event List
The following is the full list of the events fired by the struct with short descriptions. Click on the links for further details.
| on_action_required | Fired when the struct encounters a conflict that it cannot resolve on its own. |
| on_editing_completed | Fired after a canvas has been closed. |
| on_error | Fired when information is available about errors during data delivery. |
| on_font_lookup | Fired when a required font is missing. |
| on_log | Fired once for each log message. |
| on_out_of_space | Fired when an element exceeds the maximum dimensions of the current text canvas. |
Config Settings
The following is a list of config settings for the struct with short descriptions. Click on the links for further details.
| AutoTurnPages | Whether to change the page automatically upon exceeding the lower page boundary. |
| CompressStreams | Whether to compress stream objects. |
| FallbackFont | The fallback font. |
| FontPaths | The font search paths. |
| FontPolicy | The font policy to follow. |
| LogLevel | The level of detail that is logged. |
| SaveChanges | Whether to save changes made to the document. |
| SystemFontNames | The system font names. |
| TempPath | The location where temporary files are stored. |
| UsedFonts | The fonts used in the document. |
| BuildInfo | Information about the product's build. |
| CodePage | The system code page used for Unicode to Multibyte translations. |
| LicenseInfo | Information about the current license. |
| MaskSensitiveData | Whether sensitive data is masked in log messages. |
| UseInternalSecurityAPI | Whether or not to use the system security libraries or an internal implementation. |
attachment_count property (PDFGen Struct)
The number of records in the Attachment arrays.
Syntax
fn attachment_count(&self) -> Result<i32, PDFSDKError>
fn set_attachment_count(&self, value : i32) -> Option<PDFSDKError>
Default Value
0
Remarks
This property controls the size of the following arrays:
- attachment_af_relationship
- attachment_content_type
- attachment_creation_date
- attachment_data
- attachment_description
- attachment_file_name
- attachment_modification_date
- attachment_name
- attachment_size
- attachment_type
Data Type
i32
attachment_af_relationship property (PDFGen Struct)
The value of the AFRelationship key for the attachment, for example Alternative or Source .
Syntax
fn attachment_af_relationship(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_af_relationship(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_af_relationship_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
This key in the file specification dictionary expresses the relationship between the attachment and the document, and it must be set for each attachment added to PDF/A-3 documents.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_type property (PDFGen Struct)
The type of the attachment.
Syntax
fn attachment_type(&self, AttachmentIndex : i32) -> Result<i32, PDFSDKError>
Possible Values
0 // Generic
1 // ElectronicInvoice
Default Value
0
Remarks
Possible values are:
| 0 (patGeneric - default) | A generic attachment. |
| 1 (patElectronicInvoice) | An XML invoice, for example in ZUGFeRD or Factur-X format. |
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
This property is read-only.
Data Type
i32
attachment_content_type property (PDFGen Struct)
The content type of the attachment.
Syntax
fn attachment_content_type(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_content_type(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_content_type_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
The content type of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_creation_date property (PDFGen Struct)
The creation date of the attachment.
Syntax
fn attachment_creation_date(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_creation_date(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_creation_date_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
The creation date of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_data property (PDFGen Struct)
The raw data of the attachment.
Syntax
fn attachment_data(&self, AttachmentIndex : i32) -> Result<Vec<u8>, PDFSDKError>
fn set_attachment_data(&self, AttachmentIndex : i32, value : Vec<u8>) -> Option<PDFSDKError> fn set_attachment_data_ref(&self, AttachmentIndex : i32, value : &[u8]) -> Option<PDFSDKError>
Default Value
""
Remarks
The raw data of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
Vec<u8>
attachment_description property (PDFGen Struct)
A textual description of the attachment.
Syntax
fn attachment_description(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_description(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_description_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
A textual description of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_file_name property (PDFGen Struct)
The path and filename of the attachment.
Syntax
fn attachment_file_name(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_file_name(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_file_name_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
The path and filename of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_modification_date property (PDFGen Struct)
The date and time of the file's last modification.
Syntax
fn attachment_modification_date(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_modification_date(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_modification_date_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
The date and time of the file's last modification.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_name property (PDFGen Struct)
The name of the attachment.
Syntax
fn attachment_name(&self, AttachmentIndex : i32) -> Result<String, PDFSDKError>
fn set_attachment_name(&self, AttachmentIndex : i32, value : &str) -> Option<PDFSDKError> fn set_attachment_name_ref(&self, AttachmentIndex : i32, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
The name of the attachment.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
Data Type
String
attachment_size property (PDFGen Struct)
The attachment's size in bytes.
Syntax
fn attachment_size(&self, AttachmentIndex : i32) -> Result<i64, PDFSDKError>
Default Value
0
Remarks
The attachment's size in bytes.
The AttachmentIndex parameter specifies the index of the item in the array. The size of the array is controlled by the attachment_count property.
This property is read-only.
Data Type
i64
brush_color property (PDFGen Struct)
The fill color of the brush in hash-prefixed hexadecimal format or as a name.
Syntax
fn brush_color(&self) -> Result<String, PDFSDKError>
Default Value
"#FFFFFF"
Remarks
Note that a brush with the default color will not produce a visible fill until it has been explicitly activated via set_brush.
This property is read-only.
Data Type
String
brush_opacity property (PDFGen Struct)
The opacity of the brush fill, from 0 (fully transparent) to 1 (fully opaque).
Syntax
fn brush_opacity(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The opacity of the brush fill, from 0 (fully transparent) to 1 (fully opaque).
This property is read-only.
Data Type
String
canvas_type property (PDFGen Struct)
The type of the canvas.
Syntax
fn canvas_type(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Page
1 // Text
2 // Drawing
3 // Table
4 // TableCell
5 // SignatureField
Default Value
0
Remarks
Possible values are:
| 0 (ctPage - default) | |
| 1 (ctText) | |
| 2 (ctDrawing) | |
| 3 (ctTable) | |
| 4 (ctTableCell) | |
| 5 (ctSignatureField) |
This property is also available as a parameter of the on_editing_completed event.
This property is read-only.
Data Type
i32
canvas_content_anchor property (PDFGen Struct)
This property is currently unsupported.
Syntax
fn canvas_content_anchor(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Top
1 // Center
2 // Bottom
Default Value
0
Remarks
This property is currently unsupported.
This property is read-only.
Data Type
i32
canvas_drawing property (PDFGen Struct)
Whether the canvas is a random-access drawing canvas.
Syntax
fn canvas_drawing(&self) -> Result<bool, PDFSDKError>
Default Value
false
Remarks
Whether the canvas is a random-access drawing canvas.
This property is read-only.
Data Type
bool
canvas_drawing_mode property (PDFGen Struct)
How paths interact with the drawing canvas.
Syntax
fn canvas_drawing_mode(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Drawing
1 // Clipping
2 // Mask
Default Value
0
Remarks
Possible values are:
| 0 (dmDrawing) | The path is rendered as a filled and/or stroked shape. |
| 1 (dmClipping) | The path defines a clipping region; subsequent drawing is masked to the interior of this path. |
| 2 (dmMask) | Reserved for future use. |
This property is read-only.
Data Type
i32
canvas_height property (PDFGen Struct)
The current height of the canvas in points.
Syntax
fn canvas_height(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
This property is also available as a parameter of the on_editing_completed event.
This property is read-only.
Data Type
String
canvas_horizontal_alignment property (PDFGen Struct)
The current horizontal alignment for text content in the text canvas.
Syntax
fn canvas_horizontal_alignment(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Left
1 // Center
2 // Right
3 // Justify
Default Value
0
Remarks
Possible values are:
| 0 (haLeft - default) | |
| 1 (haCenter) | |
| 2 (haRight) | |
| 3 (haJustify) |
This property is read-only.
Data Type
i32
canvas_max_height property (PDFGen Struct)
The maximum height of the canvas in points.
Syntax
fn canvas_max_height(&self) -> Result<String, PDFSDKError>
fn set_canvas_max_height(&self, value : &str) -> Option<PDFSDKError> fn set_canvas_max_height_ref(&self, value : &String) -> Option<PDFSDKError>
Default Value
"0"
Remarks
The maximum height of the canvas in points. Both integer and decimal values are supported.
Data Type
String
canvas_max_width property (PDFGen Struct)
The maximum width of the canvas in points.
Syntax
fn canvas_max_width(&self) -> Result<String, PDFSDKError>
fn set_canvas_max_width(&self, value : &str) -> Option<PDFSDKError> fn set_canvas_max_width_ref(&self, value : &String) -> Option<PDFSDKError>
Default Value
"0"
Remarks
The maximum width of the canvas in points. Both integer and decimal values are supported.
Data Type
String
canvas_min_height property (PDFGen Struct)
The minimum height of the canvas in points.
Syntax
fn canvas_min_height(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
The minimum height of the canvas in points.
This property is read-only.
Data Type
String
canvas_min_width property (PDFGen Struct)
The minimum width of the canvas in points.
Syntax
fn canvas_min_width(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
The minimum width of the canvas in points.
This property is read-only.
Data Type
String
canvas_vertical_alignment property (PDFGen Struct)
The current vertical alignment for text content in the text canvas.
Syntax
fn canvas_vertical_alignment(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Top
1 // Center
2 // Bottom
Default Value
0
Remarks
Possible values are:
| 0 (vaTop - default) | |
| 1 (vaCenter) | |
| 2 (vaBottom) |
This property is read-only.
Data Type
i32
canvas_width property (PDFGen Struct)
The current width of the canvas in points.
Syntax
fn canvas_width(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
This property is also available as a parameter of the on_editing_completed event.
This property is read-only.
Data Type
String
canvas_x property (PDFGen Struct)
The X coordinate of the canvas in points.
Syntax
fn canvas_x(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
This property is also available as a parameter of the on_editing_completed event.
This property is read-only.
Data Type
String
canvas_y property (PDFGen Struct)
The Y coordinate of the canvas in points.
Syntax
fn canvas_y(&self) -> Result<String, PDFSDKError>
Default Value
"0"
Remarks
This property is also available as a parameter of the on_editing_completed event.
This property is read-only.
Data Type
String
font_color property (PDFGen Struct)
The color of the current font in hash-prefixed hexadecimal format or as a name.
Syntax
fn font_color(&self) -> Result<String, PDFSDKError>
Default Value
"#000000"
Remarks
The color of the current font in hash-prefixed hexadecimal format or as a name.
This property is read-only.
Data Type
String
font_name property (PDFGen Struct)
The name of the current font.
Syntax
fn font_name(&self) -> Result<String, PDFSDKError>
Default Value
"Times New Roman"
Remarks
The name of the current font.
This property is read-only.
Data Type
String
font_path property (PDFGen Struct)
The full file path to the current font, for example C:\\Windows\\Fonts\\times.
Syntax
fn font_path(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The full file path to the current font, for example C:\Windows\Fonts\times.ttf.
This property returns an empty string if a built-in font is in use.
This property is read-only.
Data Type
String
font_size property (PDFGen Struct)
The size of the current font in points.
Syntax
fn font_size(&self) -> Result<String, PDFSDKError>
Default Value
"12"
Remarks
The size of the current font in points.
This property is read-only.
Data Type
String
font_style property (PDFGen Struct)
The style of the current font.
Syntax
fn font_style(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The style of the current font.
This property is read-only.
Data Type
String
layout_col_count property (PDFGen Struct)
The number of columns on the page.
Syntax
fn layout_col_count(&self) -> Result<i32, PDFSDKError>
Default Value
1
Remarks
The number of columns on the page.
This property is read-only.
Data Type
i32
layout_content_anchor property (PDFGen Struct)
This property is currently unsupported.
Syntax
fn layout_content_anchor(&self) -> Result<i32, PDFSDKError>
Possible Values
0 // Top
1 // Center
2 // Bottom
Default Value
0
Remarks
This property is currently unsupported.
This property is read-only.
Data Type
i32
layout_height property (PDFGen Struct)
The height of the page in points.
Syntax
fn layout_height(&self) -> Result<String, PDFSDKError>
Default Value
"792"
Remarks
The height of the page in points.
This property is read-only.
Data Type
String
layout_size property (PDFGen Struct)
The size of the page.
Syntax
fn layout_size(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The size of the page. Please see set_layout for more details.
This property is read-only.
Data Type
String
layout_width property (PDFGen Struct)
The width of the page in points.
Syntax
fn layout_width(&self) -> Result<String, PDFSDKError>
Default Value
"612"
Remarks
The width of the page in points.
This property is read-only.
Data Type
String
output_data property (PDFGen Struct)
A byte array containing the PDF document after processing.
Syntax
fn output_data(&self) -> Result<Vec<u8>, PDFSDKError>
Remarks
This property is used to read the byte array containing the produced output after the operation has completed. It is only set if an output file has not been assigned via output_file.
This property is read-only.
Data Type
Vec<u8>
output_file property (PDFGen Struct)
The path to a local file where the output is written.
Syntax
fn output_file(&self) -> Result<String, PDFSDKError>
fn set_output_file(&self, value : &str) -> Option<PDFSDKError> fn set_output_file_ref(&self, value : &String) -> Option<PDFSDKError>
Default Value
""
Remarks
This property is used to provide a path where the resulting PDF document is saved after the operation has completed.
Data Type
String
overwrite property (PDFGen Struct)
Whether the struct should overwrite files.
Syntax
fn overwrite(&self) -> Result<bool, PDFSDKError>
fn set_overwrite(&self, value : bool) -> Option<PDFSDKError>
Default Value
false
Remarks
This property indicates whether the struct overwrites output_file. If set to false, an error is thrown whenever output_file exists before an operation.
Data Type
bool
pdfa_conformance_level property (PDFGen Struct)
The PDF/A conformance level of the document.
Syntax
fn pdfa_conformance_level(&self) -> Result<i32, PDFSDKError>
fn set_pdfa_conformance_level(&self, value : i32) -> Option<PDFSDKError>
Possible Values
0 // None
1 // A1a
2 // A1b
3 // A2a
4 // A2b
5 // A2u
6 // A3a
7 // A3b
8 // A3u
9 // A4
10 // A4e
11 // A4f
Default Value
0
Remarks
This property is used to specify the desired PDF/A conformance level the struct attempts to apply when operating on the document.
Possible values are:
| 0 (paclNone - default) | No PDF/A compliance |
| 1 (paclA1a) | PDF/A-1a |
| 2 (paclA1b) | PDF/A-1b |
| 3 (paclA2a) | PDF/A-2a |
| 4 (paclA2b) | PDF/A-2b |
| 5 (paclA2u) | PDF/A-2u |
| 6 (paclA3a) | PDF/A-3a |
| 7 (paclA3b) | PDF/A-3b |
| 8 (paclA3u) | PDF/A-3u |
| 9 (paclA4) | PDF/A-4 |
| 10 (paclA4e) | PDF/A-4e |
| 11 (paclA4f) | PDF/A-4f |
Data Type
i32
pen_color property (PDFGen Struct)
The stroke color of the pen in hash-prefixed hexadecimal format or as a name.
Syntax
fn pen_color(&self) -> Result<String, PDFSDKError>
Default Value
"#000000"
Remarks
The stroke color of the pen in hash-prefixed hexadecimal format or as a name.
This property is read-only.
Data Type
String
pen_opacity property (PDFGen Struct)
The opacity of the pen stroke, from 0 (fully transparent) to 1 (fully opaque).
Syntax
fn pen_opacity(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The opacity of the pen stroke, from 0 (fully transparent) to 1 (fully opaque).
This property is read-only.
Data Type
String
pen_style property (PDFGen Struct)
The style of the pen.
Syntax
fn pen_style(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The style of the pen.
This property is read-only.
Data Type
String
pen_thickness property (PDFGen Struct)
The line width of the pen stroke in points.
Syntax
fn pen_thickness(&self) -> Result<String, PDFSDKError>
Default Value
""
Remarks
The line width of the pen stroke in points.
This property is read-only.
Data Type
String
add_attachment method (PDFGen Struct)
Adds an attachment to the document.
Syntax
fn add_attachment(&self, file_name : &str, description : &str, attachment_type : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to add an attachment (embedded file) to the document and to the Attachment* properties.
file_name and description specify the filename and description of the attachment respectively.
attachment_type specifies the type of the attachment. Possible values are:
| 0 (patGeneric - default) | A generic attachment. |
| 1 (patElectronicInvoice) | An XML invoice, for example in ZUGFeRD or Factur-X format. |
Example:
pdfgen.AddAttachment("foo.txt", "desc", (int)PDFAttachmentTypes.patGeneric);
// Alternatively, create a PDFAttachment object and add it to Attachments manually:
PDFAttachment attachment = new PDFAttachment();
attachment.FileName = "foo.txt";
// or attachment.DataB = new byte[] { ... };
attachment.Description = "desc";
pdfgen.Attachments.Add(attachment);
// Or using one of the constructors:
pdfgen.Attachments.Add(new PDFAttachment("foo.txt", "desc"));
pdfgen.Close();
The full list of attachments is contained in the Attachment* properties.
add_bitmap method (PDFGen Struct)
Adds a bitmap image to the current canvas.
Syntax
fn add_bitmap(&self, format : &str, bytes : &[u8], bitmap_width : i32, bitmap_height : i32, scale_width : &str, scale_height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a bitmap image to the current canvas.
Its behavior differs depending on the type of canvas it is called on. On a text canvas, the image is treated as an inline element and placed in the normal flow of content, following the same layout rules as text and other content. On a drawing canvas, the image is placed at the current pen position as set by move_to.
format specifies the image format and color space of the supplied bytes, as a combined string (e.g., png-rgb, jpeg-cmyk).
bytes contains the raw image data.
bitmap_width and bitmap_height specify the intrinsic pixel dimensions of the image.
scale_width and scale_height specify the rendered dimensions of the image. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
NOTE: This method throws an exception if a list is currently being edited.
add_break method (PDFGen Struct)
Adds a number of breaks to the text canvas.
Syntax
fn add_break(&self, break_kind : i32, count : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to add count breaks to the current text canvas, completing the current line, column, or page early and starting a new one (or multiple).
break_kind specifies the kind of break to add. Possible values are:
| 0 (bkLine) | A line break. |
| 1 (bkColumn) | Currently unsupported. |
| 2 (bkPage) | A page break. |
NOTE: This method throws an exception if the current canvas is not a text canvas.
add_button method (PDFGen Struct)
Adds a button field to the form.
Syntax
fn add_button(&self, field_name : &str, caption : &str, action_type : i32, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a button field with name field_name and caption caption.
action_type specifies the type of action that is executed when the button is pressed. Possible values are:
| 0 (batNone) | No action |
| 1 (batSubmit) | Submit-form action |
| 2 (batReset) | Reset-form action |
| 3 (batImport) | Import-data action |
width and height specify the width and height of the button. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_check_box method (PDFGen Struct)
Adds a checkbox field to the form.
Syntax
fn add_check_box(&self, field_name : &str, default_value : bool, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a checkbox field with name field_name.
default_value specifies the initial state of the checkbox (checked/unchecked).
width and height specify the width and height of the checkbox. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_combo_box method (PDFGen Struct)
Adds a combo box field to the form.
Syntax
fn add_combo_box(&self, field_name : &str, options : &str, default_value : &str, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a combo box field with name field_name.
options specifies a list of choices as a multi-line string.
default_value specifies the initial value selected in the combo box.
width and height specify the width and height of the combo box. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
To create a combo box incrementally instead of all at once, use start_combo_box and end_combo_box.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_copy method (PDFGen Struct)
Adds a copy of a previously saved element to the current canvas.
Syntax
fn add_copy(&self, id : &str, scale_x : &str, scale_y : &str, rotation : &str, skew_a : &str, skew_b : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a copy of an element that was previously saved in the struct to the current canvas.
id specifies the Id given to the saved:
- Canvas when it was closed in one of the canvas-finalizing End* methods
- Path when it was completed in end_path
- List when it was completed in end_list
- Paragraph when it was completed in end_paragraph
- Table row when it was closed in end_table_row
A saved element may be added any number of times, to any number of canvases.
On a text canvas, the copy is treated as an inline element and placed in the normal flow of content, following the same layout rules as text and other content. On a drawing canvas, the copy is placed at the current pen position as set by move_to.
Note that a saved path can only be added to a drawing canvas; attempting to add one to any other type of canvas throws an exception.
scale_x and scale_y specify the horizontal and vertical scale factors to apply to the copy when placing it on the current canvas, with 1.0 being the original size of the saved element (100%).
rotation specifies the rotation angle of the copy in degrees counterclockwise. If empty or 0, no rotation is applied.
skew_a and skew_b specify the horizontal and vertical skew angles of the copy in degrees. skew_a shears along the X axis and skew_b shears along the Y axis. If empty or 0, no skew is applied.
NOTE: This method throws an exception if a list is currently being edited.
add_drawing method (PDFGen Struct)
Adds a vector drawing described by an SVG path string to the current canvas.
Syntax
fn add_drawing(&self, svg_path : &str, scale_x : &str, scale_y : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to parse an SVG path data string and add the resulting drawing to the current canvas.
svg_path is a standard SVG path data string using the commands M, L, H, V, C, S, Q, T, A, Z (and their lowercase relative equivalents). The following commands are supported:
| M / m | Move to (absolute / relative) |
| L / l | Line to |
| H / h | Horizontal line to |
| V / v | Vertical line to |
| C / c | Cubic Bezier curve |
| S / s | Smooth cubic Bezier curve |
| Q / q | Quadratic Bezier curve |
| T / t | Smooth quadratic Bezier curve |
| A / a | Elliptical arc |
| Z / z | Close path |
scale_x and scale_y specify the horizontal and vertical scale factors to apply to the drawing when placing it on the parent canvas. These parameters accept real values, with 1.0 being the actual size of the drawing (100%).
If the current canvas is already a drawing canvas, the path is imported directly into it. Otherwise, a temporary drawing canvas is created, the path is added to it, and the canvas is committed to the current canvas using scale_x and scale_y.
NOTE: This method throws an exception if a list is currently being edited.
add_heading method (PDFGen Struct)
Adds a heading to the text canvas.
Syntax
fn add_heading(&self, level : i32, text : &str) -> Result<(), PDFSDKError>
Remarks
This method is currently unsupported.
add_link method (PDFGen Struct)
Adds a hyperlink to the current canvas.
Syntax
fn add_link(&self, text : &str, url : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a clickable hyperlink to the current canvas whose visible label is text. Clicking the link opens the external URL specified by url.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_list_box method (PDFGen Struct)
Adds a list box field to the form.
Syntax
fn add_list_box(&self, field_name : &str, options : &str, default_value : &str, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a list box field with name field_name.
options specifies a list of choices as a multi-line string.
default_value specifies the initial value selected in the list box.
width and height specify the width and height of the list box. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
To create a list box incrementally instead of all at once, use start_list_box and end_list_box.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_list_item method (PDFGen Struct)
Adds an item to a list, combo box, or list box.
Syntax
fn add_list_item(&self, text : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add text as either a list item or a choice in a combo box or list box field.
When this method is used to add a choice to a form field, text can either contain a user-readable value alone, or be followed by an internal (exported) name that is recorded as the value of the field if the option is selected. If provided, the internal name must be separated from the preceding user-readable value by the vertical bar character (|). If the internal name postfix is omitted, the user-readable value is recorded as the field value if the option is selected.
Example:
// The value displayed to the user is "Pineapple", and the exported value is "pineapple"
pdfgen.AddListItem("Pineapple|pineapple");
// The exported value of the option matches the value displayed to the user ("Olives")
pdfgen.AddListItem("Olives");
// The value displayed to the user is "Roasted Marshmallows", and the exported value is "marshmallows"
pdfgen.AddListItem("Roasted Marshmallows|marshmallows");
To create a list item incrementally instead of all at once, use start_list_item and end_list_item.
NOTE: This method throws an exception if the current canvas is not a text canvas.
NOTE: If used to add a list item, this method throws an exception if a list is not currently being edited.
add_paragraph method (PDFGen Struct)
Adds a paragraph of text to the text canvas.
Syntax
fn add_paragraph(&self, text : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a paragraph of text to the current text canvas, which is done by breaking the text into lines and then words, and adding each word as a separate piece of text. When the end of a line is reached, the struct inserts a line break and applies the line spacing set in set_margin before continuing on to the next line of the paragraph.
Use set_alignment and set_font to adjust the parameters of the text that comprises the new paragraph, and use set_margin to indent the first line of the paragraph.
To create a paragraph incrementally instead of all at once, use start_paragraph and end_paragraph.
NOTE: If text is empty, a line break is added.
NOTE: This method throws an exception if the current canvas is not a text canvas or if a list is currently being edited.
add_radio_button method (PDFGen Struct)
Adds a radio button to the form.
Syntax
fn add_radio_button(&self, field_name : &str, radio_group : &str, is_default_button : bool, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a radio button field with name field_name within the radio group radio_group.
is_default_button specifies whether the radio button will be selected initially (i.e., whether it will be the default value of the radio group).
width and height specify the width and height of the radio button. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_signature_field method (PDFGen Struct)
Adds a signature field to the form.
Syntax
fn add_signature_field(&self, field_name : &str, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a signature field with name field_name as a text canvas.
width and height specify the width and height of the signature field. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
To create a signature field incrementally instead of all at once, use start_signature_field and end_signature_field.
NOTE: This method only applies if the current canvas is a text canvas.
NOTE: This method throws an exception if a list is currently being edited.
add_special method (PDFGen Struct)
Adds a special element to the text canvas.
Syntax
fn add_special(&self, object_type : i32, content : &str) -> Result<(), PDFSDKError>
Remarks
This method is currently unsupported.
add_table_cell method (PDFGen Struct)
Adds a single-paragraph cell to the current table row.
Syntax
fn add_table_cell(&self, text : &str, width : &str) -> Result<(), PDFSDKError>
Remarks
This convenience method is used to open a new cell, add text as a paragraph, and close the cell in a single call. It is equivalent to calling start_table_cell with col_span and row_span set to 1 and borders set to 0, followed by add_paragraph and end_table_cell.
text specifies the text content of the cell. If empty, an empty cell is added.
width specifies the cell width constraints using the same [preferred]:[min]:[max] syntax as the corresponding parameter in start_table_cell. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
Use this method when a cell contains only a single plain-text paragraph and does not require colspan, rowspan, or complex inner content. For cells with richer content or spanning requirements, use start_table_cell and end_table_cell directly.
NOTE: This method throws an exception if the current canvas is not a table canvas.
add_text method (PDFGen Struct)
Adds a piece of text to the current canvas.
Syntax
fn add_text(&self, text : &str, wrappable : bool) -> Result<(), PDFSDKError>
Remarks
This method is used to add a piece of text to the current canvas. Use set_alignment and set_font to adjust new text parameters.
wrappable is reserved for future use.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_text_box method (PDFGen Struct)
Adds a text box field to the form.
Syntax
fn add_text_box(&self, field_name : &str, default_value : &str, multi_line : bool, password : bool, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a text box field with name field_name.
default_value specifies the initial value contained in the text box.
multi_line specifies whether the text box can contain multiple lines of text.
password specifies whether the text box is intended to contain a password. Pass true to have the text displayed as asterisk characters (*).
width and height specify the width and height of the text box. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
add_title method (PDFGen Struct)
Adds a title to the text canvas.
Syntax
fn add_title(&self, text : &str) -> Result<(), PDFSDKError>
Remarks
This method is currently unsupported.
cancel method (PDFGen Struct)
Cancels the current canvas.
Syntax
fn cancel(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to cancel the canvas that is currently being edited. It should be called after one of the following methods as an alternative to setting choice to oscFullCancel within the on_out_of_space event:
Example:pdfgen.StartEditing("100", "100", (int)ContentAnchors.caTop);
pdfgen.AddText("Hello world!", false);
try
{
pdfgen.EndEditing("1", "1", "0", "0", "0", "");
}
catch (PDFSDKException ex)
{
pdfgen.Cancel();
}
NOTE: This method throws an exception if the current canvas is a page canvas.
close method (PDFGen Struct)
Closes the new document.
Syntax
fn close(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to close the new document. It should always be preceded by a call to create_new.
Example:
pdfgen.OutputFile = "output.pdf";
pdfgen.CreateNew();
// Some operation
pdfgen.Close();
The document is saved automatically to output_file or output_data when this method is called.
To configure this saving behavior, set SaveChanges.
config method (PDFGen Struct)
Sets or retrieves a configuration setting.
Syntax
fn config(&self, configuration_string : &str) -> Result<String, PDFSDKError>
Remarks
config is a generic method available in every struct. It is used to set and retrieve configuration settings for the struct.
These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.
To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).
To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.
create_new method (PDFGen Struct)
Creates a new PDF document.
Syntax
fn create_new(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to create a blank PDF document with one empty page and an underlying page canvas. Use set_layout to adjust the new page dimensions and number of columns. Having created the baseline document, use the struct's methods to add objects to it.
Upon completion of this method, information about the newly created page canvas can be accessed using the canvas property.
draw_circle method (PDFGen Struct)
Draws an ellipse or circle on the drawing canvas.
Syntax
fn draw_circle(&self, radius_x : &str, radius_y : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a closed elliptical shape to the current drawing canvas, centered at the current pen position as set by move_to.
radius_x and radius_y specify the horizontal and vertical radii of the ellipse. To draw a perfect circle, pass equal values for both. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
Use set_pen and set_brush before calling this method to control the border style and fill color.
NOTE: This method throws an exception if the current canvas is not a drawing canvas.
draw_curve_to method (PDFGen Struct)
Adds a cubic Bezier curve segment to the current path.
Syntax
fn draw_curve_to(&self, x : &str, y : &str, via_x1 : &str, via_y1 : &str, via_x2 : &str, via_y2 : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to extend the currently open path on the drawing canvas with a cubic Bezier curve from the current pen position to the endpoint specified by x and y. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
via_x1 and via_y1 specify the first control point, which influences the curve near its start.
via_x2 and via_y2 specify the second control point, which influences the curve near its end.
Upon completion of this method, the current pen position will be moved to (x, y).
NOTE: This method throws an exception if the current canvas is not a drawing canvas or if no path has been started with start_path.
draw_line_to method (PDFGen Struct)
Adds a straight line segment to the current path.
Syntax
fn draw_line_to(&self, x : &str, y : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to extend the currently open path on the drawing canvas with a straight line from the current pen position to the point specified by x and y. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
Upon completion of this method, the current pen position will be moved to (x, y).
NOTE: This method throws an exception if the current canvas is not a drawing canvas or if no path has been started with start_path.
draw_polygon method (PDFGen Struct)
Draws a polygon on the drawing canvas.
Syntax
fn draw_polygon(&self, points : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a closed polygon defined by a list of vertices to the current drawing canvas.
points specifies a comma-separated list of coordinate pairs in the form X1,Y1,X2,Y2,...,XN,YN containing at least three vertices. All coordinates are relative to the bottom-left corner of the drawing canvas. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
The first vertex is used as the starting point. Subsequent vertices are connected with straight line segments. After the last vertex, the path is automatically closed back to the first vertex.
The polygon is stroked and filled using the current pen and brush. Use set_pen and set_brush before calling this method to control the border style and fill color.
NOTE: This method throws an exception if the current canvas is not a drawing canvas or if fewer than three vertices are supplied.
draw_rectangle method (PDFGen Struct)
Draws a rectangle on the drawing canvas.
Syntax
fn draw_rectangle(&self, width : &str, height : &str, corner_radius : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to add a rectangle to the current drawing canvas. The rectangle is defined by its bottom-left corner at the current pen position as set by move_to, and the specified width and height. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
corner_radius specifies the radius of the rounded corners of the rectangle. If greater than 0, each corner is replaced by a circular arc of the given radius. If the radius exceeds half the shorter side of the rectangle, it is automatically clamped to that maximum.
The rectangle is stroked and filled using the current pen and brush. Use set_pen and set_brush before calling this method to control the border style and fill color.
NOTE: This method throws an exception if the current canvas is not a drawing canvas.
end_combo_box method (PDFGen Struct)
Completes the combo box field.
Syntax
fn end_combo_box(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the combo box field started in start_combo_box. Note that the combo box can no longer be modified after it is completed.
NOTE: This method throws an exception if the current canvas is not a text canvas.
end_content method (PDFGen Struct)
Completes the logical section.
Syntax
fn end_content(&self) -> Result<(), PDFSDKError>
Remarks
This method is currently unsupported.
end_drawing method (PDFGen Struct)
Finalizes the drawing canvas and commits it to the parent canvas.
Syntax
fn end_drawing(&self, scale_x : &str, scale_y : &str, rotation : &str, skew_a : &str, skew_b : &str, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to close the drawing canvas opened in start_drawing and commit it to its parent canvas. Any open path on the drawing canvas is automatically closed first. Note that the drawing canvas can no longer be modified after it is closed.
If the parent canvas is a text canvas, the closed canvas is treated as an inline element and placed in the normal flow of content, following the same layout rules as text and other content. If the parent canvas is a drawing canvas, the closed canvas is placed at the current pen position of the parent canvas as set by move_to.
scale_x and scale_y specify the horizontal and vertical scale factors to apply to the canvas when placing it on the parent canvas. These parameters default to 1 if empty.
rotation specifies the rotation angle of the canvas in degrees counterclockwise. If empty or 0, no rotation is applied.
skew_a and skew_b specify the horizontal and vertical skew angles of the canvas in degrees. skew_a shears along the X axis and skew_b shears along the Y axis. If empty or 0, no skew is applied.
The full transformation is applied in the following order: scale, skew, rotation, translation.
If canvas_id is non-empty, the closed canvas is also saved in the struct under that Id and can be added to other canvases with add_copy. Each saved Id must be unique, and a canvas that contains form fields cannot be saved.
NOTE: This method throws an exception if the current canvas is not a drawing canvas.
end_editing method (PDFGen Struct)
Finalizes the text canvas and commits it to the parent canvas.
Syntax
fn end_editing(&self, scale_x : &str, scale_y : &str, rotation : &str, skew_a : &str, skew_b : &str, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to close the text canvas opened in start_editing and commit it to its parent canvas. Note that the text canvas can no longer be modified after it is closed.
If the parent canvas is a text canvas, the closed canvas is treated as an inline element and placed in the normal flow of content, following the same layout rules as text and other content. If the parent canvas is a drawing canvas, the closed canvas is placed at the current pen position of the parent canvas as set by move_to.
scale_x and scale_y specify the horizontal and vertical scale factors to apply to the canvas when placing it on the parent canvas. These parameters default to 1 if empty.
rotation specifies the rotation angle of the canvas in degrees counterclockwise. If empty or 0, no rotation is applied.
skew_a and skew_b specify the horizontal and vertical skew angles of the canvas in degrees. skew_a shears along the X axis and skew_b shears along the Y axis. If empty or 0, no skew is applied.
The full transformation is applied in the following order: scale, skew, rotation, translation.
If canvas_id is non-empty, the closed canvas is also saved in the struct under that Id and can be added to other canvases with add_copy. Each saved Id must be unique, and a canvas that contains form fields cannot be saved.
NOTE: This method throws an exception if the current canvas is not a text canvas.
end_form method (PDFGen Struct)
Completes and closes the current interactive form.
Syntax
fn end_form(&self) -> Result<(), PDFSDKError>
Remarks
The method is used to complete the interactive form that was started explicitly in start_form or implicitly via a method such as add_check_box or add_text_box.
A PDF document can only contain one form, which can span multiple pages. After the form is closed, no more form fields can be added to the document.
NOTE: This method throws an exception if the current canvas is not a text canvas or if there is no active form in the document.
end_list method (PDFGen Struct)
Completes the list.
Syntax
fn end_list(&self, list_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the list started in start_list. Note that the list can no longer be modified after it is completed.
list_id is reserved for future use.
NOTE: This method throws an exception if a list is not currently being edited.
end_list_box method (PDFGen Struct)
Completes the list box field.
Syntax
fn end_list_box(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the list box field started in start_list_box. Note that the list box can no longer be modified after it is completed.
NOTE: This method throws an exception if the current canvas is not a text canvas.
end_list_item method (PDFGen Struct)
Completes the list item.
Syntax
fn end_list_item(&self, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the list item started in start_list_item and commit the underlying text canvas to its parent canvas. Note that the list item can no longer be modified after it is completed.
canvas_id is reserved for future use.
NOTE: This method throws an exception if a list is not currently being edited.
end_paragraph method (PDFGen Struct)
Completes the paragraph.
Syntax
fn end_paragraph(&self, para_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the paragraph started in start_paragraph and add a line break so that subsequent content starts on a new line. Note that the paragraph can no longer be modified after it is completed.
para_id is reserved for future use.
NOTE: This method only applies if the current canvas is a text canvas.
end_path method (PDFGen Struct)
Completes the current path and applies it to the drawing canvas.
Syntax
fn end_path(&self, close_path : bool, path_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the path started in start_path and record it as a drawing primitive on the current drawing canvas. The path is rendered according to the drawing mode specified in start_path when the canvas is eventually closed.
close_path specifies whether to close the path by drawing a straight line from the current pen position back to the path's starting point before applying the drawing mode. Pass true to close the path (useful for filled shapes), or false to leave the path open.
If path_id is non-empty, the completed path is also saved in the struct under that Id and can be added to other drawing canvases with add_copy. Each saved Id must be unique.
NOTE: This method throws an exception if the current canvas is not a drawing canvas.
end_signature_field method (PDFGen Struct)
Completes the signature field.
Syntax
fn end_signature_field(&self, scale_x : &str, scale_y : &str, rotation : &str, skew_a : &str, skew_b : &str, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to finalize the signature field started in start_signature_field and commit the underlying canvas to its parent canvas. Note that the signature field canvas can no longer be modified after it is closed.
scale_x and scale_y are reserved for future use.
rotation is reserved for future use.
skew_a and skew_b are reserved for future use.
canvas_id is reserved for future use.
NOTE: This method throws an exception if the current canvas is not a text canvas.
end_table method (PDFGen Struct)
Finalizes the table canvas and commits it to the parent canvas.
Syntax
fn end_table(&self, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to close the table canvas opened in start_table and commit it to its parent canvas. Any open cell or row in the table is automatically closed before the table layout is resolved. Note that the table canvas can no longer be modified after it is closed.
If canvas_id is non-empty, the closed canvas is also saved in the struct under that Id and can be added to other canvases with add_copy. Each saved Id must be unique, and a canvas that contains form fields cannot be saved.
NOTE: This method throws an exception if the current canvas is not a table canvas.
end_table_cell method (PDFGen Struct)
Completes the current table cell.
Syntax
fn end_table_cell(&self, canvas_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to explicitly close the cell opened in start_table_cell and commit the underlying cell canvas to its parent table canvas. Note that the cell canvas can no longer be modified after it is closed.
canvas_id is reserved for future use.
It is not necessary to call this method before starting the next cell via start_table_cell, as open cells are closed implicitly at that point.
NOTE: This method throws an exception if the current canvas is not a cell canvas.
end_table_row method (PDFGen Struct)
Completes the current table row.
Syntax
fn end_table_row(&self, row_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to explicitly close the row opened in start_table_row. Any open cell in the row is automatically closed first, and any columns that have not been filled with a cell are padded with empty cells so that the row always spans the full column count of the table. Note that the row can no longer be modified after it is closed.
row_id is reserved for future use.
It is not necessary to call this method before starting the next row via start_table_row, as open rows are closed implicitly at that point.
NOTE: This method throws an exception if the current canvas is not a table canvas.
get_document_property method (PDFGen Struct)
Returns the value of a document property.
Syntax
fn get_document_property(&self, document_property : &str) -> Result<String, PDFSDKError>
Remarks
This method is used to obtain the value of a document property. Together with set_document_property, this method provides an extensible way of managing the document settings that are not available through other means. The list of settings below may be extended in the future.
document_property specifies the document property to read. Possible values are:
| Document property | Default value | Description |
| FooterFromBottom | 36 | The vertical offset of the footer from the bottom page border in points. |
| HeaderFromTop | 36 | The vertical offset of the header from the top page border in points. |
| MirrorFooters | False | Whether to automatically swap the left and right footers in double-sided documents. If enabled, the left and right footers will be mirrored on alternating pages. |
| MirrorHeaders | False | Whether to automatically swap the left and right headers in double-sided documents. If enabled, the left and right headers will be mirrored on alternating pages. |
| MirrorMargins | False | Whether to automatically swap the left and right margins in double-sided documents. If enabled, the left and right margins will be mirrored on alternating pages. |
| PageFooter | "" | The central footer text. |
| PageFooterFont | Times New Roman | The font name for the footer text. |
| PageFooterFontColor | #000000 | The font color for the footer text. |
| PageFooterFontSize | 12 | The font size for the footer text. |
| PageFooterFontStyle | "" | The font style for the footer text. |
| PageHeader | "" | The central header text. |
| PageHeaderFont | Times New Roman | The font name for the header text. |
| PageHeaderFontColor | #000000 | The font color for the header text. |
| PageHeaderFontSize | 12 | The font size for the header text. |
| PageHeaderFontStyle | "" | The font style for the header text. |
| PageLeftFooter | "" | The left footer text. |
| PageLeftHeader | "" | The left header text. |
| PageNumber | 1 | The starting page number in the header or footer. |
| PageNumberFormat | Automatic | The page number format. Supported values: Automatic, Alpha, AlphaCaps, Roman, RomanCaps, Numeric. |
| PageRightFooter | "" | The right footer text. |
| PageRightHeader | "" | The right header text. |
| UsedFonts | "" | A CRLF-separated list of all the fonts used in the document. |
| Watermark | "" | The watermark text to be displayed. |
| WatermarkFont | Times New Roman | The font name for the watermark text. |
| WatermarkFontColor | #BFBFBF | The font color for the watermark text. |
| WatermarkFontSize | "" | The font size for the watermark text. If empty, the watermark is automatically adjusted to fit the page. |
| WatermarkFontStyle | "" | The font style for the watermark text. |
| WatermarkStyle | diagonal | The style and placement of the watermark. Supported values: diagonal, horizontal, vertical, scattered, brickwork. The style can also include a direction separated by a space: NE/northeast, SE/southeast, NW/northwest, SW/southwest, N/north, S/south, E/east, W/west. |
| Xmp | "" | The XML body of the XMP metadata embedded in the document. |
| Xmp[property] | "" | The value of an XMP metadata property. |
| XmpStream | "" | The hex-encoded content of the XMP metadata stream. |
Example:
string description = pdfgen.GetDocumentProperty("Xmp[dc:description]");
string metadataXml = pdfgen.GetDocumentProperty("Xmp");
// Use language descriptors for multi-language properties
string descriptionEs = pdfgen.GetDocumentProperty("Xmp[dc:description[es]]");
get_field_property method (PDFGen Struct)
Returns the value of a field property.
Syntax
fn get_field_property(&self, field_name : &str, field_property : &str) -> Result<String, PDFSDKError>
Remarks
This method is used to obtain the value of a field property. Together with set_field_property, this method provides an extensible way of managing the field settings that are not available through other means. The list of settings below may be extended in the future.
field_name is the name of the field of interest, and field_property specifies the field property to read. Possible values are:
| Field property | Default value | Description |
| AnnotationFlags | 0 | The field annotation flags. |
| AnnotationHidden | False | Whether the field annotation is completely invisible, meaning it cannot be displayed, printed, or interacted with. |
| AnnotationInvisible | False | Whether the field annotation is invisible on the screen and in print, but still remains interactive. |
| AnnotationLocked | False | Whether the user cannot modify the field annotation's properties, such as its position and size. |
| AnnotationLockedContents | False | Whether the user cannot modify the field annotation's contents. |
| AnnotationNoRotate | False | Whether the field annotation's orientation remains fixed regardless of the page rotation. |
| AnnotationNoView | False | Whether the field annotation is invisible on the screen and cannot be interacted with, but still appears when printed. |
| AnnotationNoZoom | False | Whether the field annotation's size remains fixed regardless of the page magnification level. |
| AnnotationPrint | False | Whether the field annotation appears when the page is printed. |
| AnnotationReadOnly | False | Whether the user cannot interact with or modify the field annotation. |
| AnnotationToggleNoView | False | Whether the field annotation's NoView flag is intended to be toggled dynamically by a user action or script. |
| Flags | 0 | The field flags. |
| IncludeEdit | False | Whether the combo box field includes an editable text box in addition to a drop-down list. |
| MultiLine | False | Whether the text box field can contain multiple lines of text. |
| MultiSelect | False | Whether multiple options can be selected simultaneously in the combo box or list box field. |
| NoExport | False | Whether the field is not exported when the form is submitted. |
| NoToggleToOff | False | Whether exactly one radio button in the radio group must always be selected. |
| Password | False | Whether the text box field is intended to contain a password. |
| ReadOnly | False | Whether the user cannot change the field's value. |
| Required | False | Whether the field must have a value before the form can be submitted. |
| Sort | False | Whether the options are automatically sorted alphabetically in the combo box or list box field. |
| UnisonSelect | False | Whether selecting one radio button automatically selects all other radio buttons in the same group that share the same field name and value for the on state. |
get_page_property method (PDFGen Struct)
Returns the value of a page property.
Syntax
fn get_page_property(&self, page_property : &str) -> Result<String, PDFSDKError>
Remarks
This method is used to obtain the value of a page property for the current page. Together with set_page_property, this method provides an extensible way of managing the current page settings that are not available through other means. The list of settings below may be extended in the future.
page_property specifies the page property to read. Possible values are:
| Page property | Default value | Description |
| PageFooter | "" | The central footer text. |
| PageFooterFont | Times New Roman | The font name for the footer text. |
| PageFooterFontColor | #000000 | The font color for the footer text. |
| PageFooterFontSize | 12 | The font size for the footer text. |
| PageFooterFontStyle | "" | The font style for the footer text. |
| PageHeader | "" | The central header text. |
| PageHeaderFont | Times New Roman | The font name for the header text. |
| PageHeaderFontColor | #000000 | The font color for the header text. |
| PageHeaderFontSize | 12 | The font size for the header text. |
| PageHeaderFontStyle | "" | The font style for the header text. |
| PageLeftFooter | "" | The left footer text. |
| PageLeftHeader | "" | The left header text. |
| PageNumber | 1 | The page number in the header or footer. |
| PageNumberFormat | Automatic | The page number format. Supported values: Automatic, Alpha, AlphaCaps, Roman, RomanCaps, Numeric. |
| PageRightFooter | "" | The right footer text. |
| PageRightHeader | "" | The right header text. |
| Watermark | "" | The watermark text to be displayed. |
| WatermarkFont | Times New Roman | The font name for the watermark text. |
| WatermarkFontColor | #BFBFBF | The font color for the watermark text. |
| WatermarkFontSize | "" | The font size for the watermark text. If empty, the watermark is automatically adjusted to fit the page. |
| WatermarkFontStyle | "" | The font style for the watermark text. |
| WatermarkStyle | diagonal | The style and placement of the watermark. Supported values: diagonal, horizontal, vertical, scattered, brickwork. The style can also include a direction separated by a space: NE/northeast, SE/southeast, NW/northwest, SW/southwest, N/north, S/south, E/east, W/west. |
move_to method (PDFGen Struct)
Sets the current pen position on the drawing canvas.
Syntax
fn move_to(&self, x : &str, y : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to set the pen position on the current drawing canvas to the point specified by x and y, relative to the bottom-left corner of the canvas. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. If either parameter is empty, that coordinate is left unchanged.
The current pen position determines where the next element is placed on the canvas. It is used as:
- The starting point of the path opened with start_path
- The bottom-left corner of the rectangle drawn with draw_rectangle
- The center of the ellipse drawn with draw_circle
- The bottom-left corner of the inner canvas created between start_drawing and end_drawing (or start_editing and end_editing), or copied with add_copy
NOTE: This method only applies if the current canvas is a drawing canvas.
remove_attachment method (PDFGen Struct)
Removes an attachment from the document.
Syntax
fn remove_attachment(&self, index : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to remove an attachment from the document and from the Attachment* properties.
index is the index of the attachment in the Attachment* properties to be removed.
Example:
pdfgen.RemoveAttachment(0);
// Alternatively, remove an attachment from Attachments manually:
PDFAttachment attachment = pdfgen.Attachments[0];
pdfgen.Attachments.Remove(attachment);
pdfgen.Close();
reset method (PDFGen Struct)
Resets the struct.
Syntax
fn reset(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to reset the struct's properties and configuration settings to their default values.
save_style method (PDFGen Struct)
Saves the currently configured font, pen, and brush as a named style.
Syntax
fn save_style(&self, style_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to record the current font, pen, and brush settings under the Id given in style_id, allowing the same look to be reapplied later with set_style. A style captures the settings as they are currently configured, so it reflects the accumulated result of any preceding set_font, set_pen, and set_brush calls.
Style Ids are case-insensitive. This method throws an exception if a style with the same Id has already been saved or if style_id is one of the reserved built-in style names (Default, Title, H1 through H6, and P); see set_style for details.
Example:
pdfgen.SetFont("Arial", "8", "bold", "#FF0000");
pdfgen.SaveStyle("SmallRedArial");
...
pdfgen.SetStyle("SmallRedArial"); // restores the 8pt bold red Arial font
scroll method (PDFGen Struct)
Inserts a vertical gap into the text canvas.
Syntax
fn scroll(&self, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to insert an empty vertical gap of height into the current text canvas, pushing the content that follows it down by that amount. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
NOTE: This method throws an exception if the current canvas is not a text canvas.
set_alignment method (PDFGen Struct)
Sets the alignment for subsequent text insertion operations.
Syntax
fn set_alignment(&self, horizontal_alignment : i32, vertical_alignment : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to set the horizontal and vertical alignment parameters to apply to text content, including individual pieces of text and paragraphs. Alignment specifies the position of the newly added text content within the lines of a text canvas.
horizontal_alignment specifies the horizontal alignment relative to the left or right canvas boundaries. Possible values are:
| 0 (haLeft - default) | |
| 1 (haCenter) | |
| 2 (haRight) | |
| 3 (haJustify) |
vertical_alignment specifies the vertical alignment of text elements relative to each other. Possible values are:
| 0 (vaTop - default) | |
| 1 (vaCenter) | |
| 2 (vaBottom) |
NOTE: This method only applies if the current canvas is a text or table canvas.
set_brush method (PDFGen Struct)
Sets the fill properties used when drawing shapes and cell backgrounds.
Syntax
fn set_brush(&self, color : &str, opacity : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to configure the brush that is applied to the interior of all subsequently added shapes, closed paths, and table cell backgrounds.
color specifies the fill color. If non-empty, the brush is activated and the specified color is used for all subsequent filled elements. For the full list of supported colors, see set_font.
opacity specifies the fill opacity as a value between 0 (fully transparent) and 1 (fully opaque). If empty, full opacity is used. Passing a non-empty opacity alone (without a color) also activates the brush using the previously stored color.
If both color and opacity are empty, the brush is reset to its unset state, and no fill is applied to subsequent elements. This is useful when you want a shape to be stroked only, with a transparent interior.
set_document_property method (PDFGen Struct)
Sets the value of a document property.
Syntax
fn set_document_property(&self, document_property : &str, value : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to adjust properties of the document, including those that apply globally to every page from the current page onward. Together with get_document_property, this method provides an extensible way of managing the document settings that are not available through other means. The list of settings below may be extended in the future.
document_property and value specify the document property and value to set respectively. Possible values for the former are:
| Document property | Default value | Description |
| FooterFromBottom | 36 | The vertical offset of the footer from the bottom page border. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. |
| HeaderFromTop | 36 | The vertical offset of the header from the top page border. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. |
| MirrorFooters | False | Whether to automatically swap the left and right footers in double-sided documents. If enabled, the left and right footers will be mirrored on alternating pages. |
| MirrorHeaders | False | Whether to automatically swap the left and right headers in double-sided documents. If enabled, the left and right headers will be mirrored on alternating pages. |
| MirrorMargins | False | Whether to automatically swap the left and right margins in double-sided documents. If enabled, the left and right margins will be mirrored on alternating pages. |
| PageFooter | "" | The central footer text. |
| PageFooterFont | Times New Roman | The font name for the footer text. |
| PageFooterFontColor | #000000 | The font color for the footer text. |
| PageFooterFontSize | 12 | The font size for the footer text. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. |
| PageFooterFontStyle | "" | The font style for the footer text. |
| PageHeader | "" | The central header text. |
| PageHeaderFont | Times New Roman | The font name for the header text. |
| PageHeaderFontColor | #000000 | The font color for the header text. |
| PageHeaderFontSize | 12 | The font size for the header text. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. |
| PageHeaderFontStyle | "" | The font style for the header text. |
| PageLeftFooter | "" | The left footer text. |
| PageLeftHeader | "" | The left header text. |
| PageNumber | 1 | The starting page number in the header or footer. |
| PageNumberFormat | Automatic | The page number format. Supported values: Automatic, Alpha, AlphaCaps, Roman, RomanCaps, Numeric. |
| PageRightFooter | "" | The right footer text. |
| PageRightHeader | "" | The right header text. |
| Watermark | "" | The watermark text to be displayed. |
| WatermarkFont | Times New Roman | The font name for the watermark text. |
| WatermarkFontColor | #BFBFBF | The font color for the watermark text. |
| WatermarkFontSize | "" | The font size for the watermark text. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used. If empty, the watermark is automatically adjusted to fit the page. |
| WatermarkFontStyle | "" | The font style for the watermark text. |
| WatermarkStyle | diagonal | The style and placement of the watermark. Supported values: diagonal, horizontal, vertical, scattered, brickwork. The style can also include a direction separated by a space: NE/northeast, SE/southeast, NW/northwest, SW/southwest, N/north, S/south, E/east, W/west. |
| Xmp | "" | The XML body of the XMP metadata embedded in the document. |
| Xmp[property] | "" | The value of an XMP metadata property. |
| XmpStream | "" | The hex-encoded content of the XMP metadata stream. |
Example:
pdfgen.SetDocumentProperty("PageRightHeader", "PDF 32000-1:2008");
pdfgen.SetDocumentProperty("PageLeftFooter", "© Adobe Systems Incorporated 2008 - All rights reserved");
pdfgen.SetDocumentProperty("PageRightFooter", "%PAGENUMBER%");
pdfgen.SetDocumentProperty("PageNumberFormat", "Numeric");
set_field_property method (PDFGen Struct)
Sets the value of a field property.
Syntax
fn set_field_property(&self, field_name : &str, field_property : &str, value : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to modify the value of a field property. Together with get_field_property, this method provides an extensible way of managing the field settings that are not available through other means. The list of settings below may be extended in the future.
field_name is the name of the field of interest, and field_property and value specify the field property and value to set respectively. Possible values for the former are:
| Field property | Default value | Description |
| AnnotationFlags | 0 | The field annotation flags. |
| AnnotationHidden | False | Whether the field annotation is completely invisible, meaning it cannot be displayed, printed, or interacted with. |
| AnnotationInvisible | False | Whether the field annotation is invisible on the screen and in print, but still remains interactive. |
| AnnotationLocked | False | Whether the user cannot modify the field annotation's properties, such as its position and size. |
| AnnotationLockedContents | False | Whether the user cannot modify the field annotation's contents. |
| AnnotationNoRotate | False | Whether the field annotation's orientation remains fixed regardless of the page rotation. |
| AnnotationNoView | False | Whether the field annotation is invisible on the screen and cannot be interacted with, but still appears when printed. |
| AnnotationNoZoom | False | Whether the field annotation's size remains fixed regardless of the page magnification level. |
| AnnotationPrint | False | Whether the field annotation appears when the page is printed. |
| AnnotationReadOnly | False | Whether the user cannot interact with or modify the field annotation. |
| AnnotationToggleNoView | False | Whether the field annotation's NoView flag is intended to be toggled dynamically by a user action or script. |
| Flags | 0 | The field flags. |
| IncludeEdit | False | Whether the combo box field includes an editable text box in addition to a drop-down list. |
| MultiLine | False | Whether the text box field can contain multiple lines of text. |
| MultiSelect | False | Whether multiple options can be selected simultaneously in the combo box or list box field. |
| NoExport | False | Whether the field is not exported when the form is submitted. |
| NoToggleToOff | False | Whether exactly one radio button in the radio group must always be selected. |
| Password | False | Whether the text box field is intended to contain a password. |
| ReadOnly | False | Whether the user cannot change the field's value. |
| Required | False | Whether the field must have a value before the form can be submitted. |
| Sort | False | Whether the options are automatically sorted alphabetically in the combo box or list box field. |
| UnisonSelect | False | Whether selecting one radio button automatically selects all other radio buttons in the same group that share the same field name and value for the on state. |
set_font method (PDFGen Struct)
Sets the font properties to be applied to text.
Syntax
fn set_font(&self, name : &str, size : &str, style : &str, color : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to define the font attributes for text.
name specifies the font name. Full font names (e.g., Times New Roman, Arial Bold Italic), filenames (e.g., times.ttf, arialbi.ttf), and full file paths are all supported.
The list of system TrueType font names that are supported by the struct can be obtained from SystemFontNames.
Use FontPaths to specify font search paths when passing a TrueType font without a full file path. Alternatively, pass the full path of the TrueType font file to name.
size specifies the font size, either as an absolute value (e.g., 12) or relative adjustment (e.g., +2). Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
style specifies the font style. The following syntax is supported:
[B][I][U][S][bold][italic][underline][strikethrough][##%][##%,##%][0.###][0.###]
For example:
- bold
- bold 50%
- bold italic 50%
- BI 50% 42%
- B 50% italic 0.42
color specifies the font color in hash-prefixed hexadecimal format (such as #FF0000 for red). The following HTML color aliases are also supported:
| aliceblue | antiquewhite | aqua | aquamarine |
| azure | beige | bisque | black |
| blanchedalmond | blue | blueviolet | brown |
| burlywood | cadetblue | chartreuse | chocolate |
| coral | cornflowerblue | cornsilk | crimson |
| cyan | darkblue | darkcyan | darkgoldenrod |
| darkgray | darkgrey | darkgreen | darkkhaki |
| darkmagenta | darkolivegreen | darkorange | darkorchid |
| darkred | darksalmon | darkseagreen | darkslateblue |
| darkslategray | darkslategrey | darkturquoise | darkviolet |
| deeppink | deepskyblue | dimgray | dimgrey |
| dodgerblue | firebrick | floralwhite | forestgreen |
| fuchsia | gainsboro | ghostwhite | gold |
| goldenrod | gray | grey | green |
| greenyellow | honeydew | hotpink | indianred |
| indigo | ivory | khaki | lavender |
| lavenderblush | lawngreen | lemonchiffon | lightblue |
| lightcoral | lightcyan | lightgoldenrodyellow | lightgray |
| lightgrey | lightgreen | lightpink | lightsalmon |
| lightseagreen | lightskyblue | lightslategray | lightslategrey |
| lightsteelblue | lightyellow | lime | limegreen |
| linen | magenta | maroon | mediumaquamarine |
| mediumblue | mediumorchid | mediumpurple | mediumseagreen |
| mediumslateblue | mediumspringgreen | mediumturquoise | mediumvioletred |
| midnightblue | mintcream | mistyrose | moccasin |
| navajowhite | navy | oldlace | olive |
| olivedrab | orange | orangered | orchid |
| palegoldenrod | palegreen | paleturquoise | palevioletred |
| papayawhip | peachpuff | peru | pink |
| plum | powderblue | purple | rebeccapurple |
| red | rosybrown | royalblue | saddlebrown |
| salmon | sandybrown | seagreen | seashell |
| sienna | silver | skyblue | slateblue |
| slategray | slategrey | snow | springgreen |
| steelblue | tan | teal | thistle |
| tomato | turquoise | violet | wheat |
| white | whitesmoke | yellow | yellowgreen |
set_layout method (PDFGen Struct)
Sets the layout for new pages.
Syntax
fn set_layout(&self, size : &str, col_count : i32, content_anchor : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to set the layout parameters for new pages to be added.
size specifies the page size as an explicit dimension pair (e.g., 400 400 or 400, 400) in which the first value defines the width and the second defines the height. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
The following named sizes are also supported:
| Letter | 8.5 by 11 inches, equivalent to 612 792. |
| A4 | 210 by 297 millimeters, equivalent to 595 842. |
| A5 | 148 by 210 millimeters, equivalent to 420 595. |
col_count specifies the number of columns the page will be divided into. The only value that is currently supported is 1.
content_anchor is reserved for future use.
set_margin method (PDFGen Struct)
Sets the margin for a typical element.
Syntax
fn set_margin(&self, margin_type : i32, value : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to specify the margin to apply when adding applicable elements.
margin_type specifies the type of margin to set. Possible values are:
| 0 (mtTableCellTop) | |
| 1 (mtTableCellBottom) | |
| 2 (mtTableCellLeft) | |
| 3 (mtTableCellRight) | |
| 4 (mtTableCellAll) | |
| 5 (mtPageTop) | |
| 6 (mtPageBottom) | |
| 7 (mtPageLeft) | |
| 8 (mtPageRight) | |
| 9 (mtPageAll) | |
| 10 (mtListItem) | |
| 11 (mtParagraphIndent) | |
| 12 (mtColumnGap) | Currently unsupported. |
| 13 (mtLineSpacing) |
value specifies the value of the margin. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
set_page_property method (PDFGen Struct)
Sets the value of a page property.
Syntax
fn set_page_property(&self, page_property : &str, value : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to adjust properties of the current page, overriding the corresponding document-level properties set in set_document_property. Together with get_page_property, this method provides an extensible way of managing the current page settings that are not available through other means. The list of settings below may be extended in the future.
page_property and value specify the page property and value to set respectively. Possible values for the former are:
| Page property | Default value | Description |
| PageFooter | "" | The central footer text. |
| PageFooterFont | Times New Roman | The font name for the footer text. |
| PageFooterFontColor | #000000 | The font color for the footer text. |
| PageFooterFontSize | 12 | The font size for the footer text. |
| PageFooterFontStyle | "" | The font style for the footer text. |
| PageHeader | "" | The central header text. |
| PageHeaderFont | Times New Roman | The font name for the header text. |
| PageHeaderFontColor | #000000 | The font color for the header text. |
| PageHeaderFontSize | 12 | The font size for the header text. |
| PageHeaderFontStyle | "" | The font style for the header text. |
| PageLeftFooter | "" | The left footer text. |
| PageLeftHeader | "" | The left header text. |
| PageNumber | 1 | The page number in the header or footer. |
| PageNumberFormat | Automatic | The page number format. Supported values: Automatic, Alpha, AlphaCaps, Roman, RomanCaps, Numeric. |
| PageRightFooter | "" | The right footer text. |
| PageRightHeader | "" | The right header text. |
| Watermark | "" | The watermark text to be displayed. |
| WatermarkFont | Times New Roman | The font name for the watermark text. |
| WatermarkFontColor | #BFBFBF | The font color for the watermark text. |
| WatermarkFontSize | "" | The font size for the watermark text. If empty, the watermark is automatically adjusted to fit the page. |
| WatermarkFontStyle | "" | The font style for the watermark text. |
| WatermarkStyle | diagonal | The style and placement of the watermark. Supported values: diagonal, horizontal, vertical, scattered, brickwork. The style can also include a direction separated by a space: NE/northeast, SE/southeast, NW/northwest, SW/southwest, N/north, S/south, E/east, W/west. |
Example:
pdfgen.SetPageProperty("PageRightHeader", "PDF 32000-1:2008 (revised)");
set_pen method (PDFGen Struct)
Sets the stroke properties used when drawing lines, paths, and borders.
Syntax
fn set_pen(&self, thickness : &str, style : &str, color : &str, opacity : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to configure the pen that is applied to all subsequently added paths, shapes, and table borders.
thickness specifies the stroke width. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
style controls the dash pattern, line cap, and line join of the stroke via one or more keywords, which may appear in any order.
The following dash pattern keywords are supported:
| solid | A continuous unbroken line. This is the default when no dash pattern keyword is present. |
| dashed | A line broken into equal-length dashes, equivalent to -. |
| dotted | A line broken into short dots, equivalent to .. |
| dash-dot | An alternating dash-dot pattern, equivalent to -.. |
A custom pattern can also be specified directly as a sequence of - and . characters, allowing any combination such as --. or --.-..
The following line cap keywords are supported:
| butt cap | A flat cap ending exactly at the endpoint. |
| round cap | A semicircular cap extending beyond the endpoint by half the line width. |
| square cap | A square cap extending beyond the endpoint by half the line width. |
The following line join keywords are supported:
| miter join limit | A sharp pointed join. The optional numeric limit value immediately following the keyword sets the miter limit; when omitted, the PDF default is used. |
| round join | A rounded join. |
| bevel join | A flat beveled join. |
Example style strings:
| dashed round cap round join | A dashed line with round caps and round joins. |
| dotted butt cap miter join 4 | A dotted line with butt caps and a miter limit of 4. |
| --. square cap bevel join | A custom dash-dash-dot pattern with square caps and bevel joins. |
color specifies the stroke color. For the full list of supported colors, see set_font.
opacity specifies the stroke opacity as a value between 0 (fully transparent) and 1 (fully opaque). If empty, full opacity is used.
set_style method (PDFGen Struct)
Applies a previously saved style or one of the built-in styles.
Syntax
fn set_style(&self, style_id : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to apply the style identified by style_id, which may be either a style previously saved with save_style or one of the below built-in styles. Style Ids are case-insensitive, and this method throws an exception if no style with the given Id exists. Applying a style sets the font it recorded, together with the pen and brush if the style recorded them.
The following built-in styles are supported. They change only the size and boldness of the font, keeping the font family and color:
| Style | Font style | Font size |
| Title | bold | 2.2em |
| H1 | bold | 2em |
| H2 | bold | 1.7em |
| H3 | bold | 1.5em |
| H4 | bold | 1.3em |
| H5 | bold | 1.15em |
| H6 | bold | 1em |
| P | normal | Base font's size (in points) |
Additionally, Default resets the font, pen, and brush to their default values.
The heading sizes are relative to the base font size, which is the value most recently set with set_font, not the value most recently applied by this method. Applying a style never changes the base font.
Example:
pdfgen.SetFont("Arial", "12", "", ""); // the base font
pdfgen.SetStyle("H1");
pdfgen.AddParagraph("Chapter One"); // a large bold Arial heading (2em)
pdfgen.SetStyle("P");
pdfgen.AddParagraph("Body text..."); // back to 12pt regular Arial
pdfgen.SetStyle("Default"); // Times New Roman 12pt, default pen and brush
start_combo_box method (PDFGen Struct)
Begins a new combo box field for editing.
Syntax
fn start_combo_box(&self, field_name : &str, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a blank combo box field with name field_name.
width and height specify the width and height of the combo box. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
After calling this method, use add_list_item to add choices to the combo box. When finished, call end_combo_box to complete it.
To create a combo box all at once instead of incrementally, use add_combo_box.
On a text canvas, the element is placed in the normal flow of content. On a drawing canvas, it is placed at the current pen position as set by move_to.
NOTE: This method throws an exception if a list is currently being edited.
start_content method (PDFGen Struct)
Begins a new logical section.
Syntax
fn start_content(&self, content_type : i32, title : &str, attributes : &str) -> Result<(), PDFSDKError>
Remarks
This method is currently unsupported.
start_drawing method (PDFGen Struct)
Initiates a new drawing canvas of the given dimensions.
Syntax
fn start_drawing(&self, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a new drawing canvas with size specified by width and height. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
A drawing canvas accepts vector drawing primitives such as paths, rectangles, circles, and polygons, and can also host bitmaps and nested canvases. All coordinates used within the drawing canvas are relative to its bottom-left corner.
The current pen and brush are inherited by the drawing canvas and applied to each new path unless overridden before the path is started. Use set_pen and set_brush before calling path methods to control stroke and fill.
When finished editing the drawing canvas, call end_drawing to close it and optionally save it in the struct.
NOTE: This method throws an exception if a list is currently being edited.
start_editing method (PDFGen Struct)
Initiates a new text canvas for editing.
Syntax
fn start_editing(&self, width : &str, height : &str, content_anchor : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to create a blank text canvas with minimum and/or maximum dimensions specified by width and height. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
width and height operate the [preferred]:[min]:[max] syntax. For example:
| :100: | Minimum only. |
| :400:400 | Minimum and maximum. |
| ::612 or 612 | Maximum only. |
If the minimum is empty or 0, no minimum width is enforced.
content_anchor is reserved for future use.
When finished editing the text canvas, call end_editing to close it and optionally save it in the struct.
Upon completion of this method, information about the newly created text canvas can be accessed using the canvas property.
NOTE: This method throws an exception if a list is currently being edited.
start_form method (PDFGen Struct)
Begins a new form.
Syntax
fn start_form(&self, submit_url : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to explicitly create a form. In general, it is not necessary to call this method before adding new fields via add_button, add_check_box, add_radio_button, and similar methods, as a form is created implicitly when the document is saved.
submit_url specifies the URL to which the form data is sent when a submit-form action is executed. Use add_button to add a button that invokes this type of action when pressed.
When finished editing the form, call end_form to complete it.
NOTE: This method throws an exception if the current canvas is not a text canvas.
start_list method (PDFGen Struct)
Begins a new list for editing.
Syntax
fn start_list(&self, marker : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to create an empty list. If a list with at least one item is already being edited, a sublist is created.
marker specifies the character that will precede each item in the list. Possible values are:
| 0 (lmOrdered) | |
| 1 (lmUnordered) | |
| 2 (lmNumeric) | |
| 3 (lmAlpha) | |
| 4 (lmAlphaCaps) | |
| 5 (lmRoman) | |
| 6 (lmRomanCaps) | |
| 7 (lmCircle) | |
| 8 (lmBlackCircle) | |
| 9 (lmBlackSquare) | |
| 10 (lmDash) | |
| 11 (lmCustom) |
After calling this method, use add_list_item (or start_list_item and end_list_item) to add items to the list. When finished, call end_list to complete it and optionally save it in the struct.
NOTE: This method throws an exception if the current canvas is not a text canvas.
start_list_box method (PDFGen Struct)
Begins a new list box field for editing.
Syntax
fn start_list_box(&self, field_name : &str, width : &str, height : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a blank list box field with name field_name.
width and height specify the width and height of the list box. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
After calling this method, use add_list_item to add choices to the list box. When finished, call end_list_box to complete it.
To create a list box all at once instead of incrementally, use add_list_box.
NOTE: This method throws an exception if a list is currently being edited.
start_list_item method (PDFGen Struct)
Begins a new list item for editing.
Syntax
fn start_list_item(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to create a placeholder for a list item as a text canvas. If a list item is already being edited, it is automatically completed before the new one is started.
After calling this method, use add_text or add_paragraph to populate the list item with text content. When finished, call end_list_item to close the underlying text canvas and optionally save it in the struct.
To create a list item all at once instead of incrementally, use add_list_item.
NOTE: This method throws an exception if the current canvas is not a text canvas or if a list is not currently being edited.
start_paragraph method (PDFGen Struct)
Begins a new paragraph for editing.
Syntax
fn start_paragraph(&self) -> Result<(), PDFSDKError>
Remarks
This method is used to create an empty paragraph. Content added between this method and end_paragraph, such as text, links, and images, flows into the current canvas.
When finished editing the paragraph, call end_paragraph to complete it and optionally save it in the struct.
To create a paragraph all at once instead of incrementally, use add_paragraph.
NOTE: This method throws an exception if a list is currently being edited.
start_path method (PDFGen Struct)
Starts a new vector path on the drawing canvas.
Syntax
fn start_path(&self, drawing_mode : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to begin a new path on the current drawing canvas, starting at the current pen position as set by move_to. All coordinates on a drawing canvas are relative to its bottom-left corner.
drawing_mode specifies how the path interacts with the canvas when it is closed with end_path. Possible values are:
| 0 (dmDrawing) | The path is rendered as a filled and/or stroked shape. |
| 1 (dmClipping) | The path defines a clipping region; subsequent drawing is masked to the interior of this path. |
| 2 (dmMask) | Reserved for future use. |
The pen and brush active when this method is called determine the stroke color, stroke width, line style, and fill color for the path.
When finished with the path, call end_path to complete it and optionally save it in the struct.
NOTE: This method throws an exception if the current canvas is not a drawing canvas or if a list is currently being edited.
start_signature_field method (PDFGen Struct)
Begins a new signature field for editing.
Syntax
fn start_signature_field(&self, field_name : &str, width : &str, height : &str, drawing : bool) -> Result<(), PDFSDKError>
Remarks
This method is used to create a blank signature field with name field_name as either a text or drawing canvas.
width and height specify the width and height of the signature field. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
drawing specifies whether the signature field will be a drawing canvas.
When finished editing the signature field, call end_signature_field to close the underlying canvas and optionally save it in the struct.
To create a signature field all at once instead of incrementally, use add_signature_field.
NOTE: This method throws an exception if a list is currently being edited.
start_table method (PDFGen Struct)
Initiates a new table canvas with a fixed number of columns.
Syntax
fn start_table(&self, col_count : i32, width : &str) -> Result<(), PDFSDKError>
Remarks
This method is used to create a new table canvas with col_count columns. The table accumulates rows and cells until end_table is called, at which point the layout is resolved and the table is committed to the parent canvas.
col_count specifies the number of logical columns in the table. This value must be positive and cannot be changed after the table is started.
width specifies the width constraints of the table. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
This parameter operates the [preferred]:[min]:[max] syntax. For example:
| :100: | Minimum only. |
| :400:400 | Minimum and maximum. |
| ::612 or 612 | Maximum only. |
If the minimum is empty or 0, no minimum width is enforced. If the maximum is empty or 0, the table may expand to fit its content without an upper bound.
The current pen and brush are inherited by the table and used to draw its outer border and background. Use set_pen and set_brush before calling this method to control the table border style and fill color. Individual cells may override these settings.
After calling this method, use start_table_row to begin adding rows, and use add_table_cell or start_table_cell to populate each row with content. When finished editing the table, call end_table to close the underlying table canvas and optionally save it in the struct.
NOTE: This method throws an exception if a list is currently being edited.
start_table_cell method (PDFGen Struct)
Begins a new cell in the current table row.
Syntax
fn start_table_cell(&self, width : &str, col_span : i32, row_span : i32, borders : i32, content_anchor : i32) -> Result<(), PDFSDKError>
Remarks
This method is used to open a new cell in the current row of the table canvas. Any previously opened cell in the same row is automatically closed before the new one is started.
width specifies the cell width constraints. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
This parameter operates the [preferred]:[min]:[max] syntax. For example:
| 200 | Preferred only. |
| 200:50 | Preferred and minimum. |
| 200::400 | Preferred and maximum. |
| :50: | Minimum only. |
| ::400 | Maximum only. |
| 200:50:400 | Preferred, minimum, and maximum. |
If the preferred width is empty or 0, the width is either inherited from the corresponding cell in the previous row or determined automatically during layout. If the minimum is empty or 0, it defaults to twice the cell padding. If the maximum is empty or 0, no maximum width is enforced.
col_span specifies the number of columns the cell spans horizontally. Values that would extend the cell beyond the table boundary are clamped automatically.
row_span specifies the number of rows the cell spans vertically. Cells covered by a rowspan from a previous row are automatically skipped when advancing through the current row.
borders specifies which borders of the cell are suppressed. Its value should be provided as a bitmask of the following flags:
| 0x001 | Top border |
| 0x002 | Right border |
| 0x004 | Bottom border |
| 0x008 | Left border |
Pass 0 to show all borders.
content_anchor is reserved for future use.
The current pen and brush are applied to the cell background and borders. Use set_pen and set_brush before calling this method to style individual cells.
After calling this method, add content to the cell using add_paragraph, add_text, add_bitmap, or any other method applicable to a text canvas. When finished editing the cell, call end_table_cell to close it explicitly and optionally save it in the struct, or begin a new cell with start_table_cell to close it implicitly.
To create a table cell all at once instead of incrementally, use add_table_cell.
NOTE: This method throws an exception if the current canvas is not a table canvas.
start_table_row method (PDFGen Struct)
Begins a new row in the current table.
Syntax
fn start_table_row(&self, height : &str, is_header : bool) -> Result<(), PDFSDKError>
Remarks
This method is used to open a new row in the current table canvas. Any previously opened row is automatically closed before the new one is started.
height specifies the row height constraints. Both integer and decimal values are supported, as are the pt, cm, mm, in, em, and % units (e.g., 5cm or 50%). If no unit is provided, points are used.
This parameter operates the [preferred]:[min]:[max] syntax. For example:
| 200 | Preferred only. |
| 200:50 | Preferred and minimum. |
| 200::400 | Preferred and maximum. |
| :50: | Minimum only. |
| ::400 | Maximum only. |
| 200:50:400 | Preferred, minimum, and maximum. |
If the preferred height is empty or 0, the row height is determined automatically from the tallest cell it contains. If the minimum is empty or 0, the row may be as short as its content. If the maximum is empty or 0, no maximum height is enforced; otherwise, content that exceeds this height is clipped.
is_header specifies whether the row is a header row. This parameter is recorded for informational purposes and future use; it does not currently alter rendering behavior.
After calling this method, add cells to the row using add_table_cell or start_table_cell. When finished editing the row, call end_table_row to close it explicitly and optionally save it in the struct, or begin a new row with start_table_row to close it implicitly.
NOTE: This method throws an exception if the current canvas is not a table canvas.
on_action_required event (PDFGen Struct)
Fired when the struct encounters a conflict that it cannot resolve on its own.
Syntax
// PDFGenActionRequiredEventArgs carries the PDFGen ActionRequired event's parameters.
pub struct PDFGenActionRequiredEventArgs {
fn action(&self) -> &String
fn choice(&self) -> &String
fn set_choice(&self, value : &str)
fn set_choice_ref(&self, value : &String)
}
// PDFGenActionRequiredEvent defines the signature of the PDFGen ActionRequired event's handler function.
pub trait PDFGenActionRequiredEvent {
fn on_action_required(&self, sender : PDFGen, e : &mut PDFGenActionRequiredEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_action_required(&self) -> &'a dyn PDFGenActionRequiredEvent;
pub fn set_on_action_required(&mut self, value : &'a dyn PDFGenActionRequiredEvent);
...
}
Remarks
This event is reserved for scenarios where the struct needs input from the user to resolve an editing conflict. Currently there are no defined conflicts, so this event does not fire.
on_editing_completed event (PDFGen Struct)
Fired after a canvas has been closed.
Syntax
// PDFGenEditingCompletedEventArgs carries the PDFGen EditingCompleted event's parameters.
pub struct PDFGenEditingCompletedEventArgs {
fn canvas_type(&self) -> i32
fn canvas_id(&self) -> &String
fn width(&self) -> &String
fn height(&self) -> &String
fn x(&self) -> &String
fn y(&self) -> &String
}
// PDFGenEditingCompletedEvent defines the signature of the PDFGen EditingCompleted event's handler function.
pub trait PDFGenEditingCompletedEvent {
fn on_editing_completed(&self, sender : PDFGen, e : &mut PDFGenEditingCompletedEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_editing_completed(&self) -> &'a dyn PDFGenEditingCompletedEvent;
pub fn set_on_editing_completed(&mut self, value : &'a dyn PDFGenEditingCompletedEvent);
...
}
Remarks
This event is currently unsupported.
on_error event (PDFGen Struct)
Fired when information is available about errors during data delivery.
Syntax
// PDFGenErrorEventArgs carries the PDFGen Error event's parameters.
pub struct PDFGenErrorEventArgs {
fn error_code(&self) -> i32
fn description(&self) -> &String
}
// PDFGenErrorEvent defines the signature of the PDFGen Error event's handler function.
pub trait PDFGenErrorEvent {
fn on_error(&self, sender : PDFGen, e : &mut PDFGenErrorEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_error(&self) -> &'a dyn PDFGenErrorEvent;
pub fn set_on_error(&mut self, value : &'a dyn PDFGenErrorEvent);
...
}
Remarks
The on_error event is fired in case of exceptional conditions during message processing. Normally the struct fails with an error.
The error_code parameter contains an error code, and the description parameter contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.
on_font_lookup event (PDFGen Struct)
Fired when a required font is missing.
Syntax
// PDFGenFontLookupEventArgs carries the PDFGen FontLookup event's parameters.
pub struct PDFGenFontLookupEventArgs {
fn font_name(&self) -> &String
fn font_path(&self) -> &String
fn set_font_path(&self, value : &str)
fn set_font_path_ref(&self, value : &String)
}
// PDFGenFontLookupEvent defines the signature of the PDFGen FontLookup event's handler function.
pub trait PDFGenFontLookupEvent {
fn on_font_lookup(&self, sender : PDFGen, e : &mut PDFGenFontLookupEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_font_lookup(&self) -> &'a dyn PDFGenFontLookupEvent;
pub fn set_on_font_lookup(&mut self, value : &'a dyn PDFGenFontLookupEvent);
...
}
Remarks
This event is fired from within set_font or close to report that the font identified by font_name was not found in FontPaths. It may be used to provide substitute fonts on the fly as an extension to the FallbackFont configuration setting.
font_path specifies the absolute path to the substitute font file. If empty, the substitute font defaults to FallbackFont, which can also be adjusted within the event handler for each missing font.
Example:
component.OnFontLookup += (s, e) =>
{
if (e.FontName == "Helvetica")
{
component.Config("FallbackFont=Arial");
}
else
{
component.Config("FallbackFont=Times New Roman");
}
};
on_log event (PDFGen Struct)
Fired once for each log message.
Syntax
// PDFGenLogEventArgs carries the PDFGen Log event's parameters.
pub struct PDFGenLogEventArgs {
fn log_level(&self) -> i32
fn message(&self) -> &String
fn log_type(&self) -> &String
}
// PDFGenLogEvent defines the signature of the PDFGen Log event's handler function.
pub trait PDFGenLogEvent {
fn on_log(&self, sender : PDFGen, e : &mut PDFGenLogEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_log(&self) -> &'a dyn PDFGenLogEvent;
pub fn set_on_log(&mut self, value : &'a dyn PDFGenLogEvent);
...
}
Remarks
This event is fired once for each log message generated by the struct. The verbosity is controlled by the LogLevel configuration setting.
log_level indicates the detail level of the message. Possible values are:
| 0 (None) | No messages are logged. |
| 1 (Info - default) | Informational events such as the basics of the chain validation procedure are logged. |
| 2 (Verbose) | Detailed data such as HTTP requests are logged. |
| 3 (Debug) | Debug data including the full chain validation procedure are logged. |
message is the log message.
log_type identifies the type of log entry. Possible values are:
- CertValidator
- Font
- HTTP
- PDFInvalidSignature
- PDFRevocationInfo
- Timestamp
- TSL
on_out_of_space event (PDFGen Struct)
Fired when an element exceeds the maximum dimensions of the current text canvas.
Syntax
// PDFGenOutOfSpaceEventArgs carries the PDFGen OutOfSpace event's parameters.
pub struct PDFGenOutOfSpaceEventArgs {
fn space_kind(&self) -> i32
fn width_available(&self) -> &String
fn width_needed(&self) -> &String
fn height_available(&self) -> &String
fn height_needed(&self) -> &String
fn choice(&self) -> i32
fn set_choice(&self, value : i32)
}
// PDFGenOutOfSpaceEvent defines the signature of the PDFGen OutOfSpace event's handler function.
pub trait PDFGenOutOfSpaceEvent {
fn on_out_of_space(&self, sender : PDFGen, e : &mut PDFGenOutOfSpaceEventArgs);
}
impl <'a> PDFGen<'a> {
pub fn on_out_of_space(&self) -> &'a dyn PDFGenOutOfSpaceEvent;
pub fn set_on_out_of_space(&mut self, value : &'a dyn PDFGenOutOfSpaceEvent);
...
}
Remarks
This event is fired while the struct populates the text canvas to report that the content does not fit within the canvas boundaries. It can be fired from within:
- Any of the Add* methods (except add_attachment)
- Any of the canvas-finalizing End* methods (except end_table_cell)
- end_list
- start_list
- start_list_item
space_kind identifies the kind of space the element has exceeded as a bitmask of the following flags:
| 0x001 (skWidth) | The element is too wide to place within the canvas_max_width of the canvas. |
| 0x002 (skHeight) | Adding the element would extend the height of the canvas beyond its canvas_max_height. |
width_available and height_available report the remaining width and height of the canvas in points.
width_needed and height_needed report the width and height of the element in points.
choice specifies the decision requested of the struct. Possible values:
| 0 (oscExpand) | Automatically expand the canvas by just enough width and/or height to accommodate the element. |
| 1 (oscWrap) | Start a new page and place the element on the new page canvas. |
| 2 (oscRetry) | Retry the operation with a resized canvas. Use the canvas property to adjust the canvas_max_width and/or canvas_max_height of the canvas within the event handler. |
| 3 (oscSave) | Currently unsupported. |
| 4 (oscCancel) | Cancel the operation as if the method that directly caused the event invocation was never called. Use this option to retry a compound method, such as end_drawing, and complete the operation with different parameters (e.g., by applying a smaller scale to a bitmap that is too large). |
| 5 (oscFullCancel) | Cancel the compound operation entirely (i.e., both the End* call and its preceding Start* call). |
| 6 (oscAbort - default) | Cancel the operation and throw an exception. |
NOTE: This event may fire repeatedly if the action the struct is instructed to take does not adequately resolve the conflict.
Config Settings (PDFGen Struct)
The struct accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the struct, access to these internal properties is provided through the config method.PDFGen Config Settings
Each entry is interpreted as a directory path used during font lookup. To use a specific TrueType font file, either specify its filename and include the containing directory in this setting, or specify the full file path in set_font.
The default value is the system font search paths. These paths are platform-dependent:
| Windows | %windir%\Fonts and %LOCALAPPDATA%\Microsoft\Windows\Fonts |
| macOS and iOS | /System/Library/Fonts/, /System/Library/Fonts/Supplemental/, /Library/Fonts/, and ~/Library/Fonts/ |
| Linux | Directories listed by dir entries in /etc/fonts/fonts.conf and /usr/local/etc/fonts/fonts.conf |
| Android | /system/fonts |
On Windows, the .NET and Java editions obtain these locations through the runtime APIs or the windir, SystemRoot, and LOCALAPPDATA environment variables.
To use custom directories together with the default system locations, include both to prevent the current search path list from being replaced.
For example:
string fontPaths = component.Config("FontPaths");
fontPaths += @"\r\nC:\Fonts";
component.Config("FontPaths=" + fontPaths);
| TrueTypeOnly | Use TrueType fonts only (e.g., Times New Roman instead of Times-Roman). |
| PreferTrueType (default) | Use the TrueType version of the font if available; otherwise, use the corresponding built-in font. |
| PreferBuiltIn | Use the built-in version of the font if it exists; otherwise, use the TrueType font. |
| BuiltInOnly | Use built-in fonts only. If the desired font is only available as a TrueType font, the struct throws an exception. |
The 14 built-in (Type 1) fonts in PDF are: Times-Roman, Helvetica, Courier, Symbol, Times-Bold, Helvetica-Bold, Courier-Bold, ZapfDingbats, Times-Italic, Helvetica-Oblique, Courier-Oblique, Times-BoldItalic, Helvetica-BoldOblique, Courier-BoldOblique.
NOTE: If set to BuiltInOnly and pdfa_conformance_level is not set to paclNone, the struct throws an exception. This is because PDF/A requires the use of file-based TrueType fonts that can be embedded into the document.
| 0 (None) | No messages are logged. |
| 1 (Info - default) | Informational events such as the basics of the chain validation procedure are logged. |
| 2 (Verbose) | Detailed data such as HTTP requests are logged. |
| 3 (Debug) | Debug data including the full chain validation procedure are logged. |
| 0 | Discard all changes. |
| 1 | Save the document to output_file or output_data, even if it has not been modified. |
| 2 (default) | Save the document to output_file or output_data, but only if it has been modified. |
Base Config Settings
The following is a list of valid code page identifiers:
| Identifier | Name |
| 037 | IBM EBCDIC - U.S./Canada |
| 437 | OEM - United States |
| 500 | IBM EBCDIC - International |
| 708 | Arabic - ASMO 708 |
| 709 | Arabic - ASMO 449+, BCON V4 |
| 710 | Arabic - Transparent Arabic |
| 720 | Arabic - Transparent ASMO |
| 737 | OEM - Greek (formerly 437G) |
| 775 | OEM - Baltic |
| 850 | OEM - Multilingual Latin I |
| 852 | OEM - Latin II |
| 855 | OEM - Cyrillic (primarily Russian) |
| 857 | OEM - Turkish |
| 858 | OEM - Multilingual Latin I + Euro symbol |
| 860 | OEM - Portuguese |
| 861 | OEM - Icelandic |
| 862 | OEM - Hebrew |
| 863 | OEM - Canadian-French |
| 864 | OEM - Arabic |
| 865 | OEM - Nordic |
| 866 | OEM - Russian |
| 869 | OEM - Modern Greek |
| 870 | IBM EBCDIC - Multilingual/ROECE (Latin-2) |
| 874 | ANSI/OEM - Thai (same as 28605, ISO 8859-15) |
| 875 | IBM EBCDIC - Modern Greek |
| 932 | ANSI/OEM - Japanese, Shift-JIS |
| 936 | ANSI/OEM - Simplified Chinese (PRC, Singapore) |
| 949 | ANSI/OEM - Korean (Unified Hangul Code) |
| 950 | ANSI/OEM - Traditional Chinese (Taiwan; Hong Kong SAR, PRC) |
| 1026 | IBM EBCDIC - Turkish (Latin-5) |
| 1047 | IBM EBCDIC - Latin 1/Open System |
| 1140 | IBM EBCDIC - U.S./Canada (037 + Euro symbol) |
| 1141 | IBM EBCDIC - Germany (20273 + Euro symbol) |
| 1142 | IBM EBCDIC - Denmark/Norway (20277 + Euro symbol) |
| 1143 | IBM EBCDIC - Finland/Sweden (20278 + Euro symbol) |
| 1144 | IBM EBCDIC - Italy (20280 + Euro symbol) |
| 1145 | IBM EBCDIC - Latin America/Spain (20284 + Euro symbol) |
| 1146 | IBM EBCDIC - United Kingdom (20285 + Euro symbol) |
| 1147 | IBM EBCDIC - France (20297 + Euro symbol) |
| 1148 | IBM EBCDIC - International (500 + Euro symbol) |
| 1149 | IBM EBCDIC - Icelandic (20871 + Euro symbol) |
| 1200 | Unicode UCS-2 Little-Endian (BMP of ISO 10646) |
| 1201 | Unicode UCS-2 Big-Endian |
| 1250 | ANSI - Central European |
| 1251 | ANSI - Cyrillic |
| 1252 | ANSI - Latin I |
| 1253 | ANSI - Greek |
| 1254 | ANSI - Turkish |
| 1255 | ANSI - Hebrew |
| 1256 | ANSI - Arabic |
| 1257 | ANSI - Baltic |
| 1258 | ANSI/OEM - Vietnamese |
| 1361 | Korean (Johab) |
| 10000 | MAC - Roman |
| 10001 | MAC - Japanese |
| 10002 | MAC - Traditional Chinese (Big5) |
| 10003 | MAC - Korean |
| 10004 | MAC - Arabic |
| 10005 | MAC - Hebrew |
| 10006 | MAC - Greek I |
| 10007 | MAC - Cyrillic |
| 10008 | MAC - Simplified Chinese (GB 2312) |
| 10010 | MAC - Romania |
| 10017 | MAC - Ukraine |
| 10021 | MAC - Thai |
| 10029 | MAC - Latin II |
| 10079 | MAC - Icelandic |
| 10081 | MAC - Turkish |
| 10082 | MAC - Croatia |
| 12000 | Unicode UCS-4 Little-Endian |
| 12001 | Unicode UCS-4 Big-Endian |
| 20000 | CNS - Taiwan |
| 20001 | TCA - Taiwan |
| 20002 | Eten - Taiwan |
| 20003 | IBM5550 - Taiwan |
| 20004 | TeleText - Taiwan |
| 20005 | Wang - Taiwan |
| 20105 | IA5 IRV International Alphabet No. 5 (7-bit) |
| 20106 | IA5 German (7-bit) |
| 20107 | IA5 Swedish (7-bit) |
| 20108 | IA5 Norwegian (7-bit) |
| 20127 | US-ASCII (7-bit) |
| 20261 | T.61 |
| 20269 | ISO 6937 Non-Spacing Accent |
| 20273 | IBM EBCDIC - Germany |
| 20277 | IBM EBCDIC - Denmark/Norway |
| 20278 | IBM EBCDIC - Finland/Sweden |
| 20280 | IBM EBCDIC - Italy |
| 20284 | IBM EBCDIC - Latin America/Spain |
| 20285 | IBM EBCDIC - United Kingdom |
| 20290 | IBM EBCDIC - Japanese Katakana Extended |
| 20297 | IBM EBCDIC - France |
| 20420 | IBM EBCDIC - Arabic |
| 20423 | IBM EBCDIC - Greek |
| 20424 | IBM EBCDIC - Hebrew |
| 20833 | IBM EBCDIC - Korean Extended |
| 20838 | IBM EBCDIC - Thai |
| 20866 | Russian - KOI8-R |
| 20871 | IBM EBCDIC - Icelandic |
| 20880 | IBM EBCDIC - Cyrillic (Russian) |
| 20905 | IBM EBCDIC - Turkish |
| 20924 | IBM EBCDIC - Latin-1/Open System (1047 + Euro symbol) |
| 20932 | JIS X 0208-1990 & 0121-1990 |
| 20936 | Simplified Chinese (GB2312) |
| 21025 | IBM EBCDIC - Cyrillic (Serbian, Bulgarian) |
| 21027 | Extended Alpha Lowercase |
| 21866 | Ukrainian (KOI8-U) |
| 28591 | ISO 8859-1 Latin I |
| 28592 | ISO 8859-2 Central Europe |
| 28593 | ISO 8859-3 Latin 3 |
| 28594 | ISO 8859-4 Baltic |
| 28595 | ISO 8859-5 Cyrillic |
| 28596 | ISO 8859-6 Arabic |
| 28597 | ISO 8859-7 Greek |
| 28598 | ISO 8859-8 Hebrew |
| 28599 | ISO 8859-9 Latin 5 |
| 28605 | ISO 8859-15 Latin 9 |
| 29001 | Europa 3 |
| 38598 | ISO 8859-8 Hebrew |
| 50220 | ISO 2022 Japanese with no halfwidth Katakana |
| 50221 | ISO 2022 Japanese with halfwidth Katakana |
| 50222 | ISO 2022 Japanese JIS X 0201-1989 |
| 50225 | ISO 2022 Korean |
| 50227 | ISO 2022 Simplified Chinese |
| 50229 | ISO 2022 Traditional Chinese |
| 50930 | Japanese (Katakana) Extended |
| 50931 | US/Canada and Japanese |
| 50933 | Korean Extended and Korean |
| 50935 | Simplified Chinese Extended and Simplified Chinese |
| 50936 | Simplified Chinese |
| 50937 | US/Canada and Traditional Chinese |
| 50939 | Japanese (Latin) Extended and Japanese |
| 51932 | EUC - Japanese |
| 51936 | EUC - Simplified Chinese |
| 51949 | EUC - Korean |
| 51950 | EUC - Traditional Chinese |
| 52936 | HZ-GB2312 Simplified Chinese |
| 54936 | Windows XP: GB18030 Simplified Chinese (4 Byte) |
| 57002 | ISCII Devanagari |
| 57003 | ISCII Bengali |
| 57004 | ISCII Tamil |
| 57005 | ISCII Telugu |
| 57006 | ISCII Assamese |
| 57007 | ISCII Oriya |
| 57008 | ISCII Kannada |
| 57009 | ISCII Malayalam |
| 57010 | ISCII Gujarati |
| 57011 | ISCII Punjabi |
| 65000 | Unicode UTF-7 |
| 65001 | Unicode UTF-8 |
| Identifier | Name |
| 1 | ASCII |
| 2 | NEXTSTEP |
| 3 | JapaneseEUC |
| 4 | UTF8 |
| 5 | ISOLatin1 |
| 6 | Symbol |
| 7 | NonLossyASCII |
| 8 | ShiftJIS |
| 9 | ISOLatin2 |
| 10 | Unicode |
| 11 | WindowsCP1251 |
| 12 | WindowsCP1252 |
| 13 | WindowsCP1253 |
| 14 | WindowsCP1254 |
| 15 | WindowsCP1250 |
| 21 | ISO2022JP |
| 30 | MacOSRoman |
| 10 | UTF16String |
| 0x90000100 | UTF16BigEndian |
| 0x94000100 | UTF16LittleEndian |
| 0x8c000100 | UTF32String |
| 0x98000100 | UTF32BigEndian |
| 0x9c000100 | UTF32LittleEndian |
| 65536 | Proprietary |
- Product: The product the license is for.
- Product Key: The key the license was generated from.
- License Source: Where the license was found (e.g., RuntimeLicense, License File).
- License Type: The type of license installed (e.g., Royalty Free, Single Server).
- Last Valid Build: The last valid build number for which the license will work.
Setting this configuration setting to true tells the struct to use the internal implementation instead of using the system security libraries.
On Windows, this setting is set to false by default. On Linux/macOS, this setting is set to true by default.
To use the system security libraries for Linux, OpenSSL support must be enabled. For more information on how to enable OpenSSL, please refer to the OpenSSL Notes section.
Trappable Errors (PDFGen Struct)
PDFGen Errors
| 1401 | The current canvas does not support this operation. |
| 1402 | Cannot commit canvas that is still open. |
| 1403 | Invalid choice. |
| 1404 | Text canvas is not started. |
| 1405 | Page margins are too large for the current layout. |
| 1406 | Not enough space for the element. |
| 1407 | Field with specified name not found. |
| 1408 | Cannot save canvas containing form fields. |
| 1409 | The document already contains a form. Only one form per document is allowed. |
| 1410 | Form is not started. |
| 1411 | Form has already been closed. |
PDF Errors
| 804 | PDF decompression failed. |
| 805 | Cannot add entry to cross-reference table. |
| 806 | Unsupported field size. |
| 807 | Unsupported Encoding filter. |
| 808 | Unsupported predictor algorithm. |
| 809 | Unsupported document version. |
| 812 | Cannot read PDF file stream. |
| 813 | Cannot write to PDF file stream. |
| 814 | output_file already exists and overwrite is false. |
| 815 | Invalid parameter. |
| 817 | Bad cross-reference entry. |
| 818 | Invalid object or generation number. |
| 819 | Invalid object stream. |
| 820 | Invalid stream dictionary. |
| 821 | Invalid AcroForm entry. |
| 822 | Invalid Root entry. |
| 823 | Invalid annotation. |
| 824 | The input document is empty. |
| 826 | OpenType font error. The error description contains the detailed message. |
| 828 | Invalid CMS data. The error description contains the detailed message. |
| 835 | Cannot change decryption mode for opened document. |
| 836 | Unsupported Date string. |
| 838 | Cryptographic error. The error description contains the detailed message. |
| 840 | decryption_cert error. The error description contains the detailed message. |
| 841 | Encryption failed. The error description contains the detailed message. |
| 842 | No proper certificate for encryption found. |
| 846 | Unsupported revision. |
| 847 | Unsupported security handler SubFilter. |
| 848 | Failed to verify permissions. |
| 849 | Invalid password. |
| 850 | Invalid password information. |
| 852 | Unsupported encryption algorithm. |
| 859 | Cannot encrypt encrypted document. |
| 864 | Cannot modify document after signature update. |
| 868 | Cannot encrypt or decrypt object. |
| 869 | Invalid security handler information. |
| 870 | Invalid encrypted data. |
| 871 | Invalid block cipher padding. |
| 872 | Failed to reload signature. |
| 873 | Object is not encrypted. |
| 874 | Unexpected cipher information. |
| 877 | Invalid document. Bad document catalog. |
| 878 | Invalid document Id. |
| 880 | Invalid document. Invalid requirements dictionary. |
| 881 | Invalid linearization dictionary. |
| 882 | Invalid signature information. |
| 883 | Unsupported document format. |
| 890 | Unsupported feature. |
| 891 | Internal error. The error description contains the detailed message. |
| 892 | Unsupported color. |
| 893 | This operation is not supported for this PDF/A level. |
| 894 | Interactive features (action) are not supported by PDF/A. Set pdfa_conformance_level to paclNone or clear the action property of the field. |
| 895 | Font file not found. |
| 896 | Invalid font name. The error description contains the detailed message. |
Parsing Errors
| 1001 | Bad object. |
| 1002 | Bad document trailer. |
| 1003 | Illegal stream dictionary. |
| 1004 | Illegal string. |
| 1005 | Indirect object expected. |
| 1007 | Invalid reference. |
| 1008 | Invalid reference table. |
| 1009 | Invalid stream data. |
| 1010 | Unexpected character. |
| 1011 | Unexpected EOF. |
| 1012 | Unexpected indirect object in cross-reference table. |
| 1013 | RDF object not found. |
| 1014 | Invalid RDF object. |
| 1015 | Cannot create element with unknown prefix. |
| 1021 | Invalid type in Root object list. |