TTMSFNCCustomPDFLib Class
Base class for PDF document generation; provides page layout, header/footer, font embedding, and graphics access.
API unit family: TMSFNCPDFLib
Inherits from: TTMSFNCCustomComponent
Syntax
TTMSFNCCustomPDFLib = class(TTMSFNCCustomComponent)
class PASCALIMPLEMENTATION TTMSFNCCustomPDFLib : public TTMSFNCCustomComponent
Remarks
Use TTMSFNCPDFLib as the drop-on component. Call BeginDocument, add pages with NewPage, draw via Graphics, then call EndDocument.
Properties
| Name | Description |
|---|---|
| ArtBox | Art box defining the content area intended for display in points. |
| Author | Author metadata written into the PDF document information dictionary. |
| BitmapContainer | Bitmap container used as the source for named bitmaps drawn on PDF pages. |
| BleedBox | Bleed box defining the clip region for production bleed in points. |
| CreationDate | Document creation date as the raw PDF date string, for example D:20260908120000Z. Use TryPDFDateToDateTime to convert. Read and written on the opened document; the generator stamps its own value. |
| Creator | Creator metadata written into the PDF document information dictionary. |
| CropBox | Crop box defining the visible page region in a viewer, in points. |
| DocumentOpened | Indicates whether a generated or structurally parsed document is open. |
| EmbedFontType | Controls which font data is embedded: full font program or subset. |
| EmbedFonts | When True, fonts used in the document are embedded in the PDF output. |
| FontFallBackList | Ordered list of fallback font names tried when a glyph is not available in the primary font. |
| Footer | Text drawn in the footer area of every page. |
| FooterAlignment | Horizontal alignment of the footer text. Default is gtaCenter. |
| FooterFont | Font used to render the footer text. |
| FooterMargins | Margins around the footer area in points. |
| FooterSize | Height of the footer strip in points. |
| FormFields | Provides access to interactive form fields (text boxes, combo boxes, list boxes, check boxes, radio buttons) on the current page. |
| Header | Text drawn in the header area of every page. |
| HeaderAlignment | Horizontal alignment of the header text. Default is gtaCenter. |
| HeaderFont | Font used to render the header text. |
| HeaderMargins | Margins around the header area in points. |
| HeaderSize | Height of the header strip in points. |
| Keywords | Keywords metadata written into the PDF document information dictionary. |
| MediaBox | Media box defining the full page extent in points. |
| ModificationDate | Document modification date as the raw PDF date string. SaveDocument stamps this automatically, so an explicit value is overwritten on save. |
| PageCount | Total number of pages in the active document. |
| PageEditing | Indicates whether a graphics page edit is active. |
| PageHeight | Page height in points; effective only when PageSize is psCustom. |
| PageNumber | Controls automatic page numbering placement. Default is pnNone. |
| PageNumberAlignment | Horizontal alignment of the automatic page number text. Default is gtaCenter. |
| PageNumberFont | Font used to render the automatic page number text. |
| PageNumberFormat | Format string for the automatic page number. Use placeholders supported by the underlying PDF engine (e.g. %d for the page index). |
| PageNumberMargins | Margins around the page-number area in points. |
| PageNumberSize | Height of the page-number strip in points. |
| PageOrientation | Page orientation. Default is poPortrait. |
| PageSize | Standard page size preset. Default is psLetter. Set to psCustom and assign PageWidth/PageHeight for a non-standard size. |
| PageWidth | Page width in points; effective only when PageSize is psCustom. |
| Producer | Document producer. Read and written on the opened document; the generator sets its own value, so writing this while generating has no effect. |
| Subject | Subject metadata written into the PDF document information dictionary. |
| Title | Title metadata written into the PDF document information dictionary. |
| TrimBox | Trim box indicating the intended finished page size in points. |
| Version | Returns the component version string. |
Methods
| Name | Description |
|---|---|
| AddPage | Appends one page from another PDF file. |
| AddPages | Appends all pages from another PDF file. |
| AppendDocument | Appends every page from another PDF file. |
| AppendPageFrom | Appends one page from another PDF file. |
| BeginDocument | Starts a new PDF document, optionally writing output directly to a file. |
| BeginPageEdit | Starts a graphics overlay edit on a zero-based page of the opened PDF. |
| CancelPageEdit | Discards the active page edit without changing the opened PDF. |
| CloseDocument | Closes the open generation or editing document without saving. |
| DeletePage | Deletes one zero-based page. A document must retain at least one page. |
| DeletePages | Deletes the selected zero-based pages. |
| DuplicatePage | Duplicates one page at the requested position, or appends it when -1. |
| DuplicatePages | Duplicates selected pages at the requested position, or appends them when -1. |
| EndDocument | Finalises the document and returns its content as a memory stream. |
| EndPageEdit | Applies the active page edit to the opened PDF. |
| ExtractPage | Returns a new in-memory PDF containing the selected pages. |
| ExtractPages | Returns a new in-memory PDF containing the selected pages. |
| GetDocumentPageContent | Returns the decoded content stream of a zero-based page of the opened PDF. |
| GetDocumentPageInfo | Returns the size and normalized rotation of a zero-based page. |
| GetDocumentPageText | Returns the text drawn on a zero-based page of the opened PDF, one line per text line. |
| GetFooterRect | Returns the bounding rectangle of the footer area on the current page, in points. |
| GetHeaderRect | Returns the bounding rectangle of the header area on the current page, in points. |
| GetPageCount | Returns the total number of pages in the active document. |
| GetPageIndex | Returns the zero-based index of the currently active page. |
| GetPageNumberRect | Returns the bounding rectangle of the automatic page-number area on the current page, in points. |
| Graphics | Returns the graphics interface for drawing on the current page. |
| InsertDocument | Inserts every page from another PDF file. |
| InsertPage | Inserts one page from another PDF file before a destination page. |
| InsertPageFrom | Inserts one page from another PDF file. |
| InsertPages | Inserts all pages from another PDF file before a destination page. |
| IsDocumentOpened | Returns whether a generated or structurally parsed document is open. |
| IsPageEditing | Returns whether a page edit is active. |
| MergeDocument | Merges all pages from another PDF at the requested position, or appends them when -1. |
| MovePage | Moves one page to a zero-based final position. |
| MovePages | Moves selected pages, preserving their supplied order, to a final position. |
| NewPage | Appends a new blank page to the document and makes it the current drawing target. |
| OpenDocument | Opens and parses an existing PDF from a file for structural editing. |
| ReplacePage | Replaces a page with one page from another PDF file. |
| RotatePage | Rotates one page clockwise by a multiple of 90 degrees. |
| RotatePages | Rotates selected pages clockwise by a multiple of 90 degrees. |
| SaveDocument | Saves the structurally edited document to a file. |
Events
| Name | Description |
|---|---|
| OnAfterDrawFooter | Fires after the footer has been drawn on a page; allows overlay drawing. |
| OnAfterDrawHeader | Fires after the header has been drawn on a page; allows overlay drawing. |
| OnAfterDrawPageNumber | Fires after the automatic page number has been drawn; allows overlay drawing. |
| OnBeforeDrawFooter | Fires before the footer is drawn on a page; allows custom rendering or suppression. |
| OnBeforeDrawHeader | Fires before the header is drawn on a page; allows custom rendering or suppression. |
| OnBeforeDrawPageNumber | Fires before the automatic page number is drawn; allows custom rendering or suppression. |
| OnNewPageStarted | Fires when a new page is started via NewPage. |