This drivers allows generating a PDF file. This format developed for representing documents in a manner that is independent of the original application software, hardware, and operating system used to create those documents. The format's copyrights are property of Adobe Systems.
This driver is very similar to the PS driver but it uses the PDFlib library to generate the PDF (http://www.pdflib.com/). There were two PDFlib licenses available, one commercial and one free with a flexible license, see PDFlib Lite License. The CD_PDF driver works with both versions of PDFlib version 7.
By default the pre-compiled library in the distribution uses the PDF Lite version code. The configuration of the PDF Lite code included does not supports image file formats. The current PDF Lite version is 7.0.5 from GitHub: https://github.com/Distrotech/PDFlib-Lite.
PDFlib Copyright (c) 1997-2010 Thomas Merz and PDFlib GmbH. All rights reserved. Applications that use this driver are subject to the PDFlib GmbH License Agreement.
But notice that "PDFlib GmbH no longer offers open-source versions of PDFlib. PDFlib Lite is no longer supported and neither source code nor precompiled binaries are available for download."
IMPORTANT: The PDFLib Lite is NOT free! PDFlib Lite can freely be used for non-profit personal use. Commercial applications can NOT use PDFLib Lite. Commercial applications can only use the regular PDFLib, and it is only available under the terms of a commercial license, and always require a license fee.
An alternative is to use the CD_CAIRO_PDF driver, which is free.
The file is created and opened by calling function cdCreateCanvas(CD_PDF, Data), in which Data contains the filename and canvas dimensions. This function opens the file and writes its header. Then, other functions in the CD library can be called as usual. The Data parameter string has the following format:
"filename -p[paper] -w[width_mm] -h[height_mm] -s[resolution_dpi] [-o]" or in C "%s -p%d -w%g -h%g -s%d -o"
The filename must be inside double quotes (") if it has spaces. Any amount of such canvases may exist simultaneously. It is important to note that a call to function cdKillCanvas is required to close the file properly.
To use this driver, the application must be linked with the "cdpdf" and "pdflib" libraries.
In Lua, it is necessary to call function cdluapdf_open() after a call to function cdlua_open(), apart from linking with the "cdluapdf" library. This is not necessary if you do require"cdluapdf".
Paper Size - The default paper size is A4. It is possible to change it by using one of the predefined sizes - CD_A0, CD_A1, CD_A2, CD_A3, CD_A4, CD_A5, CD_LETTER and CD_LEGAL - with parameter "-p". It is also possible to define a paper in a particular size by using parameters "-w" e "-h". Values are provided in millimeters.
Width (mm) | Height (mm) | |
---|---|---|
A0 | 841 | 1187 |
A1 | 594 | 841 |
A2 | 420 | 594 |
A3 | 297 | 420 |
A4 | 210 | 297 |
A5 | 148 | 210 |
Letter | 216 | 279 |
Legal | 216 | 356 |
Resolution - Resolution is used to convert values from millimeters to pixels (the same as points, but the number of points is per inch - DPI). Use parameter "-s" to configure the resolution. The default value is 300 DPI.
Orientation - The page can be oriented as portrait or landscape. The default value is portrait, but when the parameter "-o" is used, the horizontal and vertical values are switched.
Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique, Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique, Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic, Symbol, ZapfDingbats