Pdf | |
The PdfDocument type exposes the following members.
| Name | Description | |
|---|---|---|
| PdfDocument | Initializes a new instance of the PdfDocument class, creating an empty PDF document. | |
| PdfDocument(PdfStandard) | Creates an empty PDF document that conforms to the specified PDF standard — use this when you want from-scratch output to be PDF/A (archival) or PDF/X (print exchange) compliant. Equivalent to PdfDocument when pdfStandard is Full. | |
| PdfDocument(Stream) | Initializes a new instance of the PdfDocument class by loading a PDF from a stream. | |
| PdfDocument(String) | Initializes a new instance of the PdfDocument class by loading a PDF from a file. | |
| PdfDocument(Stream, String) | Initializes a new instance of the PdfDocument class by loading a password-protected PDF from a stream. | |
| PdfDocument(String, String) | Initializes a new instance of the PdfDocument class by loading a password-protected PDF from a file. |
| Name | Description | |
|---|---|---|
| AccessibilityStandard | Gets or sets the universal accessibility standard the document declares. The default is None. | |
| Bookmarks | Gets the document-level bookmark (outline) collection. Use this to add navigation entries that appear in the PDF reader's outline pane. | |
| CompressionLevel | Gets or sets the Flate/DEFLATE compression level applied to content streams, fonts, and non-image objects in the PDF. Complements JpegCompressionEnabled, which handles image XObjects. Default is Normal. | |
| DocumentInformation | Gets the document information properties (title, author, subject, etc.). | |
| Fonts | Gets the document-level font collection. Use doc.Fonts.Add(...) to register fonts (standard, CJK, or embedded TrueType) that can be retrieved later by index and reused across PdfTextElement instances. For PDF/A output from scratch, add a TrueType font via Add(String) or Add(Byte) — the 14 built-in PdfStandardFont values are not allowed under PDF/A and will throw a PdfDocumentException when used. | |
| Footer | Gets or sets the template repeated at the bottom of every page of the pdf document. | |
| Header | Gets or sets the template repeated at the top of every page of the pdf document. | |
| JpegCompressionEnabled | Gets or sets a flag indicating if JPEG compression is applied to the images in the generated pdf document. Default is true. | |
| JpegCompressionLevel | Gets or sets the JPEG compression level for images in the generated pdf document. Value range: 0 (lowest compression, best quality) to 100 (highest compression, worst quality). Only effective when JpegCompressionEnabled is true. Default is 10. | |
| Language | Gets or sets the natural language of the document content (for example "en-US"), written as the document /Lang entry. Required for accessible / PDF/UA output. | |
| LFN | Gets or sets the path of the diagnostic log file written while html content is rendered into this document. It is passed to the html elements added to the document's pages, and to the templates obtained through AddTemplate(Single, Single), Header and Footer. A template or html element that has a log file of its own keeps it. When none is set, no log is written. | |
| Margins | The default pdf document margins. New pages will use the default margins if no margins are specified when the page is added. | |
| OpenAction | Gets the action performed when the document is opened in a viewer. Set Action on the returned object to a PdfActionGoTo (jump to a destination) or PdfActionJavaScript (run a script). | |
| Pages | Gets the collection of pages in the document. | |
| Security | Gets the security settings of the document. | |
| Tagged | Gets or sets a value indicating whether the document produces a tagged (accessible) logical structure. Required for PDF/UA and PDF/A-3A conformance. | |
| Templates | Gets the collection of reusable templates of the document. A template is repeated on more than one page (headers, footers, watermarks, page numbers). Routed onto the document at save time. | |
| Title | Gets or sets the document title. For a tagged document this is written as the title metadata and, together with DisplayDocTitle, is required for PDF/UA conformance. | |
| ViewerPreferences |
Gets the viewer-preferences block that controls how the document appears in
a pdf reader — which panel opens (bookmarks, thumbnails, full-screen), whether
the reader's tool bar / menu bar / window UI is hidden, whether the window
resizes to the first page, and so on. Mutations write through to the underlying
PDF immediately. Works on every document origin — newly-created documents,
loaded documents, and HtmlToPdf output.
For the HtmlToPdf pipeline, ViewerPreferences is the pre-conversion knob; the two are complementary — set options before conversion, then fine-tune the returned document via this property. |
| Name | Description | |
|---|---|---|
| AddAssociatedFile(String, PdfAttachmentRelationship, String, String) | Embeds a file from disk into the document as an associated file. | |
| AddAssociatedFile(Stream, String, PdfAttachmentRelationship, String, String) | Embeds the content of a stream into the document as an associated file. | |
| AddBookmark(String, PdfDestination) | Adds a new bookmark to the document outline. Shorthand for doc.Bookmarks.Add(text, destination). | |
| AddBookmark(String, PdfDestination, PdfBookmark) | Adds a new bookmark as a child of the specified parent bookmark. Shorthand for parent.ChildNodes.Add(text, destination). | |
| AddFont(PdfStandardCJKFont) | Adds one of the standard CJK pdf fonts to the pdf document. | |
| AddFont(PdfStandardFont) | Adds one of the standard pdf fonts to the pdf document. | |
| AddFont(PdfSystemFont) | Adds a system font to the pdf document. The font is always embedded. | |
| AddFont(String) | Adds a font loaded from a TrueType / OpenType file to the pdf document. | |
| AddFont(PdfSystemFont, Boolean) | Adds a system font to the pdf document. | |
| AddPage | Adds a new page to the document. Shorthand for Add. | |
| AddPage(PdfMargins) | Adds a new page with the specified margins. | |
| AddPage(PdfPage) | Adds an existing PdfPage (for example, from another document) to this document. | |
| AddPage(PdfCustomPageSize, PdfMargins) | Adds a new page with the specified size and margins. | |
| AddPage(PdfCustomPageSize, PdfMargins, PdfPageOrientation) | Adds a new page with the specified size, margins, and orientation. | |
| AddTemplate(RectangleF) | Creates a template with the specified bounds and adds it to the pdf document. | |
| AddTemplate(Single, Single) | Creates a template with the specified dimensions and adds it to the pdf document. | |
| AddXmpExtensionSchema | Declares a custom XMP extension schema in the document metadata and writes the values of its properties. | |
| AddZugferdInvoice(Stream, ZugferdProfile, PdfAttachmentRelationship) | Turns the document into a ZUGFeRD / Factur-X hybrid electronic invoice: the invoice XML is embedded as an associated file and the document metadata is marked so that invoice software recognizes it. | |
| AddZugferdInvoice(String, ZugferdProfile, PdfAttachmentRelationship) | Turns the document into a ZUGFeRD / Factur-X hybrid electronic invoice, reading the invoice XML from a file. | |
| AddZugferdInvoice(Stream, ZugferdProfile, PdfAttachmentRelationship, ZugferdSchema) | Turns the document into a ZUGFeRD / Factur-X hybrid electronic invoice, using the specified metadata schema. | |
| AddZugferdInvoice(String, ZugferdProfile, PdfAttachmentRelationship, ZugferdSchema) | Turns the document into a ZUGFeRD / Factur-X hybrid electronic invoice, reading the invoice XML from a file and using the specified metadata schema. | |
| Append(PdfDocument) | Appends all pages from another PDF document to this document. The appended document must remain open until this document is saved. | |
| Append(Stream) | Appends all pages from a PDF stream to this document. | |
| Append(String) | Appends all pages from a PDF file to this document. | |
| BeginTag | Opens a container structure element (such as Table, TableRow, List or ListItem) in the tagged logical structure. Page elements added, and further containers opened, before the matching EndTag become children of this element, allowing nested structures such as Table>TableRow>TableDataCell. | |
| Close | Closes the document and releases all resources. | |
| Close(Boolean) | Closes the document. When completely is true, all resources are released. | |
| ConvertToPdfA | Converts this document to the specified PDF/A conformance level. Valid only on loaded documents — new documents bake conformance in via PdfDocument(PdfStandard), and HtmlToPdf output sets it via PdfStandard. | |
| DetachStream | Detaches the stream associated with the document. | |
| EndTag | Closes the most recently opened BeginTag(PdfTagType) container structure element. | |
| GetPagesCount(Stream) | Gets the number of pages in a PDF document loaded from a stream. | |
| GetPagesCount(String) | Gets the number of pages in a PDF file without fully loading the document. | |
| InsertPage(Int32, PdfPage) | Inserts an existing PdfPage at the specified index in this document. | |
| InsertPage(Int32, PdfCustomPageSize, PdfMargins, PdfPageOrientation) | Creates a new page and inserts it at the specified index with the given size, margins, and orientation. | |
| RemovePage | Removes the specified page from the document. | |
| RemovePageAt | Removes the page at the specified index. | |
| Save | Saves the PDF document and returns the content as a byte array. | |
| Save(Stream) | Saves the PDF document to a stream. | |
| Save(String) | Saves the PDF document to a file. |