ITMSFNCCustomPDFLib Interface
Core platform abstraction for PDF document generation; exposes document lifecycle, page management, header/footer, metadata, security, and graphics access.
API unit family: TMSFNCPDFLib
Extends: IInterface
Syntax
ITMSFNCCustomPDFLib = interface(IInterface)
Remarks
Obtain an instance via TTMSFNCPDFLib. Call BeginDocument, add pages with NewPage, draw via Graphics, then call EndDocument.
Properties
| Name | Description |
|---|---|
| AllowsCopying | When True, the document permissions allow content copying. |
| AllowsPrinting | When True, the document permissions allow printing. |
| ArtBox | Art box rectangle defining the extent of meaningful page content. |
| Author | Author metadata field written to the PDF document information dictionary. |
| BitmapContainer | Bitmap container providing named images for use when drawing to the PDF document. |
| BleedBox | Bleed box rectangle defining the region to which page contents may extend when bleed is required. |
| CreationDate | Date and time the document was originally created, as reported by the document metadata. |
| Creator | Creator application metadata field written to the PDF document information dictionary. |
| CropBox | Crop box rectangle defining the visible region displayed in PDF viewers. |
| EmbedFontType | Controls which subset of font data is embedded when EmbedFonts is True. |
| EmbedFonts | When True, fonts referenced in the document are embedded in the output PDF. |
| FontFallBackList | Ordered list of font names used as substitutes when a requested font is not available on the system. |
| Footer | Footer text drawn at the bottom of each page; supports HTML when the graphics library permits it. |
| FooterAlignment | Horizontal alignment of the footer text within the footer area. |
| FooterFont | Font used when drawing the automatic footer text. |
| FooterMargins | Margins that position the footer area relative to the bottom page edge. |
| FooterSize | Height of the footer area in PDF coordinate units. |
| Graphics | Platform-specific PDF graphics library for drawing shapes, images, text, and paths. |
| GraphicsEx | Extended graphics library providing additional drawing operations beyond the base graphics interface. |
| Header | Header text drawn at the top of each page; supports HTML when the graphics library permits it. |
| HeaderAlignment | Horizontal alignment of the header text within the header area. |
| HeaderFont | Font used when drawing the automatic header text. |
| HeaderMargins | Margins that position the header area relative to the top page edge. |
| HeaderSize | Height of the header area in PDF coordinate units. |
| Keywords | Keywords metadata written to the PDF document information dictionary. |
| MediaBox | Media box rectangle defining the full physical page size in PDF coordinate units. |
| ModificationDate | Date and time the document was last modified, as reported by the document metadata. |
| OwnerPassword | Owner password that controls document permissions such as printing and copying; leave empty for no owner restriction. |
| PDFStandard | PDF standard compliance level applied to the output document, such as PDF/A or standard PDF. |
| PageHeight | Height of the current page in PDF coordinate units. |
| PageNumber | Controls whether and where automatic page numbers are drawn on each page. |
| PageNumberAlignment | Horizontal alignment of the page number text within its reserved area. |
| PageNumberFont | Font used when drawing the automatic page number. |
| PageNumberFormat | Format string for the auto-drawn page number label; use for the current page and for the total page count. |
| PageNumberMargins | Margins that position the page number area relative to the page edge. |
| PageNumberSize | Font size for the auto-drawn page number in points. |
| PageOrientation | Orientation applied to new pages; portrait or landscape. |
| PageSize | Standard paper size applied to new pages. |
| PageWidth | Width of the current page in PDF coordinate units. |
| Producer | Name of the software that produced the PDF, as reported by the document metadata. |
| Subject | Subject metadata field written to the PDF document information dictionary. |
| Title | Title metadata field written to the PDF document information dictionary. |
| TrimBox | Trim box rectangle defining the intended finished page size after trimming. |
| UserPassword | User password required to open the document in a PDF viewer; leave empty for no open restriction. |
Methods
| Name | Description |
|---|---|
| BeginDocument | Begins a new PDF document, optionally writing to the specified file path; pass an empty string to work in memory only. |
| CloseDocument | Closes the current document and releases all associated resources without saving. |
| DrawFooter | Draws the configured footer text on the current page using the footer font and alignment settings. |
| DrawHeader | Draws the configured header text on the current page using the header font and alignment settings. |
| DrawPage | Renders the specified existing page onto the current drawing surface. |
| DrawPageNumber | Draws the configured page number on the current page using the page number font and alignment settings. |
| EndDocument | Finalizes the document and returns the PDF data as a TMemoryStream. |
| GetDocumentInfo | Reads document metadata from the currently open PDF and makes it available via the metadata properties. |
| GetPageCount | Returns the total number of pages in the current document. |
| GetPageIndex | Returns the zero-based index of the page that is currently being drawn. |
| GetPageInfo | Reads layout information for the specified page of the currently open document. |
| InsertPage | Inserts a new blank page before the specified page index. |
| IsDocumentOpened | Determines whether a document has been opened or begun and is ready for drawing. |
| NewPage | Appends a new blank page to the document and makes it the current drawing surface. |
| OpenDocument | Opens an existing PDF document from the specified file path. |
| SaveDocumentFromStream | Saves a previously loaded PDF memory stream to the specified file path. |
| UnlockWithPassword | Unlocks a password-protected document; returns True when the password is accepted. |
Events
| Name | Description |
|---|---|
| OnAfterDrawFooter | Event raised after the footer has been auto-drawn. |
| OnAfterDrawHeader | Event raised after the header has been auto-drawn. |
| OnAfterDrawPageNumber | Event raised after the page number has been auto-drawn. |
| OnBeforeDrawFooter | Event raised before the footer is auto-drawn; set ADefaultDraw to False to suppress the built-in rendering and draw a custom footer instead. |
| OnBeforeDrawHeader | Event raised before the header is auto-drawn; set ADefaultDraw to False to suppress the built-in rendering and draw a custom header instead. |
| OnBeforeDrawPageNumber | Event raised before the page number is auto-drawn; set ADefaultDraw to False to suppress the built-in rendering. |
| OnNewPageStarted | Event raised each time a new page is added to the document. |