Skip to main content
Table of Contents

PDF Library guides

TMS FNC Core includes TTMSFNCPDFLib, a cross-platform PDF library that creates documents, pages, and page content — HTML-formatted text, plain text, drawing primitives, images, form fields, and more. It can also open existing PDFs to inspect, restructure, stamp, and save them back. The code is shareable between VCL, FMX, and WEB Core.

Add the appropriate unit to your uses clause:

pdf-libraryPascalC++
uses
  FMX.TMSFNCPDFLib;   // FMX
  VCL.TMSFNCPDFLib;   // VCL
  WEBLib.TMSFNCPDFLib; // WEB Core
#include <FMX.TMSFNCPDFLib.hpp>   // FMX

Key class: TTMSFNCPDFLib

A worked example: a one-page report

Most real documents are the same handful of operations arranged over a page, so it is worth seeing the destination before the chapters take it apart. The report below is a single generated PDF, and every element in it comes from one of the chapters:

A generated one-page PDF report with a coloured header band, an HTML-formatted intro paragraph, a banded table with right-aligned currency, a totals row and a footer

Element Chapter
The page itself, sized to its content, with the footer rule Creating a PDF document
The header band, the ruled and banded table rows Drawing graphics
The headings, the bold/coloured intro, the right-aligned currency Text and fonts

Read in that order, the four steps are: begin a document and give it a page → draw the shapes → draw the text over them → end the document. Everything else in these guides is a variation on that skeleton.

Chapters

Chapter Covers
Creating a PDF document The document skeleton, pages, page size, metadata, headers and footers, page numbering, security, archival format, generation callbacks, and unit conversion.
Drawing graphics Lines, rectangles, custom paths, path modes, clipping, gradients, transforms, images, and the FNC graphics engine.
Text and fonts Plain and wrapped text, multi-column flow, Mini HTML, alignment, line break modes, and font embedding.
Interactive form fields Text edits, check boxes, radio groups, combo and list boxes in a fillable PDF.
Editing existing documents Opening a PDF that already exists, reading its page geometry and text, and saving it back.
Rearranging pages Deleting, moving, duplicating and rotating pages, merging documents, extracting pages.
Page overlays and underlays Drawing on an existing page — stamps, watermarks, footers — above or below its content.
Printing Printing FNC controls or custom drawing with header, footer and page-number bands, multi-control layout, page setup, and grid and rich editor printing.
TMS WEB Core Font caching and compression when generating in the browser.
Performance and large documents Memory use and output, image reuse, sizing and JPEG quality, font count, and compression for large or image-heavy documents.

Choosing an approach

Three components sit under the PDF Library, and picking the wrong one costs the most time at the start:

You want to Use
Build a document from scratch, element by element TTMSFNCPDFLib — these guides
Export a control or canvas you already draw TTMSFNCGraphicsPDFIO
Send that same content to a printer instead TTMSFNCGraphicsPrintIO, see Printing
Reuse existing FNC paint code inside a TTMSFNCPDFLib document TTMSFNCGraphicsPDFEngine, see Drawing graphics

See also