RTPDF-32
PDF Generator Library for RTOS-32
RTPDF-32 Developer Documentation

Library Overview

The RTPDF-32 library is a subset of the Amyuni PDF libraries that can run under the RTOS-32 operating system. RTPDF-32 is provided as a single 32-bit library file named RTPDF-32.lib and 2 header files:

  • RTPDF-DDI.h is a subset of the winddi.h file that is provided with the Microsoft SDK. It contains the set of structures and functions that are needed for RTPDF
  • RTPDF-32.h is the main header files that contains all the structures and functions needed to work with the library

An application using RTPDF-32 should include RTPDF-32.h in the source files and link to RTPDF-32.lib. Including RTPDF-DDI.h is not required.

RTPDF-32.lib is compatible with Visual Studio 2015 and higher. The header file can be included into C or C++ source files.

In order to reduce the memory footprint and increase performance, PDF instructions are generated on the fly whenever library calls are made. RTPDF-32 does not provide any methods for storing the PDF data to memory, disk or sending the data through a communication channel. The calling application should implement callback functions to receive the data from the library and store or send the PDF data. The section Callback Functions describes how these callbacks are implemented.

RTPDF-32 Features
RTPDF-32 creates PDF-1.4 compliant files in compressed format. A limited set of standard PDF features is currently supported:
Loading and Rendering Images
Supported formats: JPeg, PNG, BMP
Images should already be in compressed format, the library will not compress existing images

Loading Fonts and Rendering Text
The 14 predefined Adobe PDF fonts are supported:
        Helvetica (equivalent to Arial), Helvetica-Bold, Helvetica-BoldItalic, Helvetica-Italic
        Times (equivalent to Times New Roman), Times-Bold, Times-BoldItalic, Times-Italic
        Courier (equivalent to Courier New), Courier-Bold, Courier-BoldItalic, Courier-Italic
        Symbol, ITC Zapf Dingbats
Output of WinAnsi encoded text, specifying position, rotation and color of text
Also specfy the character and word spacing attributes of text
There is no provision for loading external fonts from disk or for rendering Unicode text

Rendering of Vector Graphics
Drawing the outline and filling of complex polygons consisting of straight lines and bezier curves
Specifying the stroke and fill colors of polygons

Specifying Various Document Attributes
Document metadata information such as Title, Author, Keywords, ...
Document structure such as bookmarks, hyperlinks and layers

Table Class used to create complex tables
Table cells can contain images, text or a combination of both
Multiple cells can be merged to form a larger cell with all the attributes of a single cell
Cell borders can be set as empty, solid, dotted or dashed, with various widths
Cell content can be aligned horizontally or vertically
Background, text and title colors can be specified individually
Each cell can have a title in addition to its contents with a different font and color
Cell content can be clipped to the limits of the cell

Coordinate System used in RTPDF-32
The library follows the Windows GDI coordinate system with the top/left of the page being the origin of the coordinates
The unit of measurement for the parameters to the various functions is based on the PDF units where 1 PDF unit is 1/72 inches. E.g. to position an object at 0.6 inch from the left of the page, the value of the X coordinate should be 0.6x72=43.2.
These units should then be converted to units that Windows GDI understands, because RTPDF-32 is based on Windows GDI. Windows GDI works with 2 types of units, integer values defined as LONG and fixed-point values defined as FIX. RTPDF-32 provides 2 macros to convert from PDF units to GDI Units:
        FLOAT2LONG is used for positioning text and images and defining clipping rectangles. E.g. to position a text object at 0.6 inch from the left, set the lPosX parameter of RTPdfDrawText to FLOAT2LONG(43.2f)
        FLOAT2FIX is used for defining the path objects used to render polygons and curves. E.g. to start a polygon at 0.6 inch from the left of the page, set the X coordinate to FLOAT2FIX(43.2f)

RTPDF-21 Library Structure
The library is divided into the following function groups:

Library Initialization
Callback Functions
Document and Page Processing
Document Metadata and Structure
Text Rendering Functions
Image Rendering Functions
Vector Rendering Functions
Table Class