TRichView does not have an original, built-in PDF export engine for the VCL platform; instead, it relies entirely on third-party engines or virtual printers. However, for FireMonkey (FMX), TRichView includes a native SavePDF method powered by Skia4Delphi.
When developers discuss “Built-in PDF Export” in the VCL context, they are usually referring to printing via the Microsoft Print to PDF virtual printer, using ReportBuilder’s integrated PDF renderer (ppPDFRendererRV), or utilizing Skia4Delphi in newer Delphi environments.
The core architectural, performance, and text fidelity differences between using llPDFLib and these “Built-in/Standard” solutions break down as follows: Architectural Differences llPDFLib (Third-Party Canvas) “Built-in” Virtual Printer (e.g., MS Print to PDF) Built-in Skia / ReportBuilder Native Generation Method
Intercepts GDI TCanvas drawing commands and maps them directly to vector PDF instructions.
Renders the document to a standard Windows print spooler, which converts it to a file.
Directly translates the layout layout into PDF primitives via internal rendering pipelines. Dependencies Pure Object Pascal; no external DLLs required.
Heavily dependent on the host Windows OS environment and printer subsystem.
Cross-platform (Skia) or tightly bound to reporting suites (ReportBuilder). Performance Comparison 1. Execution Speed & Memory Efficiency
llPDFLib: Extremely fast for text-heavy documents. Because it processes drawing commands dynamically straight to a stream, it bypasses the Windows print spooler completely. It features excellent raw file creation speeds for simple text, layouts, and data grids.
Built-in / Virtual Printing: Significantly slower. Generating a print job, sending it to the OS spooler, and writing it out introduces massive overhead. For large, multi-page batches, this approach can choke or cause application lag while waiting on the print subsystem.
Built-in Skia/ReportBuilder: Offers highly competitive speed. Because they bypass the print subsystem and utilize highly optimized graphics engines (like Skia), they provide rapid generation speeds that rival or exceed llPDFLib for complex graphic layouts. 2. Visual Quality & Image Handling
llPDFLib: Excellent canvas accuracy for geometric shapes, borders, lines, and custom fonts. However, TRichView users have noted that complex inline images can sometimes struggle with stability or dimension deformation during massive batch exports via llPDFLib.
Built-in / Virtual Printing: Delivers perfectly uniform visual layout matching exactly what you see in the print preview. It handles embedded charts, heavy bitmaps, and metafiles cleanly, though at the expense of speed and a larger final file size. 3. Font Handling and Text Searchability (The UTF-8 Cliff)
llPDFLib: To achieve accurate character positioning and justified text alignment, llPDFLib automatically maps text using font glyph indexes (ExtTextOut) rather than direct character codes.
The Trap: While the resulting PDF looks flawless to the eye, the text often cannot be searched or copied to the clipboard (it pastes out as unreadable garbage codes) unless you strictly configure MetafileCompatibility = True or force deep font embedding.
Built-in / Skia Options: Handle modern Unicode, multi-language string layouts, and font subsets naturally. PDF files produced via Skia or ReportBuilder’s native renderer preserve perfect font structures, meaning text searches and copy-paste operations work flawlessly right out of the box. Summary Recommendation
Leave a Reply