A container for a page will automatically be created when a page is created. Container objects are required to not only hold content but also provide structural grouping.
Graphical objects (objects which make a mark on the page) are placed into a container after a clip is set for the object. These objects are:
- Path (lines)
Generally, their specification requires a graphic state, matrix, font and text state, which are set and modified by the following functions:
|1||PDEElementSetGState()||Sets graphic state.|
|2||PDEElementMatrix()||Sets location, rotation, and scaling.|
|3||PDEElementSetClipPath()||Sets the clip for an element.|
|4||PDEContentAddElem()||Inserts an element into a container.|
Text and Fonts
The text methods are used to create, destroy, add, and access text and style information within the pages. They are also used to draw marks via drawing primitives.
The principal object of text is a text run. A run of text must all be in the same font, use the same graphics state, and have identical inter-word, inter-character and inter-line spacing throughout the run. A run may be as short as a single character or as long as a column of text. It must have a font object, a graphic state object and a matrix object associated with it. It may have a text state object and a stroking matrix object associated with it.
Text runs are contained within text objects (though it is acceptable to create an empty text object). Once created, a text run may be split into multiple runs. A text run may also be removed from its text object.
The Adobe PDF Library supports the use of the Adobe Base 14 fonts without embedding them into the PDF file. The following additional fonts, however, may be embedded into PDF files:
- Type 0
- Type 1 (including True Type)
- Type 3
- Type 42
- Open Type (when available)
Two multi-master fonts (one Serif and one Sans-serif) are distributed with the Adobe PDF Library. Manipulation of fonts based on changing a variety of font metrics is also supported. If the Library cannot find the specified font, it will use the font metrics stored in the document to faux (fake) the font, allowing Adobe Reader to mimic the font.
|1||PDEFontCreate()||Creates a font structure.|
|2||PDFindSysFont()||Locates system font information for the specified font.|
|3||PDEFontCreateFromSysFont()||Creates a font structure.|
|4||PDETextAdd()||Adds a character or a text run to a PDEText object.|
|5||PDETextRunSetGState()||Sets the graphics state of a text run.|
|6||PDETextRunSetTextState()||Sets the text state of a text run.|
|7||PDETextRunSetFont()||Sets the font of a text run.|
|8||PDETextRunSetTextMatrix()||Sets the text matrix of a text run.|
|9||PDETextRunSetStrokeMatrix()||Sets the stroke matrix of a text run.|
|10||PDETextRemove()||Removes characters or text runs from a text object.|
|11||PDETextSplitRunAt()||Splits a text run into multiple text runs.|
The path object is the mechanism used for creating arbitrary line drawings within PDF. These may be as simple as a line rule or as complex as a bar code. A path is first set and then an actual data path is added.
|1||PDEPathCreate()||Creates an empty path element.|
|2||PDEPathSetData()||Sets new path data for a path element.|
|3||PDEPathAddSegment()||Adds a segment to a path.|
|4||PDEElementSetGstate()||Sets the graphics state information for an element.|
|5||PDEElementSetMatrix()||Sets the transformation matrix for an element.|
The data expected by the path object is an array of ASFixed values, each containing an operator or a parameter of that operator. The sequence is an operator, followed by the number of parameters that operator expects. All positions are relative to the media coordinates specified. The legal operators of the PDEPathElementType are:
|kPDEMoveTo||x1, y1||Moves the current point.|
|kPDELineTo||x1, y1||Appends a straight line segment from the current point.|
|kPDECurveTo||x1, y1, x2, y2, x3, y3||Appends a Bézier curve to the path.|
|kPDECurveToV||x1, y1, x2, y2||Appends a Bézier curve to the current path when the first control point coincides with the initial point on the curve.|
|kPDECurveToY||x1, y1, x2, y2||Appends a Bézier curve to the current path when the second control point coincides with the final point on the curve.|
|kPDERect||x1, y1, x2 (width), y2 (height)||Adds a rectangle to the current path.|
|kPDEClosePath||(none)||Closes the current path.|
NOTE: The Adobe PDF Library requires the x and y coordinates of the elements it adds to a page from the driver application.
The image object is the graphic renderer for PDF. The Adobe PDF Library will accept the bit-stream form of graphics only. Users must have a tool to convert graphic formats to bit streams. PDEImageCreate creates an image object.
The form object is an arbitrarily-complex collection of other graphic operators, which may be positioned and scaled freely. PDEFormCreate creates a new form from an existing COS.