# PDFGen Component

The PDFGen component creates PDF documents from scratch.

## Syntax

```text
nsoftware.PDFSDK.PDFGen
```

## Remarks

PDFGen is a versatile document generation component that can be used to create PDF documents in a highly customizable way.

Preparing the document for editing is as easy as calling [CreateNew](#createnew-method-pdfgen-component). Before calling this method, optionally configure baseline properties that you would like to apply to the new document, such as its page dimensions ([SetLayout](#setlayout-method-pdfgen-component)), page numbering ([SetDocumentProperty](#setdocumentproperty-method-pdfgen-component)), or PDF/A compliance requirements ([EnforcePDFA](#EnforcePDFA)). Then start composing the document by adding content. When finished, call [Close](#close-method-pdfgen-component) to close the document and save the changes to either [OutputFile](#outputfile-property-pdfgen-component), [OutputData](#outputdata-property-pdfgen-component), or the stream set in [SetOutputStream](#setoutputstream-method-pdfgen-component).

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.

```csharp
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.AddTextBlock("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 [CreateNew](#createnew-method-pdfgen-component) is called, the component 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 component 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.

 An open canvas resembles an active editing area. Examples include a text canvas containing a line of text to which words are still being added, and a drawing canvas containing a path that has been started but not completed.

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 component 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 component 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 [AddSignatureField](#addsignaturefield-method-pdfgen-component), and table cells are all kinds of text canvases.

Random access is not allowed in text canvases; instead, the component 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 [Width](#PDFCanvas_f_Width) and [Height](#PDFCanvas_f_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 component 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 [MaxWidth](#PDFCanvas_f_MaxWidth), it will not fit in the new line either, so the [OutOfSpace](#outofspace-event-pdfgen-component) event fires to give your code a chance to forcefully expand the canvas or cancel the insertion of the element altogether.

Similarly, exceeding [MaxHeight](#PDFCanvas_f_MaxHeight) also causes the component to automatically wrap to the next default canvas (e.g., the next page or column) or trigger [OutOfSpace](#outofspace-event-pdfgen-component). 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 [AddDrawing](#adddrawing-method-pdfgen-component) and placing bitmaps via [AddBitmap](#addbitmap-method-pdfgen-component).

The visual appearance of each primitive is controlled by the active [Pen](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) 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 [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) 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 [EndDrawing](#enddrawing-method-pdfgen-component), 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 [EndTable](#endtable-method-pdfgen-component).

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 [StartTableRow](#starttablerow-method-pdfgen-component).

The [Pen](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) active when a cell is opened determine its border style and background fill. Individual cell borders can be suppressed via a bitmask passed to [StartTableCell](#starttablecell-method-pdfgen-component), allowing any combination of top, right, bottom, and left borders to be hidden independently.

## Property List

*The following is the full list of the properties of the component with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [Attachments](#attachments-property-pdfgen-component) | A collection of all attached files added to the document. |
| [Brush](#brush-property-pdfgen-component) | The current brush settings. |
| [Canvas](#canvas-property-pdfgen-component) | The current canvas. |
| [Font](#font-property-pdfgen-component) | The currently set font. |
| [Layout](#layout-property-pdfgen-component) | The current page layout. |
| [OutputData](#outputdata-property-pdfgen-component) | A byte array containing the PDF document after processing. |
| [OutputFile](#outputfile-property-pdfgen-component) | The path to a local file where the output is written. |
| [Overwrite](#overwrite-property-pdfgen-component) | Whether the component should overwrite files. |
| [Pen](#pen-property-pdfgen-component) | The current pen settings. |

## Method List

*The following is the full list of the methods of the component with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [AddAttachment](#addattachment-method-pdfgen-component) | Adds an attachment to the document. |
| [AddBitmap](#addbitmap-method-pdfgen-component) | Adds a bitmap image to the current canvas. |
| [AddBreak](#addbreak-method-pdfgen-component) | Adds a number of breaks to the text canvas. |
| [AddButton](#addbutton-method-pdfgen-component) | Adds a button field to the form. |
| [AddCheckBox](#addcheckbox-method-pdfgen-component) | Adds a checkbox field to the form. |
| [AddComboBox](#addcombobox-method-pdfgen-component) | Adds a combo box field to the form. |
| [AddCopy](#addcopy-method-pdfgen-component) | Adds a copy of a previously saved element to the text canvas. |
| [AddDrawing](#adddrawing-method-pdfgen-component) | Adds a vector drawing described by an SVG path string to the current canvas. |
| [AddHeading](#addheading-method-pdfgen-component) | Adds a heading to the text canvas. |
| [AddLink](#addlink-method-pdfgen-component) | Adds a hyperlink to the text canvas. |
| [AddListBox](#addlistbox-method-pdfgen-component) | Adds a list box field to the form. |
| [AddListItem](#addlistitem-method-pdfgen-component) | Adds an item to a list, combo box, or list box. |
| [AddParagraph](#addparagraph-method-pdfgen-component) | Adds a paragraph of text to the text canvas. |
| [AddRadioButton](#addradiobutton-method-pdfgen-component) | Adds a radio button to the form. |
| [AddSignatureField](#addsignaturefield-method-pdfgen-component) | Adds a signature field to the form. |
| [AddSpecial](#addspecial-method-pdfgen-component) | Adds a special element to the text canvas. |
| [AddTableCell](#addtablecell-method-pdfgen-component) | Adds a single-paragraph cell to the current table row. |
| [AddTextBlock](#addtextblock-method-pdfgen-component) | Adds a block of text to the text canvas. |
| [AddTextBox](#addtextbox-method-pdfgen-component) | Adds a text box field to the form. |
| [AddTitle](#addtitle-method-pdfgen-component) | Adds a title to the text canvas. |
| [Cancel](#cancel-method-pdfgen-component) | Cancels the current canvas. |
| [Close](#close-method-pdfgen-component) | Closes the new document. |
| [Config](#config-method-pdfgen-component) | Sets or retrieves a configuration setting. |
| [CreateNew](#createnew-method-pdfgen-component) | Creates a new PDF document. |
| [DrawCircle](#drawcircle-method-pdfgen-component) | Draws an ellipse or circle on the drawing canvas. |
| [DrawCopy](#drawcopy-method-pdfgen-component) | Draws a copy of a previously saved element onto the drawing canvas. |
| [DrawCurveTo](#drawcurveto-method-pdfgen-component) | Adds a cubic Bezier curve segment to the current path. |
| [DrawLineTo](#drawlineto-method-pdfgen-component) | Adds a straight line segment to the current path. |
| [DrawPolygon](#drawpolygon-method-pdfgen-component) | Draws a polygon on the drawing canvas. |
| [DrawRectangle](#drawrectangle-method-pdfgen-component) | Draws a rectangle on the drawing canvas. |
| [EndComboBox](#endcombobox-method-pdfgen-component) | Completes the combo box field. |
| [EndContent](#endcontent-method-pdfgen-component) | Completes the logical section. |
| [EndDrawing](#enddrawing-method-pdfgen-component) | Finalizes the drawing canvas and commits it to the parent canvas. |
| [EndEditing](#endediting-method-pdfgen-component) | Finalizes the text canvas and commits it to the parent canvas. |
| [EndForm](#endform-method-pdfgen-component) | Completes the form. |
| [EndList](#endlist-method-pdfgen-component) | Completes the list. |
| [EndListBox](#endlistbox-method-pdfgen-component) | Completes the list box field. |
| [EndListItem](#endlistitem-method-pdfgen-component) | Completes the list item. |
| [EndParagraph](#endparagraph-method-pdfgen-component) | Completes the paragraph. |
| [EndPath](#endpath-method-pdfgen-component) | Completes the current path and applies it to the drawing canvas. |
| [EndSignatureField](#endsignaturefield-method-pdfgen-component) | Completes the signature field. |
| [EndTable](#endtable-method-pdfgen-component) | Finalizes the table canvas and commits it to the parent canvas. |
| [EndTableCell](#endtablecell-method-pdfgen-component) | Completes the current table cell. |
| [EndTableRow](#endtablerow-method-pdfgen-component) | Completes the current table row. |
| [GetDocumentProperty](#getdocumentproperty-method-pdfgen-component) | Returns the value of a document property. |
| [GetFieldProperty](#getfieldproperty-method-pdfgen-component) | Returns the value of a field property. |
| [GetPageProperty](#getpageproperty-method-pdfgen-component) | Returns the value of a page property. |
| [RemoveAttachment](#removeattachment-method-pdfgen-component) | Removes an attachment from the document. |
| [Reset](#reset-method-pdfgen-component) | Resets the component. |
| [SaveStyle](#savestyle-method-pdfgen-component) | Saves the current style parameters. |
| [Scroll](#scroll-method-pdfgen-component) | Scrolls down the page by the given number of points. |
| [SetAlignment](#setalignment-method-pdfgen-component) | Sets the alignment for subsequent text insertion operations. |
| [SetBrush](#setbrush-method-pdfgen-component) | Sets the fill properties used when drawing shapes and cell backgrounds. |
| [SetDocumentProperty](#setdocumentproperty-method-pdfgen-component) | Sets the value of a document property. |
| [SetFieldProperty](#setfieldproperty-method-pdfgen-component) | Sets the value of a field property. |
| [SetFont](#setfont-method-pdfgen-component) | Sets the font properties to be applied to text. |
| [SetLayout](#setlayout-method-pdfgen-component) | Sets the layout for new pages. |
| [SetMargin](#setmargin-method-pdfgen-component) | Sets the margin for a typical element. |
| [SetOutputStream](#setoutputstream-method-pdfgen-component) | Sets the stream to write the processed document to. |
| [SetPageProperty](#setpageproperty-method-pdfgen-component) | Sets the value of a page property. |
| [SetPen](#setpen-method-pdfgen-component) | Sets the stroke properties used when drawing lines, paths, and borders. |
| [SetStyle](#setstyle-method-pdfgen-component) | Loads a previously saved style. |
| [StartComboBox](#startcombobox-method-pdfgen-component) | Begins a new combo box field for editing. |
| [StartContent](#startcontent-method-pdfgen-component) | Begins a new logical section. |
| [StartDrawing](#startdrawing-method-pdfgen-component) | Initiates a new drawing canvas of the given dimensions. |
| [StartEditing](#startediting-method-pdfgen-component) | Initiates a new text canvas for editing. |
| [StartForm](#startform-method-pdfgen-component) | Begins a new form. |
| [StartList](#startlist-method-pdfgen-component) | Begins a new list for editing. |
| [StartListBox](#startlistbox-method-pdfgen-component) | Begins a new list box field for editing. |
| [StartListItem](#startlistitem-method-pdfgen-component) | Begins a new list item for editing. |
| [StartParagraph](#startparagraph-method-pdfgen-component) | Begins a new paragraph for editing. |
| [StartPath](#startpath-method-pdfgen-component) | Starts a new vector path at the given coordinates. |
| [StartSignatureField](#startsignaturefield-method-pdfgen-component) | Begins a new signature field for editing. |
| [StartTable](#starttable-method-pdfgen-component) | Initiates a new table canvas with a fixed number of columns. |
| [StartTableCell](#starttablecell-method-pdfgen-component) | Begins a new cell in the current table row. |
| [StartTableRow](#starttablerow-method-pdfgen-component) | Begins a new row in the current table. |

## Event List

*The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [ActionRequired](#actionrequired-event-pdfgen-component) | Fired when the component encounters a conflict that it cannot resolve on its own. |
| [EditingCompleted](#editingcompleted-event-pdfgen-component) | Fired after a canvas has been closed. |
| [Error](#error-event-pdfgen-component) | Fired when information is available about errors during data delivery. |
| [Log](#log-event-pdfgen-component) | Fired once for each log message. |
| [OutOfSpace](#outofspace-event-pdfgen-component) | 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 component with short descriptions. Click on the links for further details.*

|  |  |
| --- | --- |
| [AFRelationship\[Key\]](#AFRelationship[Key]) | The value of the AFRelationship key for the attachment. |
| [AutoTurnPages](#AutoTurnPages) | Whether to change the page automatically upon exceeding the lower page boundary. |
| [CloseOutputStreamAfterProcessing](#CloseOutputStreamAfterProcessing) | Whether to close the output stream after processing. |
| [CompressStreams](#CompressStreams) | Whether to compress stream objects. |
| [EnforcePDFA](#EnforcePDFA) | Whether to enforce PDF/A compliance. |
| [FallbackFont](#FallbackFont) | The fallback font. |
| [FontPaths](#FontPaths) | The font search paths. |
| [LogLevel](#LogLevel) | The level of detail that is logged. |
| [PDFALevel](#PDFALevel) | The PDF/A conformance level to enforce. |
| [SaveChanges](#SaveChanges) | Whether to save changes made to the document. |
| [SystemFontNames](#SystemFontNames) | The system font names. |
| [TempPath](#TempPath) | The location where temporary files are stored. |
| [BuildInfo](#BuildInfo) | Information about the product's build. |
| [GUIAvailable](#GUIAvailable) | Whether or not a message loop is available for processing events. |
| [LicenseInfo](#LicenseInfo) | Information about the current license. |
| [MaskSensitiveData](#MaskSensitiveData) | Whether sensitive data is masked in log messages. |
| [UseInternalSecurityAPI](#UseInternalSecurityAPI) | Whether or not to use the system security libraries or an internal implementation. |

# Attachments Property ([PDFGen](#pdfgen-component) Component)

A collection of all attached files added to the document.

## Syntax

```text
public PDFAttachmentList Attachments { get; }
```

## Remarks

This property is used to access the details of all the attached files added to the document. Use [AddAttachment](#addattachment-method-pdfgen-component) and [RemoveAttachment](#removeattachment-method-pdfgen-component) to add and remove attachments to/from this collection respectively.

This property is not available at design time.

 Please refer to the [PDFAttachment](#pdfattachment-type) type for a complete list of fields.

# Brush Property ([PDFGen](#pdfgen-component) Component)

The current brush settings.

## Syntax

```text
public PDFBrush Brush { get; }
```

## Remarks

This property is used to access the fill configuration most recently applied via [SetBrush](#setbrush-method-pdfgen-component).

This property is read-only and not available at design time.

 Please refer to the [PDFBrush](#pdfbrush-type) type for a complete list of fields.

# Canvas Property ([PDFGen](#pdfgen-component) Component)

The current canvas.

## Syntax

```text
public PDFCanvas Canvas { get; }
```

## Remarks

This property is used to access the details of the current canvas after one of the following methods is called:

- [CreateNew](#createnew-method-pdfgen-component) (page canvas)
- [StartDrawing](#startdrawing-method-pdfgen-component) (drawing canvas)
- [StartEditing](#startediting-method-pdfgen-component) (text canvas)
- [StartSignatureField](#startsignaturefield-method-pdfgen-component) (signature field canvas)
- [StartTable](#starttable-method-pdfgen-component) (table canvas)
- [StartTableCell](#starttablecell-method-pdfgen-component) (cell canvas)

 It may be used to adjust the maximum dimensions of the canvas before calling the corresponding *End** method.

This property is read-only and not available at design time.

 Please refer to the [PDFCanvas](#pdfcanvas-type) type for a complete list of fields.

# Font Property ([PDFGen](#pdfgen-component) Component)

The currently set font.

## Syntax

```text
public PDFFont Font { get; }
```

## Remarks

This property is used to access the font details specified using [SetFont](#setfont-method-pdfgen-component).

This property is read-only and not available at design time.

 Please refer to the [PDFFont](#pdffont-type) type for a complete list of fields.

# Layout Property ([PDFGen](#pdfgen-component) Component)

The current page layout.

## Syntax

```text
public PDFPageLayout Layout { get; }
```

## Remarks

This property is used to access the current page settings specified using [SetLayout](#setlayout-method-pdfgen-component).

This property is read-only and not available at design time.

 Please refer to the [PDFPageLayout](#pdfpagelayout-type) type for a complete list of fields.

# OutputData Property ([PDFGen](#pdfgen-component) Component)

A byte array containing the PDF document after processing.

## Syntax

```text
public byte[] OutputData { get; }
```

## 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 and output stream have not been assigned via [OutputFile](#outputfile-property-pdfgen-component) and [SetOutputStream](#setoutputstream-method-pdfgen-component) respectively.

This property is read-only and not available at design time.

# OutputFile Property ([PDFGen](#pdfgen-component) Component)

The path to a local file where the output is written.

## Syntax

```text
public string OutputFile { get; set; }
```

## Default Value

""

## Remarks

This property is used to provide a path where the resulting PDF document is saved after the operation has completed.

# Overwrite Property ([PDFGen](#pdfgen-component) Component)

Whether the component should overwrite files.

## Syntax

```text
public bool Overwrite { get; set; }
```

## Default Value

False

## Remarks

This property indicates whether the component overwrites [OutputFile](#outputfile-property-pdfgen-component). If set to *false*, an error is thrown whenever [OutputFile](#outputfile-property-pdfgen-component) exists before an operation.

# Pen Property ([PDFGen](#pdfgen-component) Component)

The current pen settings.

## Syntax

```text
public PDFPen Pen { get; }
```

## Remarks

This property is used to access the stroke configuration most recently applied via [SetPen](#setpen-method-pdfgen-component).

This property is read-only and not available at design time.

 Please refer to the [PDFPen](#pdfpen-type) type for a complete list of fields.

# AddAttachment Method ([PDFGen](#pdfgen-component) Component)

Adds an attachment to the document.

## Syntax

```text
public void AddAttachment(string fileName, string description);

Async Version
public async Task AddAttachment(string fileName, string description);
public async Task AddAttachment(string fileName, string description, CancellationToken cancellationToken);
```

## Remarks

This method is used to add an attachment (embedded file) to the document and to the [Attachments](#attachments-property-pdfgen-component) collection.

*FileName* and *Description* specify the filename and description of the attachment respectively.

**Example:**

```csharp
pdfgen.AddAttachment("foo.txt", "desc");

// Alternatively, create a PDFAttachment object and add it to Attachments manually:
PDFAttachment attachment = new PDFAttachment();
attachment.FileName = "foo.txt";
// or attachment.DataB = new byte[] { ... };
// or attachment.InputStream = new FileStream(...);
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 [Attachments](#attachments-property-pdfgen-component) collection.

# AddBitmap Method ([PDFGen](#pdfgen-component) Component)

Adds a bitmap image to the current canvas.

## Syntax

```text
public void AddBitmap(string format, byte[] bytes, int bitmapWidth, int bitmapHeight, string scaleWidth, string scaleHeight);

Async Version
public async Task AddBitmap(string format, byte[] bytes, int bitmapWidth, int bitmapHeight, string scaleWidth, string scaleHeight);
public async Task AddBitmap(string format, byte[] bytes, int bitmapWidth, int bitmapHeight, string scaleWidth, string scaleHeight, CancellationToken cancellationToken);
```

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

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

*BitmapWidth* and *BitmapHeight* specify the intrinsic pixel dimensions of the image.

*ScaleWidth* and *ScaleHeight* specify the rendered dimensions of the image in points.

# AddBreak Method ([PDFGen](#pdfgen-component) Component)

Adds a number of breaks to the text canvas.

## Syntax

```text
public void AddBreak(int breakKind, int count);

Async Version
public async Task AddBreak(int breakKind, int count);
public async Task AddBreak(int breakKind, int count, CancellationToken cancellationToken);
```

## Remarks

This method is used to add *Count* breaks to the current text canvas, completing the current section(s) early.

*BreakKind* specifies the kind of break to add. Possible values are:

|  |  |
| --- | --- |
| 0 (bkLine) |  |
| 1 (bkColumn) | Currently unsupported. |
| 2 (bkPage) |  |

NOTE: This method throws an exception if the current canvas is not a text canvas.

# AddButton Method ([PDFGen](#pdfgen-component) Component)

Adds a button field to the form.

## Syntax

```text
public void AddButton(string name, string caption, string width, string height, int actionType);

Async Version
public async Task AddButton(string name, string caption, string width, string height, int actionType);
public async Task AddButton(string name, string caption, string width, string height, int actionType, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a button field with name *Name* and caption *Caption*.

*Width* and *Height* specify the width and height of the button in either points (e.g., *30pt*) or characters (e.g., *30*).

*ActionType* 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 |

# AddCheckBox Method ([PDFGen](#pdfgen-component) Component)

Adds a checkbox field to the form.

## Syntax

```text
public void AddCheckBox(string name, bool defaultValue);

Async Version
public async Task AddCheckBox(string name, bool defaultValue);
public async Task AddCheckBox(string name, bool defaultValue, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a checkbox field with name *Name*.

*DefaultValue* specifies the initial state of the checkbox (checked/unchecked).

# AddComboBox Method ([PDFGen](#pdfgen-component) Component)

Adds a combo box field to the form.

## Syntax

```text
public void AddComboBox(string name, string options, string defaultValue, string width, string height);

Async Version
public async Task AddComboBox(string name, string options, string defaultValue, string width, string height);
public async Task AddComboBox(string name, string options, string defaultValue, string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a combo box field with name *Name*.

*Options* specifies a list of choices as a multi-line string.

*DefaultValue* specifies the initial value selected in the combo box.

*Width* and *Height* specify the width and height of the combo box in either points (e.g., *30pt*) or characters (e.g., *30*).

To create a combo box incrementally instead of all at once, use [StartComboBox](#startcombobox-method-pdfgen-component) and [EndComboBox](#endcombobox-method-pdfgen-component).

# AddCopy Method ([PDFGen](#pdfgen-component) Component)

Adds a copy of a previously saved element to the text canvas.

## Syntax

```text
public void AddCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB);

Async Version
public async Task AddCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB);
public async Task AddCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# AddDrawing Method ([PDFGen](#pdfgen-component) Component)

Adds a vector drawing described by an SVG path string to the current canvas.

## Syntax

```text
public void AddDrawing(string svgPath, string scaleX, string scaleY);

Async Version
public async Task AddDrawing(string svgPath, string scaleX, string scaleY);
public async Task AddDrawing(string svgPath, string scaleX, string scaleY, CancellationToken cancellationToken);
```

## Remarks

This method is used to parse an SVG path data string and add the resulting drawing to the current canvas.

*SvgPath* is a standard SVG path data string using the commands M, L, H, V, C, S, Q, T, 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 (converted internally to cubic) |
| T / t | Smooth quadratic Bezier curve (converted internally to cubic) |
| Z / z | Close path |

 Arc commands (A / a) are not yet supported.

*ScaleX* and *ScaleY* 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 *ScaleX* and *ScaleY*.

# AddHeading Method ([PDFGen](#pdfgen-component) Component)

Adds a heading to the text canvas.

## Syntax

```text
public void AddHeading(int level, string text);

Async Version
public async Task AddHeading(int level, string text);
public async Task AddHeading(int level, string text, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# AddLink Method ([PDFGen](#pdfgen-component) Component)

Adds a hyperlink to the text canvas.

## Syntax

```text
public void AddLink(string text, string URL);

Async Version
public async Task AddLink(string text, string URL);
public async Task AddLink(string text, string URL, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# AddListBox Method ([PDFGen](#pdfgen-component) Component)

Adds a list box field to the form.

## Syntax

```text
public void AddListBox(string name, string options, string defaultValue, string width, string height);

Async Version
public async Task AddListBox(string name, string options, string defaultValue, string width, string height);
public async Task AddListBox(string name, string options, string defaultValue, string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a list box field with name *Name*.

*Options* specifies a list of choices as a multi-line string.

*DefaultValue* specifies the initial value selected in the list box.

*Width* and *Height* specify the width and height of the list box in either points (e.g., *30pt*) or characters (e.g., *30*).

To create a list box incrementally instead of all at once, use [StartListBox](#startlistbox-method-pdfgen-component) and [EndListBox](#endlistbox-method-pdfgen-component).

# AddListItem Method ([PDFGen](#pdfgen-component) Component)

Adds an item to a list, combo box, or list box.

## Syntax

```text
public void AddListItem(string text, string name);

Async Version
public async Task AddListItem(string text, string name);
public async Task AddListItem(string text, string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to add *Text* as either a list item or a choice in a combo box or list box field.

*Name* specifies the name of the item.

To create a list item incrementally instead of all at once, use [StartListItem](#startlistitem-method-pdfgen-component) and [EndListItem](#endlistitem-method-pdfgen-component).

NOTE: This method throws an exception if the current canvas is not a text canvas.

# AddParagraph Method ([PDFGen](#pdfgen-component) Component)

Adds a paragraph of text to the text canvas.

## Syntax

```text
public void AddParagraph(string text);

Async Version
public async Task AddParagraph(string text);
public async Task AddParagraph(string text, CancellationToken cancellationToken);
```

## 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 text block. When the end of a line is reached, the component inserts a line break and applies the line spacing set in [SetMargin](#setmargin-method-pdfgen-component) before continuing on to the next line of the paragraph.

Use [SetAlignment](#setalignment-method-pdfgen-component) and [SetFont](#setfont-method-pdfgen-component) to adjust the parameters of the text blocks that comprise the new paragraph, and use [SetMargin](#setmargin-method-pdfgen-component) to indent the first line of the paragraph.

To create a paragraph incrementally instead of all at once, use [StartParagraph](#startparagraph-method-pdfgen-component) and [EndParagraph](#endparagraph-method-pdfgen-component).

NOTE: This method throws an exception if the current canvas is not a text canvas.

# AddRadioButton Method ([PDFGen](#pdfgen-component) Component)

Adds a radio button to the form.

## Syntax

```text
public void AddRadioButton(string radioGroup, string name, bool isDefaultButton);

Async Version
public async Task AddRadioButton(string radioGroup, string name, bool isDefaultButton);
public async Task AddRadioButton(string radioGroup, string name, bool isDefaultButton, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a radio button field with name *Name* within the radio group *RadioGroup*.

*IsDefaultButton* specifies whether the radio button will be selected initially (i.e., whether it will be the default value of the radio group).

# AddSignatureField Method ([PDFGen](#pdfgen-component) Component)

Adds a signature field to the form.

## Syntax

```text
public void AddSignatureField(string name, string width, string height);

Async Version
public async Task AddSignatureField(string name, string width, string height);
public async Task AddSignatureField(string name, string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a signature field with name *Name* as a text canvas.

*Width* and *Height* specify the width and height of the signature field in either points (e.g., *30pt*) or characters (e.g., *30*).

To create a signature field incrementally instead of all at once, use [StartSignatureField](#startsignaturefield-method-pdfgen-component) and [EndSignatureField](#endsignaturefield-method-pdfgen-component).

# AddSpecial Method ([PDFGen](#pdfgen-component) Component)

Adds a special element to the text canvas.

## Syntax

```text
public void AddSpecial(int type, string content);

Async Version
public async Task AddSpecial(int type, string content);
public async Task AddSpecial(int type, string content, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# AddTableCell Method ([PDFGen](#pdfgen-component) Component)

Adds a single-paragraph cell to the current table row.

## Syntax

```text
public void AddTableCell(string text, string width);

Async Version
public async Task AddTableCell(string text, string width);
public async Task AddTableCell(string text, string width, CancellationToken cancellationToken);
```

## 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 [StartTableCell](#starttablecell-method-pdfgen-component) with *ColSpan* and *RowSpan* set to *1* and *Borders* set to *0*, followed by [AddParagraph](#addparagraph-method-pdfgen-component) and [EndTableCell](#endtablecell-method-pdfgen-component).

*Text* specifies the text content of the cell. If empty, an empty cell is added.

*Width* specifies the cell width constraints in points, using the same *[preferred]:[min]:[max]* syntax as the corresponding parameter in [StartTableCell](#starttablecell-method-pdfgen-component). Both integer and decimal values are supported.

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 [StartTableCell](#starttablecell-method-pdfgen-component) and [EndTableCell](#endtablecell-method-pdfgen-component) directly.

NOTE: This method throws an exception if the current canvas is not a table canvas.

# AddTextBlock Method ([PDFGen](#pdfgen-component) Component)

Adds a block of text to the text canvas.

## Syntax

```text
public void AddTextBlock(string text, bool wrappable);

Async Version
public async Task AddTextBlock(string text, bool wrappable);
public async Task AddTextBlock(string text, bool wrappable, CancellationToken cancellationToken);
```

## Remarks

This method is used to add a block of *Text* to the current line of the current text canvas. Use [SetAlignment](#setalignment-method-pdfgen-component) and [SetFont](#setfont-method-pdfgen-component) to adjust new text block parameters.

*Wrappable* is reserved for future use.

NOTE: This method only applies if the current canvas is a text canvas.

# AddTextBox Method ([PDFGen](#pdfgen-component) Component)

Adds a text box field to the form.

## Syntax

```text
public void AddTextBox(string name, string defaultValue, bool multiLine, string width, string height, bool password);

Async Version
public async Task AddTextBox(string name, string defaultValue, bool multiLine, string width, string height, bool password);
public async Task AddTextBox(string name, string defaultValue, bool multiLine, string width, string height, bool password, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a text box field with name *Name*.

*DefaultValue* specifies the initial value contained in the text box.

*MultiLine* specifies whether the text box can contain multiple lines of text.

*Width* and *Height* specify the width and height of the text box in either points (e.g., *30pt*) or characters (e.g., *30*).

*Password* specifies whether the text box is intended to contain a password. Pass *true* to have the text displayed as asterisk characters (***).

# AddTitle Method ([PDFGen](#pdfgen-component) Component)

Adds a title to the text canvas.

## Syntax

```text
public void AddTitle(string text);

Async Version
public async Task AddTitle(string text);
public async Task AddTitle(string text, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# Cancel Method ([PDFGen](#pdfgen-component) Component)

Cancels the current canvas.

## Syntax

```text
public void Cancel();

Async Version
public async Task Cancel();
public async Task Cancel(CancellationToken cancellationToken);
```

## 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 [OutOfSpace](#outofspace-event-pdfgen-component) event:

- [StartDrawing](#startdrawing-method-pdfgen-component)
- [StartEditing](#startediting-method-pdfgen-component)
- [StartSignatureField](#startsignaturefield-method-pdfgen-component)
- [StartTable](#starttable-method-pdfgen-component)
- [StartTableCell](#starttablecell-method-pdfgen-component)

 **Example:**

```csharp
pdfgen.StartEditing("100", "100", (int)ContentAnchors.caTop);
pdfgen.AddTextBlock("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](#pdfgen-component) Component)

Closes the new document.

## Syntax

```text
public void Close();

Async Version
public async Task Close();
public async Task Close(CancellationToken cancellationToken);
```

## Remarks

This method is used to close the new document. It should always be preceded by a call to [CreateNew](#createnew-method-pdfgen-component).

**Example:**

```csharp
pdfgen.OutputFile = "output.pdf";
pdfgen.CreateNew();
// Some operation
pdfgen.Close();
```

 The document is saved automatically to [OutputFile](#outputfile-property-pdfgen-component), [OutputData](#outputdata-property-pdfgen-component), or the stream set in [SetOutputStream](#setoutputstream-method-pdfgen-component) when this method is called. To configure this saving behavior, set [SaveChanges](#SaveChanges).

# Config Method ([PDFGen](#pdfgen-component) Component)

Sets or retrieves a configuration setting.

## Syntax

```text
public string Config(string configurationString);

Async Version
public async Task<string> Config(string configurationString);
public async Task<string> Config(string configurationString, CancellationToken cancellationToken);
```

## Remarks

Config is a generic method available in every component. It is used to set and retrieve [configuration settings](#config-settings-pdfgen-component) for the component.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, 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](#config-settings-pdfgen-component), you must call *Config("PROPERTY")*. The value will be returned as a string.

# CreateNew Method ([PDFGen](#pdfgen-component) Component)

Creates a new PDF document.

## Syntax

```text
public void CreateNew();

Async Version
public async Task CreateNew();
public async Task CreateNew(CancellationToken cancellationToken);
```

## Remarks

This method is used to create a blank PDF document with one empty page and an underlying page canvas. Use [SetLayout](#setlayout-method-pdfgen-component) to adjust the new page dimensions and number of columns. Having created the baseline document, use the component'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](#canvas-property-pdfgen-component) property.

# DrawCircle Method ([PDFGen](#pdfgen-component) Component)

Draws an ellipse or circle on the drawing canvas.

## Syntax

```text
public void DrawCircle(string X, string Y, string radiusX, string radiusY);

Async Version
public async Task DrawCircle(string X, string Y, string radiusX, string radiusY);
public async Task DrawCircle(string X, string Y, string radiusX, string radiusY, CancellationToken cancellationToken);
```

## Remarks

This method is used to add a closed elliptical shape centered at (*X*, *Y*) to the current drawing canvas.

*RadiusX* and *RadiusY* specify the horizontal and vertical radii of the ellipse in points. Both integer and decimal values are supported. To draw a perfect circle, pass equal values for both.

Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) 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.

# DrawCopy Method ([PDFGen](#pdfgen-component) Component)

Draws a copy of a previously saved element onto the drawing canvas.

## Syntax

```text
public void DrawCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB);

Async Version
public async Task DrawCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB);
public async Task DrawCopy(string name, string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# DrawCurveTo Method ([PDFGen](#pdfgen-component) Component)

Adds a cubic Bezier curve segment to the current path.

## Syntax

```text
public void DrawCurveTo(string X, string Y, string viaX1, string viaY1, string viaX2, string viaY2);

Async Version
public async Task DrawCurveTo(string X, string Y, string viaX1, string viaY1, string viaX2, string viaY2);
public async Task DrawCurveTo(string X, string Y, string viaX1, string viaY1, string viaX2, string viaY2, CancellationToken cancellationToken);
```

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

*ViaX1* and *ViaY1* specify the first control point, which influences the curve near its start.

*ViaX2* and *ViaY2* 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 [StartPath](#startpath-method-pdfgen-component).

# DrawLineTo Method ([PDFGen](#pdfgen-component) Component)

Adds a straight line segment to the current path.

## Syntax

```text
public void DrawLineTo(string X, string Y);

Async Version
public async Task DrawLineTo(string X, string Y);
public async Task DrawLineTo(string X, string Y, CancellationToken cancellationToken);
```

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

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 [StartPath](#startpath-method-pdfgen-component).

# DrawPolygon Method ([PDFGen](#pdfgen-component) Component)

Draws a polygon on the drawing canvas.

## Syntax

```text
public void DrawPolygon(string points);

Async Version
public async Task DrawPolygon(string points);
public async Task DrawPolygon(string points, CancellationToken cancellationToken);
```

## 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 in points and are relative to the bottom-left corner of the drawing canvas.

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](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component). Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) 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.

# DrawRectangle Method ([PDFGen](#pdfgen-component) Component)

Draws a rectangle on the drawing canvas.

## Syntax

```text
public void DrawRectangle(string X, string Y, string width, string height, string cornerRadius);

Async Version
public async Task DrawRectangle(string X, string Y, string width, string height, string cornerRadius);
public async Task DrawRectangle(string X, string Y, string width, string height, string cornerRadius, CancellationToken cancellationToken);
```

## Remarks

This method is used to add a rectangle to the current drawing canvas. The rectangle is defined by its bottom-left corner at (*X*, *Y*) and the specified *Width* and *Height*, all in points. Both integer and decimal values are supported.

*CornerRadius* 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](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component). Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) 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.

# EndComboBox Method ([PDFGen](#pdfgen-component) Component)

Completes the combo box field.

## Syntax

```text
public void EndComboBox();

Async Version
public async Task EndComboBox();
public async Task EndComboBox(CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the combo box field created in [StartComboBox](#startcombobox-method-pdfgen-component). 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.

# EndContent Method ([PDFGen](#pdfgen-component) Component)

Completes the logical section.

## Syntax

```text
public void EndContent();

Async Version
public async Task EndContent();
public async Task EndContent(CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# EndDrawing Method ([PDFGen](#pdfgen-component) Component)

Finalizes the drawing canvas and commits it to the parent canvas.

## Syntax

```text
public void EndDrawing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);

Async Version
public async Task EndDrawing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);
public async Task EndDrawing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to close the drawing canvas opened in [StartDrawing](#startdrawing-method-pdfgen-component) 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.

*X* and *Y* specify the position, in points, where the canvas will be placed relative to the bottom-left corner of its parent canvas. These parameters must be empty if the parent canvas is a text canvas; position is determined automatically in that case. If the parent canvas is a drawing canvas, *X* and *Y* default to *0* if empty.

*ScaleX* and *ScaleY* 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.

*SkewA* and *SkewB* specify the horizontal and vertical skew angles of the canvas in degrees. *SkewA* shears along the X axis and *SkewB* 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.

*Name* is reserved for future use.

NOTE: This method throws an exception if the current canvas is not a drawing canvas.

# EndEditing Method ([PDFGen](#pdfgen-component) Component)

Finalizes the text canvas and commits it to the parent canvas.

## Syntax

```text
public void EndEditing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);

Async Version
public async Task EndEditing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);
public async Task EndEditing(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to close the text canvas opened in [StartEditing](#startediting-method-pdfgen-component) and commit it to its parent canvas. Note that the text canvas can no longer be modified after it is closed.

*X* and *Y* specify the position, in points, where the canvas will be placed relative to the bottom-left corner of its parent canvas. These parameters must be empty if the parent canvas is a text canvas; position is determined automatically in that case.

*ScaleX* and *ScaleY* are reserved for future use.

*Rotation* is reserved for future use.

*SkewA* and *SkewB* are reserved for future use.

*Name* is reserved for future use.

NOTE: This method throws an exception if the current canvas is not a text canvas.

# EndForm Method ([PDFGen](#pdfgen-component) Component)

Completes the form.

## Syntax

```text
public void EndForm();

Async Version
public async Task EndForm();
public async Task EndForm(CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# EndList Method ([PDFGen](#pdfgen-component) Component)

Completes the list.

## Syntax

```text
public void EndList();

Async Version
public async Task EndList();
public async Task EndList(CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the list created in [StartList](#startlist-method-pdfgen-component). Note that the list can no longer be modified after it is completed.

NOTE: This method throws an exception if a list is not currently being edited.

# EndListBox Method ([PDFGen](#pdfgen-component) Component)

Completes the list box field.

## Syntax

```text
public void EndListBox();

Async Version
public async Task EndListBox();
public async Task EndListBox(CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the list box field created in [StartListBox](#startlistbox-method-pdfgen-component). 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.

# EndListItem Method ([PDFGen](#pdfgen-component) Component)

Completes the list item.

## Syntax

```text
public void EndListItem();

Async Version
public async Task EndListItem();
public async Task EndListItem(CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the list item created in [StartListItem](#startlistitem-method-pdfgen-component) and commit the underlying text canvas to its parent canvas. Note that the list item can no longer be modified after it is completed.

NOTE: This method throws an exception if a list is not currently being edited.

# EndParagraph Method ([PDFGen](#pdfgen-component) Component)

Completes the paragraph.

## Syntax

```text
public void EndParagraph(string name);

Async Version
public async Task EndParagraph(string name);
public async Task EndParagraph(string name, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# EndPath Method ([PDFGen](#pdfgen-component) Component)

Completes the current path and applies it to the drawing canvas.

## Syntax

```text
public void EndPath(string name, bool closePath);

Async Version
public async Task EndPath(string name, bool closePath);
public async Task EndPath(string name, bool closePath, CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the path started in [StartPath](#startpath-method-pdfgen-component) and record it as a drawing primitive on the current drawing canvas. The path is rendered according to the drawing mode specified in [StartPath](#startpath-method-pdfgen-component) when the canvas is eventually closed.

*Name* is reserved for future use.

*ClosePath* 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.

NOTE: This method throws an exception if the current canvas is not a drawing canvas.

# EndSignatureField Method ([PDFGen](#pdfgen-component) Component)

Completes the signature field.

## Syntax

```text
public void EndSignatureField(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);

Async Version
public async Task EndSignatureField(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name);
public async Task EndSignatureField(string X, string Y, string scaleX, string scaleY, string rotation, string skewA, string skewB, string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to finalize the signature field created in [StartSignatureField](#startsignaturefield-method-pdfgen-component) and commit the underlying canvas to its parent canvas. Note that the signature field canvas can no longer be modified after it is closed.

*X* and *Y* are reserved for future use.

*ScaleX* and *ScaleY* are reserved for future use.

*Rotation* is reserved for future use.

*SkewA* and *SkewB* are reserved for future use.

*Name* is reserved for future use.

NOTE: This method throws an exception if the current canvas is not a text canvas.

# EndTable Method ([PDFGen](#pdfgen-component) Component)

Finalizes the table canvas and commits it to the parent canvas.

## Syntax

```text
public void EndTable(string name);

Async Version
public async Task EndTable(string name);
public async Task EndTable(string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to close the table canvas opened in [StartTable](#starttable-method-pdfgen-component) 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.

*Name* is reserved for future use.

NOTE: This method throws an exception if the current canvas is not a table canvas.

# EndTableCell Method ([PDFGen](#pdfgen-component) Component)

Completes the current table cell.

## Syntax

```text
public void EndTableCell(string name);

Async Version
public async Task EndTableCell(string name);
public async Task EndTableCell(string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to explicitly close the cell opened in [StartTableCell](#starttablecell-method-pdfgen-component) 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.

*Name* is reserved for future use.

It is not necessary to call this method before starting the next cell via [StartTableCell](#starttablecell-method-pdfgen-component), as open cells are closed implicitly at that point.

NOTE: This method throws an exception if the current canvas is not a cell canvas.

# EndTableRow Method ([PDFGen](#pdfgen-component) Component)

Completes the current table row.

## Syntax

```text
public void EndTableRow(string name);

Async Version
public async Task EndTableRow(string name);
public async Task EndTableRow(string name, CancellationToken cancellationToken);
```

## Remarks

This method is used to explicitly close the row opened in [StartTableRow](#starttablerow-method-pdfgen-component). 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.

*Name* is reserved for future use.

It is not necessary to call this method before starting the next row via [StartTableRow](#starttablerow-method-pdfgen-component), as open rows are closed implicitly at that point.

NOTE: This method throws an exception if the current canvas is not a table canvas.

# GetDocumentProperty Method ([PDFGen](#pdfgen-component) Component)

Returns the value of a document property.

## Syntax

```text
public string GetDocumentProperty(string documentProperty);

Async Version
public async Task<string> GetDocumentProperty(string documentProperty);
public async Task<string> GetDocumentProperty(string documentProperty, CancellationToken cancellationToken);
```

## Remarks

This method is used to obtain the value of a document property. Together with [SetDocumentProperty](#setdocumentproperty-method-pdfgen-component), 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.

*DocumentProperty* 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. |
| 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:**

```csharp
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]]");
```

# GetFieldProperty Method ([PDFGen](#pdfgen-component) Component)

Returns the value of a field property.

## Syntax

```text
public string GetFieldProperty(string fieldName, string fieldProperty);

Async Version
public async Task<string> GetFieldProperty(string fieldName, string fieldProperty);
public async Task<string> GetFieldProperty(string fieldName, string fieldProperty, CancellationToken cancellationToken);
```

## Remarks

This method is used to obtain the value of a field property. Together with [SetFieldProperty](#setfieldproperty-method-pdfgen-component), 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.

*FieldName* is the name of the field of interest, and *FieldProperty* 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. |

# GetPageProperty Method ([PDFGen](#pdfgen-component) Component)

Returns the value of a page property.

## Syntax

```text
public string GetPageProperty(string pageProperty);

Async Version
public async Task<string> GetPageProperty(string pageProperty);
public async Task<string> GetPageProperty(string pageProperty, CancellationToken cancellationToken);
```

## Remarks

This method is used to obtain the value of a page property for the current page. Together with [SetPageProperty](#setpageproperty-method-pdfgen-component), 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.

*PageProperty* 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. |

# RemoveAttachment Method ([PDFGen](#pdfgen-component) Component)

Removes an attachment from the document.

## Syntax

```text
public void RemoveAttachment(int index);

Async Version
public async Task RemoveAttachment(int index);
public async Task RemoveAttachment(int index, CancellationToken cancellationToken);
```

## Remarks

This method is used to remove an attachment from the document and from the [Attachments](#attachments-property-pdfgen-component) collection.

*Index* is the index of the attachment in the [Attachments](#attachments-property-pdfgen-component) collection to be removed.

**Example:**

```csharp
pdfgen.RemoveAttachment(0);

// Alternatively, remove an attachment from Attachments manually:
PDFAttachment attachment = pdfgen.Attachments[0];
pdfgen.Attachments.Remove(attachment);
pdfgen.Close();
```

# Reset Method ([PDFGen](#pdfgen-component) Component)

Resets the component.

## Syntax

```text
public void Reset();

Async Version
public async Task Reset();
public async Task Reset(CancellationToken cancellationToken);
```

## Remarks

This method is used to reset the component's properties and configuration settings to their default values.

# SaveStyle Method ([PDFGen](#pdfgen-component) Component)

Saves the current style parameters.

## Syntax

```text
public void SaveStyle(string name);

Async Version
public async Task SaveStyle(string name);
public async Task SaveStyle(string name, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# Scroll Method ([PDFGen](#pdfgen-component) Component)

Scrolls down the page by the given number of points.

## Syntax

```text
public void Scroll(string height);

Async Version
public async Task Scroll(string height);
public async Task Scroll(string height, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# SetAlignment Method ([PDFGen](#pdfgen-component) Component)

Sets the alignment for subsequent text insertion operations.

## Syntax

```text
public void SetAlignment(int horizontalAlignment, int verticalAlignment);

Async Version
public async Task SetAlignment(int horizontalAlignment, int verticalAlignment);
public async Task SetAlignment(int horizontalAlignment, int verticalAlignment, CancellationToken cancellationToken);
```

## Remarks

This method is used to set the horizontal and vertical alignment parameters to apply to text content, including individual text blocks and paragraphs. Alignment specifies the position of the newly added text content within the lines of a text canvas.

*HorizontalAlignment* specifies the horizontal alignment relative to the left or right canvas boundaries. Possible values are:

|  |  |
| --- | --- |
| 0 (haLeft - default) |  |
| 1 (haCenter) |  |
| 2 (haRight) |  |

*VerticalAlignment* specifies the vertical alignment of text blocks 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.

# SetBrush Method ([PDFGen](#pdfgen-component) Component)

Sets the fill properties used when drawing shapes and cell backgrounds.

## Syntax

```text
public void SetBrush(string color, string opacity);

Async Version
public async Task SetBrush(string color, string opacity);
public async Task SetBrush(string color, string opacity, CancellationToken cancellationToken);
```

## 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 [SetFont](#setfont-method-pdfgen-component).

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

# SetDocumentProperty Method ([PDFGen](#pdfgen-component) Component)

Sets the value of a document property.

## Syntax

```text
public void SetDocumentProperty(string documentProperty, string value);

Async Version
public async Task SetDocumentProperty(string documentProperty, string value);
public async Task SetDocumentProperty(string documentProperty, string value, CancellationToken cancellationToken);
```

## 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 [GetDocumentProperty](#getdocumentproperty-method-pdfgen-component), 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.

*DocumentProperty* 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 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. |
| 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:**

```csharp
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");
```

# SetFieldProperty Method ([PDFGen](#pdfgen-component) Component)

Sets the value of a field property.

## Syntax

```text
public void SetFieldProperty(string fieldName, string fieldProperty, string value);

Async Version
public async Task SetFieldProperty(string fieldName, string fieldProperty, string value);
public async Task SetFieldProperty(string fieldName, string fieldProperty, string value, CancellationToken cancellationToken);
```

## Remarks

This method is used to modify the value of a field property. Together with [GetFieldProperty](#getfieldproperty-method-pdfgen-component), 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.

*FieldName* is the name of the field of interest, and *FieldProperty* 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. |

# SetFont Method ([PDFGen](#pdfgen-component) Component)

Sets the font properties to be applied to text.

## Syntax

```text
public void SetFont(string name, string size, string style, string color);

Async Version
public async Task SetFont(string name, string size, string style, string color);
public async Task SetFont(string name, string size, string style, string color, CancellationToken cancellationToken);
```

## Remarks

This method is used to define the font attributes for text.

*Name* specifies the font name.

*Size* specifies the font size, either as an absolute value (e.g., *12*) or relative adjustment (e.g., *+2*).

*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*

 If only one transparency figure is provided, it applies to both pen and brush.

*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 |

# SetLayout Method ([PDFGen](#pdfgen-component) Component)

Sets the layout for new pages.

## Syntax

```text
public void SetLayout(string size, int columns, int contentAnchor);

Async Version
public async Task SetLayout(string size, int columns, int contentAnchor);
public async Task SetLayout(string size, int columns, int contentAnchor, CancellationToken cancellationToken);
```

## Remarks

This method is used to set the layout parameters for new pages to be added.

*Size* specifies the page size, either 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 (in points), or one of the following named sizes:

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

*Columns* specifies the number of columns the page will be divided into. The only value that is currently supported is *1*.

*ContentAnchor* is reserved for future use.

# SetMargin Method ([PDFGen](#pdfgen-component) Component)

Sets the margin for a typical element.

## Syntax

```text
public void SetMargin(int marginType, string value);

Async Version
public async Task SetMargin(int marginType, string value);
public async Task SetMargin(int marginType, string value, CancellationToken cancellationToken);
```

## Remarks

This method is used to specify the margin to apply when adding applicable elements.

*MarginType* 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 in points. Both integer and decimal values are supported.

# SetOutputStream Method ([PDFGen](#pdfgen-component) Component)

Sets the stream to write the processed document to.

## Syntax

```text
public void SetOutputStream(System.IO.Stream outputStream);

Async Version
public async Task SetOutputStream(System.IO.Stream outputStream);
public async Task SetOutputStream(System.IO.Stream outputStream, CancellationToken cancellationToken);
```

## Remarks

This method is used to set the stream to which the component writes the resulting PDF document. If an output stream is set before the component attempts to perform operations on the document, the component writes the data to the output stream instead of writing to [OutputFile](#outputfile-property-pdfgen-component) or populating [OutputData](#outputdata-property-pdfgen-component).

NOTE: It may be useful to additionally set [CloseOutputStreamAfterProcessing](#CloseOutputStreamAfterProcessing) to *true* when using output streams.

# SetPageProperty Method ([PDFGen](#pdfgen-component) Component)

Sets the value of a page property.

## Syntax

```text
public void SetPageProperty(string pageProperty, string value);

Async Version
public async Task SetPageProperty(string pageProperty, string value);
public async Task SetPageProperty(string pageProperty, string value, CancellationToken cancellationToken);
```

## Remarks

This method is used to adjust properties of the current page, overriding the corresponding document-level properties set in [SetDocumentProperty](#setdocumentproperty-method-pdfgen-component). Together with [GetPageProperty](#getpageproperty-method-pdfgen-component), 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.

*PageProperty* 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. |

**Example:**

```csharp
pdfgen.SetPageProperty("PageRightHeader", "PDF 32000-1:2008 (revised)");
```

# SetPen Method ([PDFGen](#pdfgen-component) Component)

Sets the stroke properties used when drawing lines, paths, and borders.

## Syntax

```text
public void SetPen(string thickness, string style, string color, string opacity);

Async Version
public async Task SetPen(string thickness, string style, string color, string opacity);
public async Task SetPen(string thickness, string style, string color, string opacity, CancellationToken cancellationToken);
```

## 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 in points. Both integer and decimal values are supported.

*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 [SetFont](#setfont-method-pdfgen-component).

*Opacity* specifies the stroke opacity as a value between *0* (fully transparent) and *1* (fully opaque). If empty, full opacity is used.

# SetStyle Method ([PDFGen](#pdfgen-component) Component)

Loads a previously saved style.

## Syntax

```text
public void SetStyle(string name);

Async Version
public async Task SetStyle(string name);
public async Task SetStyle(string name, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# StartComboBox Method ([PDFGen](#pdfgen-component) Component)

Begins a new combo box field for editing.

## Syntax

```text
public void StartComboBox(string name, string width, string height);

Async Version
public async Task StartComboBox(string name, string width, string height);
public async Task StartComboBox(string name, string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a blank combo box field with name *Name*.

*Width* and *Height* specify the width and height of the combo box in either points (e.g., *30pt*) or characters (e.g., *30*).

After calling this method, use [AddListItem](#addlistitem-method-pdfgen-component) to add choices to the combo box. When finished, call [EndComboBox](#endcombobox-method-pdfgen-component) to complete it.

To create a combo box all at once instead of incrementally, use [AddComboBox](#addcombobox-method-pdfgen-component).

# StartContent Method ([PDFGen](#pdfgen-component) Component)

Begins a new logical section.

## Syntax

```text
public void StartContent(int contentType, string name);

Async Version
public async Task StartContent(int contentType, string name);
public async Task StartContent(int contentType, string name, CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# StartDrawing Method ([PDFGen](#pdfgen-component) Component)

Initiates a new drawing canvas of the given dimensions.

## Syntax

```text
public void StartDrawing(string width, string height);

Async Version
public async Task StartDrawing(string width, string height);
public async Task StartDrawing(string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a new drawing canvas with size specified by *Width* and *Height* (in points). Both integer and decimal values are supported.

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](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) are inherited by the drawing canvas and applied to each new path unless overridden before the path is started. Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) before calling path methods to control stroke and fill.

When finished editing the drawing canvas, call [EndDrawing](#enddrawing-method-pdfgen-component) to close it and optionally save it in the component.

NOTE: This method throws an exception if a list is currently being edited.

# StartEditing Method ([PDFGen](#pdfgen-component) Component)

Initiates a new text canvas for editing.

## Syntax

```text
public void StartEditing(string width, string height, int contentAnchor);

Async Version
public async Task StartEditing(string width, string height, int contentAnchor);
public async Task StartEditing(string width, string height, int contentAnchor, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a blank text canvas with minimum and/or maximum dimensions specified by *Width* and *Height* (in points). Both integer and decimal values are supported.

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

*ContentAnchor* is reserved for future use.

When finished editing the text canvas, call [EndEditing](#endediting-method-pdfgen-component) to close it and optionally save it in the component.

Upon completion of this method, information about the newly created text canvas can be accessed using the [Canvas](#canvas-property-pdfgen-component) property.

# StartForm Method ([PDFGen](#pdfgen-component) Component)

Begins a new form.

## Syntax

```text
public void StartForm(string submitURL);

Async Version
public async Task StartForm(string submitURL);
public async Task StartForm(string submitURL, CancellationToken cancellationToken);
```

## 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 [AddButton](#addbutton-method-pdfgen-component), [AddCheckBox](#addcheckbox-method-pdfgen-component), [AddRadioButton](#addradiobutton-method-pdfgen-component), and similar methods, as a form is created implicitly when the document is saved.

*SubmitURL* specifies the URL to which the form data is sent when a submit-form action is executed. Use [AddButton](#addbutton-method-pdfgen-component) to add a button that invokes this type of action when pressed.

When finished editing the form, call [EndForm](#endform-method-pdfgen-component) to complete it.

NOTE: This method throws an exception if the current canvas is not a text canvas.

# StartList Method ([PDFGen](#pdfgen-component) Component)

Begins a new list for editing.

## Syntax

```text
public void StartList(int marker);

Async Version
public async Task StartList(int marker);
public async Task StartList(int marker, CancellationToken cancellationToken);
```

## 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 [AddListItem](#addlistitem-method-pdfgen-component) (or [StartListItem](#startlistitem-method-pdfgen-component) and [EndListItem](#endlistitem-method-pdfgen-component)) to add items to the list. When finished, call [EndList](#endlist-method-pdfgen-component) to complete it.

NOTE: This method throws an exception if the current canvas is not a text canvas.

# StartListBox Method ([PDFGen](#pdfgen-component) Component)

Begins a new list box field for editing.

## Syntax

```text
public void StartListBox(string name, string width, string height);

Async Version
public async Task StartListBox(string name, string width, string height);
public async Task StartListBox(string name, string width, string height, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a blank list box field with name *Name*.

*Width* and *Height* specify the width and height of the list box in either points (e.g., *30pt*) or characters (e.g., *30*).

After calling this method, use [AddListItem](#addlistitem-method-pdfgen-component) to add choices to the list box. When finished, call [EndListBox](#endlistbox-method-pdfgen-component) to complete it.

To create a list box all at once instead of incrementally, use [AddListBox](#addlistbox-method-pdfgen-component).

# StartListItem Method ([PDFGen](#pdfgen-component) Component)

Begins a new list item for editing.

## Syntax

```text
public void StartListItem(string name);

Async Version
public async Task StartListItem(string name);
public async Task StartListItem(string name, CancellationToken cancellationToken);
```

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

*Name* is reserved for future use.

After calling this method, use [AddTextBlock](#addtextblock-method-pdfgen-component) or [AddParagraph](#addparagraph-method-pdfgen-component) to populate the list item with text content. When finished, call [EndListItem](#endlistitem-method-pdfgen-component) to complete it.

To create a list item all at once instead of incrementally, use [AddListItem](#addlistitem-method-pdfgen-component).

NOTE: This method throws an exception if the current canvas is not a text canvas or if a list is not currently being edited.

# StartParagraph Method ([PDFGen](#pdfgen-component) Component)

Begins a new paragraph for editing.

## Syntax

```text
public void StartParagraph();

Async Version
public async Task StartParagraph();
public async Task StartParagraph(CancellationToken cancellationToken);
```

## Remarks

This method is currently unsupported.

# StartPath Method ([PDFGen](#pdfgen-component) Component)

Starts a new vector path at the given coordinates.

## Syntax

```text
public void StartPath(string X, string Y, int drawingMode);

Async Version
public async Task StartPath(string X, string Y, int drawingMode);
public async Task StartPath(string X, string Y, int drawingMode, CancellationToken cancellationToken);
```

## Remarks

This method is used to begin a new path on the current drawing canvas starting at the point specified by *X* and *Y*. Both integer and decimal values are supported. All coordinates are relative to the bottom-left corner of the drawing canvas.

*DrawingMode* specifies how the path interacts with the canvas when it is closed with [EndPath](#endpath-method-pdfgen-component). 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](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) 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 [EndPath](#endpath-method-pdfgen-component) to complete it and optionally save it in the component.

NOTE: This method throws an exception if the current canvas is not a drawing canvas or if a list is currently being edited.

# StartSignatureField Method ([PDFGen](#pdfgen-component) Component)

Begins a new signature field for editing.

## Syntax

```text
public void StartSignatureField(string name, string width, string height, bool drawing);

Async Version
public async Task StartSignatureField(string name, string width, string height, bool drawing);
public async Task StartSignatureField(string name, string width, string height, bool drawing, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a blank signature field with name *Name* as either a text or drawing canvas.

*Width* and *Height* specify the width and height of the signature field in either points (e.g., *30pt*) or characters (e.g., *30*).

*Drawing* specifies whether the signature field will be a drawing canvas.

When finished editing the signature field, call [EndSignatureField](#endsignaturefield-method-pdfgen-component) to close the underlying canvas and optionally save it in the component.

To create a signature field all at once instead of incrementally, use [AddSignatureField](#addsignaturefield-method-pdfgen-component).

# StartTable Method ([PDFGen](#pdfgen-component) Component)

Initiates a new table canvas with a fixed number of columns.

## Syntax

```text
public void StartTable(int colCount, string width);

Async Version
public async Task StartTable(int colCount, string width);
public async Task StartTable(int colCount, string width, CancellationToken cancellationToken);
```

## Remarks

This method is used to create a new table canvas with *ColCount* columns. The table accumulates rows and cells until [EndTable](#endtable-method-pdfgen-component) is called, at which point the layout is resolved and the table is committed to the parent canvas.

*ColCount* 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 in points, using the *[preferred]:[min]:[max]* syntax. Both integer and decimal values are supported. 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](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) are inherited by the table and used to draw its outer border and background. Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) before calling this method to control the table border style and fill color. Individual cells may override these settings.

After calling this method, use [StartTableRow](#starttablerow-method-pdfgen-component) to begin adding rows, and use [AddTableCell](#addtablecell-method-pdfgen-component) or [StartTableCell](#starttablecell-method-pdfgen-component) to populate each row with content. When finished editing the table, call [EndTable](#endtable-method-pdfgen-component) to close the underlying table canvas and optionally save it in the component.

NOTE: This method throws an exception if a list is currently being edited.

# StartTableCell Method ([PDFGen](#pdfgen-component) Component)

Begins a new cell in the current table row.

## Syntax

```text
public void StartTableCell(string width, int colSpan, int rowSpan, int borders, int contentAnchor);

Async Version
public async Task StartTableCell(string width, int colSpan, int rowSpan, int borders, int contentAnchor);
public async Task StartTableCell(string width, int colSpan, int rowSpan, int borders, int contentAnchor, CancellationToken cancellationToken);
```

## 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 in points, using the *[preferred]:[min]:[max]* syntax. Both integer and decimal values are supported. 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.

*ColSpan* specifies the number of columns the cell spans horizontally. Values that would extend the cell beyond the table boundary are clamped automatically.

*RowSpan* 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.

*ContentAnchor* is reserved for future use.

The current [Pen](#pen-property-pdfgen-component) and [Brush](#brush-property-pdfgen-component) are applied to the cell background and borders. Use [SetPen](#setpen-method-pdfgen-component) and [SetBrush](#setbrush-method-pdfgen-component) before calling this method to style individual cells.

After calling this method, add content to the cell using [AddParagraph](#addparagraph-method-pdfgen-component), [AddTextBlock](#addtextblock-method-pdfgen-component), [AddBitmap](#addbitmap-method-pdfgen-component), or any other method applicable to a text canvas. When finished editing the cell, call [EndTableCell](#endtablecell-method-pdfgen-component) to close it explicitly and optionally save it in the component, or begin a new cell with StartTableCell to close it implicitly.

To create a table cell all at once instead of incrementally, use [AddTableCell](#addtablecell-method-pdfgen-component).

NOTE: This method throws an exception if the current canvas is not a table canvas.

# StartTableRow Method ([PDFGen](#pdfgen-component) Component)

Begins a new row in the current table.

## Syntax

```text
public void StartTableRow(string height, bool isHeader);

Async Version
public async Task StartTableRow(string height, bool isHeader);
public async Task StartTableRow(string height, bool isHeader, CancellationToken cancellationToken);
```

## 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 in points, using the *[preferred]:[min]:[max]* syntax. Both integer and decimal values are supported. 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 will be clipped.

*IsHeader* 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 [AddTableCell](#addtablecell-method-pdfgen-component) or [StartTableCell](#starttablecell-method-pdfgen-component). When finished editing the row, call [EndTableRow](#endtablerow-method-pdfgen-component) to close it explicitly and optionally save it in the component, or begin a new row with StartTableRow to close it implicitly.

NOTE: This method throws an exception if the current canvas is not a table canvas.

# ActionRequired Event ([PDFGen](#pdfgen-component) Component)

Fired when the component encounters a conflict that it cannot resolve on its own.

## Syntax

```text
public event OnActionRequiredHandler OnActionRequired;

public delegate void OnActionRequiredHandler(object sender, PDFGenActionRequiredEventArgs e);

public class PDFGenActionRequiredEventArgs : EventArgs {
  public string Action { get; }
  public string Choice { get; set; }
}
```

## Remarks

This event is currently unsupported.

# EditingCompleted Event ([PDFGen](#pdfgen-component) Component)

Fired after a canvas has been closed.

## Syntax

```text
public event OnEditingCompletedHandler OnEditingCompleted;

public delegate void OnEditingCompletedHandler(object sender, PDFGenEditingCompletedEventArgs e);

public class PDFGenEditingCompletedEventArgs : EventArgs {
  public int CanvasType { get; }
  public string Width { get; }
  public string Height { get; }
  public string X { get; }
  public string Y { get; }
}
```

## Remarks

This event is currently unsupported.

# Error Event ([PDFGen](#pdfgen-component) Component)

Fired when information is available about errors during data delivery.

## Syntax

```text
public event OnErrorHandler OnError;

public delegate void OnErrorHandler(object sender, PDFGenErrorEventArgs e);

public class PDFGenErrorEventArgs : EventArgs {
  public int ErrorCode { get; }
  public string Description { get; }
}
```

## Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally the component throws an exception.

The *ErrorCode* 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](#trappable-errors-pdfgen-component) section.

# Log Event ([PDFGen](#pdfgen-component) Component)

Fired once for each log message.

## Syntax

```text
public event OnLogHandler OnLog;

public delegate void OnLogHandler(object sender, PDFGenLogEventArgs e);

public class PDFGenLogEventArgs : EventArgs {
  public int LogLevel { get; }
  public string Message { get; }
  public string LogType { get; }
}
```

## Remarks

This event is fired once for each log message generated by the component. The verbosity is controlled by the [LogLevel](#LogLevel) configuration setting.

*LogLevel* 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.

*LogType* identifies the type of log entry. Possible values are:

- CertValidator
- Font
- HTTP
- PDFInvalidSignature
- PDFRevocationInfo
- Timestamp
- TSL

# OutOfSpace Event ([PDFGen](#pdfgen-component) Component)

Fired when an element exceeds the maximum dimensions of the current text canvas.

## Syntax

```text
public event OnOutOfSpaceHandler OnOutOfSpace;

public delegate void OnOutOfSpaceHandler(object sender, PDFGenOutOfSpaceEventArgs e);

public class PDFGenOutOfSpaceEventArgs : EventArgs {
  public int SpaceKind { get; }
  public string WidthAvailable { get; }
  public string WidthNeeded { get; }
  public string HeightAvailable { get; }
  public string HeightNeeded { get; }
  public int Choice { get; set; }
}
```

## Remarks

This event is fired while the component 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 [AddAttachment](#addattachment-method-pdfgen-component))
- Any of the canvas-finalizing *End** methods (except [EndTableCell](#endtablecell-method-pdfgen-component))
- [EndList](#endlist-method-pdfgen-component)
- [StartList](#startlist-method-pdfgen-component)
- [StartListItem](#startlistitem-method-pdfgen-component)

*SpaceKind* 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 [MaxWidth](#PDFCanvas_f_MaxWidth) of the canvas. |
| 0x002 (skHeight) | Adding the element would extend the height of the canvas beyond its [MaxHeight](#PDFCanvas_f_MaxHeight). |

*WidthAvailable* and *HeightAvailable* report the remaining width and height of the canvas in points.

*WidthNeeded* and *HeightNeeded* report the width and height of the element in points.

*Choice* specifies the decision requested of the component. 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](#canvas-property-pdfgen-component) property to adjust the [MaxWidth](#PDFCanvas_f_MaxWidth) and/or [MaxHeight](#PDFCanvas_f_MaxHeight) 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 [EndDrawing](#enddrawing-method-pdfgen-component), 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 component is instructed to take does not adequately resolve the conflict.

# PDFAttachment Type

The file being attached to the PDF document.

## Remarks

This type contains information about the file that is being attached to the document.

The following fields are available:

- [ContentType](#PDFAttachment_f_ContentType)

- [CreationDate](#PDFAttachment_f_CreationDate)

- [Data](#PDFAttachment_f_Data)

- [Description](#PDFAttachment_f_Description)

- [FileName](#PDFAttachment_f_FileName)

- [InputStream](#PDFAttachment_f_InputStream)

- [ModificationDate](#PDFAttachment_f_ModificationDate)

- [Name](#PDFAttachment_f_Name)

- [OutputStream](#PDFAttachment_f_OutputStream)

- [Size](#PDFAttachment_f_Size)

## Fields

 **ContentType** *string*
Default: ""

The content type of the attachment.

 **CreationDate** *string*
Default: ""

The creation date of the attachment.

 **Data** *string*
Default: ""

The raw data of the attachment.

If [OutputStream](#PDFAttachment_f_OutputStream) is not set to a valid stream, the component writes to this field when an empty string is passed to SaveAttachment.

 **DataB** *byte []*
Default: ""

The raw data of the attachment.

If [OutputStream](#PDFAttachment_f_OutputStream) is not set to a valid stream, the component writes to this field when an empty string is passed to SaveAttachment.

 **Description** *string*
Default: ""

A textual description of the attachment.

 **FileName** *string*
Default: ""

The path and filename of the attachment.

 **InputStream** *System.IO.Stream*
Default: ""

A stream containing the attachment.

If this field is set to a valid stream, the component attaches the data from the stream as the current attachment.

 **ModificationDate** *string*
Default: ""

The date and time of the file's last modification.

 **Name** *string*
Default: ""

The name of the attachment.

 **OutputStream** *System.IO.Stream*
Default: ""

The stream to write the attachment to.

If this field is set to a valid stream, the component writes to the stream when an empty string is passed to SaveAttachment.

 **Size** *long (read-only)*
Default: 0

The attachment's size in bytes.

## Constructors

```text
public PDFAttachment();
```

```text
public PDFAttachment(string fileName);
```

```text
public PDFAttachment(string fileName, string description);
```

```text
public PDFAttachment(byte[] data, string name, string description);
```

```text
public PDFAttachment(System.IO.Stream inputStream, string name, string description);
```

# PDFBrush Type

The fill configuration used when rendering shapes and cell backgrounds.

## Remarks

This type encapsulates the fill properties applied to the interior of closed paths, rectangles, circles, polygons, and table cell backgrounds. It stores a single solid color and an opacity value.

The following fields are available:

- [Color](#PDFBrush_f_Color)

- [Opacity](#PDFBrush_f_Opacity)

## Fields

 **Color** *string (read-only)*
Default: "#FFFFFF"

The fill color of the brush in hash-prefixed hexadecimal format or as a name.

Note that a brush with the default color will not produce a visible fill until it has been explicitly activated via [SetBrush](#setbrush-method-pdfgen-component).

 **Opacity** *string (read-only)*
Default: ""

The opacity of the brush fill, from *0* (fully transparent) to *1* (fully opaque).

## Constructors

```text
public PDFBrush();
```

# PDFCanvas Type

Details about the current canvas.

## Remarks

This type contains information about the canvas that is currently being edited.

The following fields are available:

- [CanvasType](#PDFCanvas_f_CanvasType)

- [ContentAnchor](#PDFCanvas_f_ContentAnchor)

- [Drawing](#PDFCanvas_f_Drawing)

- [DrawingMode](#PDFCanvas_f_DrawingMode)

- [Height](#PDFCanvas_f_Height)

- [HorizontalAlignment](#PDFCanvas_f_HorizontalAlignment)

- [MaxHeight](#PDFCanvas_f_MaxHeight)

- [MaxWidth](#PDFCanvas_f_MaxWidth)

- [MinHeight](#PDFCanvas_f_MinHeight)

- [MinWidth](#PDFCanvas_f_MinWidth)

- [VerticalAlignment](#PDFCanvas_f_VerticalAlignment)

- [Width](#PDFCanvas_f_Width)

- [X](#PDFCanvas_f_X)

- [Y](#PDFCanvas_f_Y)

## Fields

 **CanvasType** *PDFCanvasTypes (read-only)*
Default: 0

The type of the canvas.

Possible values are:

|  |  |
| --- | --- |
| 0 (ctPage - default) |  |
| 1 (ctText) |  |
| 2 (ctDrawing) |  |
| 3 (ctTable) |  |
| 4 (ctTableCell) |  |
| 5 (ctSignatureField) |  |

This field is also available as a parameter of the [EditingCompleted](#editingcompleted-event-pdfgen-component) event.

 **ContentAnchor** *ContentAnchors (read-only)*
Default: 0

This field is currently unsupported.

 **Drawing** *bool (read-only)*
Default: False

Whether the canvas is a drawing canvas.

 **DrawingMode** *DrawingModes (read-only)*
Default: 0

How paths interact with the drawing canvas.

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

 **Height** *string (read-only)*
Default: "0"

The current height of the canvas in points.

 **HorizontalAlignment** *HorizontalAlignments (read-only)*
Default: 0

The current horizontal alignment for text content in the text canvas.

Possible values are:

|  |  |
| --- | --- |
| 0 (haLeft - default) |  |
| 1 (haCenter) |  |
| 2 (haRight) |  |

 **MaxHeight** *string*
Default: "0"

The maximum height of the canvas in points. Both integer and decimal values are supported.

 **MaxWidth** *string*
Default: "0"

The maximum width of the canvas in points. Both integer and decimal values are supported.

 **MinHeight** *string (read-only)*
Default: "0"

The minimum height of the canvas in points.

 **MinWidth** *string (read-only)*
Default: "0"

The minimum width of the canvas in points.

 **VerticalAlignment** *VerticalAlignments (read-only)*
Default: 0

The current vertical alignment for text content in the text canvas.

Possible values are:

|  |  |
| --- | --- |
| 0 (vaTop - default) |  |
| 1 (vaCenter) |  |
| 2 (vaBottom) |  |

 **Width** *string (read-only)*
Default: "0"

The current width of the canvas in points.

 **X** *string (read-only)*
Default: "0"

The X coordinate of the canvas in points.

 **Y** *string (read-only)*
Default: "0"

The Y coordinate of the canvas in points.

## Constructors

```text
public PDFCanvas();
```

# PDFFont Type

The font used in the PDF document.

## Remarks

This type contains details about the font being applied to text.

The following fields are available:

- [Color](#PDFFont_f_Color)

- [Name](#PDFFont_f_Name)

- [Size](#PDFFont_f_Size)

- [Style](#PDFFont_f_Style)

## Fields

 **Color** *string (read-only)*
Default: "#000000"

The color of the current font in hash-prefixed hexadecimal format or as a name.

 **Name** *string (read-only)*
Default: "Times New Roman"

The name of the current font.

 **Size** *string (read-only)*
Default: "12"

The size of the current font in points.

 **Style** *string (read-only)*
Default: ""

The style of the current font.

## Constructors

```text
public PDFFont();
```

# PDFPageLayout Type

Details about the page layout.

## Remarks

This type contains information about the layout of a page in the document.

The following fields are available:

- [Columns](#PDFPageLayout_f_Columns)

- [ContentAnchor](#PDFPageLayout_f_ContentAnchor)

- [Height](#PDFPageLayout_f_Height)

- [Size](#PDFPageLayout_f_Size)

- [Width](#PDFPageLayout_f_Width)

## Fields

 **Columns** *int (read-only)*
Default: 1

The number of columns on the page.

 **ContentAnchor** *ContentAnchors (read-only)*
Default: 0

This field is currently unsupported.

 **Height** *string (read-only)*
Default: "792"

The height of the page in points.

 **Size** *string (read-only)*
Default: ""

The size of the page. Please see [SetLayout](#setlayout-method-pdfgen-component) for more details.

 **Width** *string (read-only)*
Default: "612"

The width of the page in points.

## Constructors

```text
public PDFPageLayout();
```

# PDFPen Type

The stroke configuration used when rendering paths and borders.

## Remarks

This type encapsulates the stroke properties applied when drawing lines, path outlines, table borders, and any other stroked element in a PDF document.

The following fields are available:

- [Color](#PDFPen_f_Color)

- [Opacity](#PDFPen_f_Opacity)

- [Style](#PDFPen_f_Style)

- [Thickness](#PDFPen_f_Thickness)

## Fields

 **Color** *string (read-only)*
Default: "#000000"

The stroke color of the pen in hash-prefixed hexadecimal format or as a name.

 **Opacity** *string (read-only)*
Default: ""

The opacity of the pen stroke, from *0* (fully transparent) to *1* (fully opaque).

 **Style** *string (read-only)*
Default: ""

The style of the pen.

 **Thickness** *string (read-only)*
Default: ""

The line width of the pen stroke in points.

## Constructors

```text
public PDFPen();
```

# Config Settings ([PDFGen](#pdfgen-component) Component)

 The component 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 component, access to these *internal properties* is provided through the [Config](#config-method-pdfgen-component) method.

### PDFGen Config Settings

**AFRelationship[Key]**: The value of the AFRelationship key for the attachment.This setting specifies the value of the AFRelationship key for the attachment. 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. *Key* is either the index of the attachment in the [Attachments](#attachments-property-pdfgen-component) collection or the [Name](#PDFAttachment_f_Name) of the attachment.

**AutoTurnPages**: Whether to change the page automatically upon exceeding the lower page boundary.This setting specifies whether the component turns the page automatically. If set to *true*, the component automatically progresses to the next page upon reaching a lower page boundary while populating the current page canvas. If set to *false*, the [OutOfSpace](#outofspace-event-pdfgen-component) event fires for any elements that do not fit on the current page. The default value is *true*.

**CloseOutputStreamAfterProcessing**: Whether to close the output stream after processing.This setting determines whether the output stream specified in [SetOutputStream](#setoutputstream-method-pdfgen-component) will be closed after processing is complete. The default value is *true*.

**CompressStreams**: Whether to compress stream objects.This setting specifies whether the bytes in the document's stream objects are compressed when the document is saved. The default value is *false*.

**EnforcePDFA**: Whether to enforce PDF/A compliance.This setting specifies whether the component enforces PDF/A compliance when operating on the document. If set to *true*, [PDFALevel](#PDFALevel) is used to establish the level of PDF/A compliance to apply. The default value is *false*.

**FallbackFont**: The fallback font.This setting specifies the font that the component uses if it cannot find the intended font on the local system. In PDF/A, fonts must be embedded into the document, so this setting can be useful when text must be added but no font is available.

**FontPaths**: The font search paths.This setting specifies a CRLF-separated list of directories where the component searches for additional TrueType font files. It is used when resolving a TrueType font specified in [SetFont](#setfont-method-pdfgen-component) without a full file path.

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 [SetFont](#setfont-method-pdfgen-component).

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/, /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:

```csharp
string fontPaths = component.Config("FontPaths");
fontPaths += @"\r\nC:\Fonts";
component.Config("FontPaths=" + fontPaths);
```

**LogLevel**: The level of detail that is logged.This setting controls the level of detail that is logged through the [Log](#log-event-pdfgen-component) event. 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. |

**PDFALevel**: The PDF/A conformance level to enforce.This setting specifies the desired PDF/A conformance level that the component attempts to enforce when [EnforcePDFA](#EnforcePDFA) is set to *true*. Possible values are:

|  |  |
| --- | --- |
| 1 | PDF/A-1 |
| 2 (default) | PDF/A-2 |
| 3 | PDF/A-3 |

**SaveChanges**: Whether to save changes made to the document.This setting specifies whether and how changes made to the PDF document are saved when [Close](#close-method-pdfgen-component) is called. Possible values are:

|  |  |
| --- | --- |
| 0 | Discard all changes. |
| 1 | Save the document to [OutputFile](#outputfile-property-pdfgen-component), [OutputData](#outputdata-property-pdfgen-component), or the stream set in [SetOutputStream](#setoutputstream-method-pdfgen-component), even if it has not been modified. |
| 2 (default) | Save the document to [OutputFile](#outputfile-property-pdfgen-component), [OutputData](#outputdata-property-pdfgen-component), or the stream set in [SetOutputStream](#setoutputstream-method-pdfgen-component), but only if it has been modified. |

**SystemFontNames**: The system font names.This setting returns a CRLF-separated list of system TrueType font names that are supported by the component. This setting is read-only.

**TempPath**: The location where temporary files are stored.This setting specifies an absolute path to the location on disk where temporary files are stored. It can be useful to reduce memory usage.

### Base Config Settings

**BuildInfo**: Information about the product's build.When queried, this setting will return a string containing information about the product's build.

**GUIAvailable**: Whether or not a message loop is available for processing events.In a GUI-based application, long-running blocking operations may cause the application to stop responding to input until the operation returns. The component will attempt to discover whether or not the application has a message loop and, if one is discovered, it will process events in that message loop during any such blocking operation.

In some non-GUI applications, an invalid message loop may be discovered that will result in errant behavior. In these cases, setting [GUIAvailable](#GUIAvailable) to *false* will ensure that the component does not attempt to process external events.

**LicenseInfo**: Information about the current license.When queried, this setting will return a string containing information about the license this instance of a component is using. It will return the following information:

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

**MaskSensitiveData**: Whether sensitive data is masked in log messages.In certain circumstances it may be beneficial to mask sensitive data, like passwords, in log messages. Set this to *true* to mask sensitive data. The default is *true*.

**UseInternalSecurityAPI**: Whether or not to use the system security libraries or an internal implementation. When set to *false*, the component will use the system security libraries by default to perform cryptographic functions where applicable. In this case, calls to unmanaged code will be made. In certain environments, this is not desirable. To use a completely managed security implementation, set this setting to *true*.

Setting this configuration setting to *true* tells the component 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.

NOTE: This setting is static. The value set is applicable to all components used in the application.

When this value is set, the product's system dynamic link library (DLL) is no longer required as a reference, as all unmanaged code is stored in that file.

# Trappable Errors ([PDFGen](#pdfgen-component) Component)

### PDFGen Errors

|  |  |
| --- | --- |
| 1401 | The current canvas does not support this operation. |
| 1402 | Cannot commit canvas that is still active. |
| 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. |

### 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 | [OutputFile](#outputfile-property-pdfgen-component) already exists and [Overwrite](#overwrite-property-pdfgen-component) 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 | DecryptionCert 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](#PDFField_f_Action)) are not supported by PDF/A. Set [EnforcePDFA](#EnforcePDFA) to false or clear the [Action](#PDFField_f_Action) property of the field. |
| 895 | Font file not found. |

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