The Synopse PDF engine features:
- Create PDF documents containing text, graphics, and bitmaps;
- Use a TCanvas instance to draw the page content with your VCL code, just as usual (you can even use the Handle property of the TCanvas to use low level GDI commands);
- Automatic document Compression;
- Embed JPG or BMP/GIF/PNG pictures (bitmaps are compressed into the PDF content);
- You can draw any EMF file or TMetaFile instance, which will be converted to vectorial;
- Fully handle Unicode text content;
- Embed TrueType fonts, as a whole, or as a subset (i.e. only used glyphs are stored into the PDF);
- Easily add outlines or change page format;
- PDF file content generation is very fast: after profiling, it appears that the creation time is mostly spent in compression, not in content generation;
- Works in Delphi 7 up to 2010;
- Whole engine is only one unit (i.e. no external dll is required), and doesn't require our SQLite3 database framework;
- Freeware Opensource unit, licensed under a MPL/GPL/LGPL tri-license.
There are two ways of using this framework.
1. Either directly (using the Canvas property, and its associated methods):
with TPdfDocument.Create doHere is the resulting file: testdirect.pdf
Canvas.TextOut(100,700,'Synopse PDF Engine Test');
Canvas.TextOut(100,680,'Testé en Français');
2. Either by using a TCanvas, and VCL standard code:
with TPdfDocumentGDI.Create doHere is the resulting file: testvcl.pdf
for i := 1 to 9 do begin
with VCLCanvas do begin
Font.Name := 'Times new roman';
Font.Size := 150;
Font.Style := [fsBold,fsItalic];
Font.Color := clNavy;
Of course, both way of creating the PDF content can be used at the same time in your code, without any problem.
You can download the full source code of this unit, with other needed Synopse units, from synpdf.zip licensed under a MPL/GPL/LGPL tri-license.
Luiz Américo has made some sample code about Unicode, which can be downloaded from here.
I'm some kind of proud about this code, especially the fast low level CMAP4/TrueType part (for getting Unicode chars and their widths), the great TrueType subsetting trick (which works under XP and later, for once Micro$oft provided some useful API), and the way the TCanvas/EMF/TMetaFile features are implemented. Feedback welcome!