2021-07-08 04:06:25 +02:00
.TH pdfio 3 "pdf read/write library" "2021-07-07" "pdf read/write library"
2021-05-30 03:21:45 +02:00
.SH NAME
pdfio \- pdf read/write library
.SH Introduction
.PP
2021-05-30 13:10:44 +02:00
PDFio is a simple C library for reading and writing PDF files. The primary goals of pdfio are:
2021-05-30 03:21:45 +02:00
.IP \(bu 5
.PP
Read any PDF file with or without encryption or linearization
.IP \(bu 5
.PP
Write PDF files without encryption or linearization
.IP \(bu 5
.PP
Extract or embed useful metadata (author, creator, page information, etc.)
.IP \(bu 5
.PP
"Filter" PDF files, for example to extract a range of pages or to embed fonts that are missing from a PDF
.IP \(bu 5
.PP
Provide access to objects used for each page
.PP
2021-05-30 13:10:44 +02:00
PDFio is
2021-05-30 03:21:45 +02:00
.I not
concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it.
2021-06-07 14:34:30 +02:00
.PP
PDFio is Copyright \[ co] 2021 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information.
.SS Requirements
.PP
PDFio requires the following to build the software:
.IP \(bu 5
.PP
A C99 compiler such as Clang, GCC, or MS Visual C
.IP \(bu 5
.PP
A POSIX\- compliant make program
.IP \(bu 5
.PP
ZLIB (https://www.zlib.net) 1.0 or higher
.PP
IDE files for Xcode (macOS/iOS) and Visual Studio (Windows) are also provided.
.SS Installing pdfio
.PP
PDFio comes with a portable makefile that will work on any POSIX\- compliant system with ZLIB installed. To make it, run:
.nf
make all
.fi
.PP
To test it, run:
.nf
make test
.fi
.PP
To install it, run:
.nf
make install
.fi
.PP
If you want a shared library, run:
.nf
make all\- shared
make install\- shared
.fi
.PP
The default installation location is "/usr/local". Pass the prefix variable to make to install it to another location:
.nf
make install prefix=/some/other/directory
.fi
.PP
The makefile installs the pdfio header to "${prefix}/include", the library to "${prefix}/lib", the pkg\- config file to "${prefix}/lib/pkgconfig", the man page to "${prefix}/share/man/man3", and the documentation to "${prefix}/share/doc/pdfio".
.PP
The makefile supports the following variables that can be specified in the make command or as environment variables:
.IP \(bu 5
.PP
AR: the library archiver (default "ar")
.IP \(bu 5
.PP
ARFLAGS: options for the library archiver (default "cr")
.IP \(bu 5
.PP
CC: the C compiler (default "cc")
.IP \(bu 5
.PP
CFLAGS: options for the C compiler (default "")
.IP \(bu 5
.PP
CODESIGN_IDENTITY: the identity to use when code signing the shared library on macOS (default "Developer ID")
.IP \(bu 5
.PP
COMMONFLAGS: options for the C compiler and linker (typically architecture and optimization options, default is "\- Os \- g")
.IP \(bu 5
.PP
CPPFLAGS: options for the C preprocessor (default "")
.IP \(bu 5
.PP
DESTDIR" and "DSTROOT: specifies a root directory when installing (default is "", specify only one)
.IP \(bu 5
.PP
DSOFLAGS: options for the C compiler when linking the shared library (default "")
.IP \(bu 5
.PP
LDFLAGS: options for the C compiler when linking the test programs (default "")
.IP \(bu 5
.PP
LIBS: library options when linking the test programs (default "\- lz")
.IP \(bu 5
.PP
RANLIB: program that generates a table\- of\- contents in a library (default "ranlib")
.IP \(bu 5
.PP
prefix: specifies the installation directory (default "/usr/local")
.SS Visual Studio Project
.PP
2021-06-07 23:06:13 +02:00
The Visual Studio solution ("pdfio.sln") is provided for Windows developers and generates both a static library and DLL.
2021-06-07 14:34:30 +02:00
.SS Xcode Project
.PP
There is also an Xcode project ("pdfio.xcodeproj") you can use on macOS which generates a static library that will be installed under "/usr/local" with:
.nf
sudo xcodebuild install
.fi
.PP
You can reproduce this with the makefile using:
.nf
sudo make 'COMMONFLAGS="\- Os \- mmacosx\- version\- min=10.14 \- arch x86_64 \- arch arm64"' install
.fi
.SS Detecting PDFio
.PP
PDFio can be detected using the pkg\- config command, for example:
.nf
if pkg\- config \- \- exists pdfio; then
...
fi
.fi
.PP
In a makefile you can add the necessary compiler and linker options with:
.nf
CFLAGS += `pkg\- config \- \- cflags pdfio`
LIBS += `pkg\- config \- \- libs pdfio`
.fi
2021-06-07 23:06:13 +02:00
.PP
On Windows, you need to link to the PDFIO.LIB (static) or PDFIO1.LIB (DLL) libraries and include the "zlib" NuGet package dependency.
2021-06-07 14:34:30 +02:00
.SS Header Files
.PP
PDFio provides a primary header file that is always used:
.nf
#include <pdfio.h>
.fi
.PP
2021-06-07 23:06:13 +02:00
PDFio also provides helper functions for producing PDF content that are defined in a separate header file:
2021-06-07 14:34:30 +02:00
.nf
#include <pdfio\- content.h>
.fi
.SH API Overview
.PP
PDFio exposes several types:
.IP \(bu 5
.PP
pdfio_file_t: A PDF file (for reading or writing)
.IP \(bu 5
.PP
pdfio_array_t: An array of values
.IP \(bu 5
.PP
pdfio_dict_t: A dictionary of key/value pairs in a PDF file, object, etc.
.IP \(bu 5
.PP
pdfio_obj_t: An object in a PDF file
.IP \(bu 5
.PP
pdfio_stream_t: An object stream
2021-06-07 23:06:13 +02:00
.SS Reading PDF Files
.PP
You open an existing PDF file using the pdfioFileOpen function:
.nf
pdfio_file_t *pdf = pdfioFileOpen("myinputfile.pdf", error_cb, error_data);
.fi
.PP
where the three arguments to the function are the filename ("myinputfile.pdf"), an optional error callback function (error_cb), and an optional pointer value for the error callback function (error_data). The error callback is called for both errors and warnings and accepts the pdfio_file_t pointer, a message string, and the callback pointer value, for example:
.nf
bool
error_cb(pdfio_file_t *pdf, const char *message, void *data)
{
(void)data; // This callback does not use the data pointer
fprintf(stderr, "%s: %s\\ n", pdfioFileGetName(pdf), message);
// Return false to treat warnings as errors
return (false);
}
.fi
.PP
The default error callback (NULL) does the equivalent of the above.
.PP
Each PDF file contains one or more pages. The pdfioFileGetNumPages function returns the number of pages in the file while the pdfioFileGetPage function gets the specified page in the PDF file:
.nf
pdfio_file_t *pdf; // PDF file
size_t i; // Looping var
size_t count; // Number of pages
pdfio_obj_t *page; // Current page
// Iterate the pages in the PDF file
for (i = 0, count = pdfioFileGetNumPages(pdf); i < count; i ++)
{
page = pdfioFileGetPage(pdf, i);
// do something with page
}
.fi
.PP
Each page is represented by a "page tree" object (what pdfioFileGetPage returns) that specifies information about the page and one or more "content" objects that contain the images, fonts, text, and graphics that appear on the page.
.PP
The pdfioFileClose function closes a PDF file and frees all memory that was used for it:
.nf
pdfioFileClose(pdf);
.fi
. SS Writing PDF Files
.PP
You create a new PDF file using the pdfioFileCreate function:
.nf
pdfio_rect_t media_box = { 0.0, 0.0, 612.0, 792.0 }; // US Letter
pdfio_rect_t crop_box = { 36.0, 36.0, 576.0, 756.0 }; // 0.5" margins
pdfio_file_t *pdf = pdfioFileCreate("myoutputfile.pdf", "2.0", &media_box, &crop_box, error_cb, error_data);
.fi
.PP
where the six arguments to the function are the filename ("myoutputfile.pdf"), PDF version ("2.0"), media box (media_box), crop box (crop_box), an optional error callback function (error_cb), and an optional pointer value for the error callback function (error_data).
.PP
Once the file is created, use the pdfioFileCreateObj, pdfioFileCreatePage, and pdfioPageCopy functions to create objects and pages in the file.
.PP
Finally, the pdfioFileClose function writes the PDF cross\- reference and "trailer" information, closes the file, and frees all memory that was used for it.
2021-06-07 14:34:30 +02:00
.SS PDF Objects
2021-06-07 23:06:13 +02:00
.PP
PDF objects are identified using two numbers \- the object number (1 to N) and the object generation (0 to 65535) that specifies a particular version of an object. An object's numbers are returned by the pdfioObjGetNumber and pdfioObjGetGeneration functions. You can find a numbered object using the pdfioFileFindObj function.
.PP
Objects contain values (typically dictionaries) and usually an associated data stream containing images, fonts, ICC profiles, and page content. PDFio provides several accessor functions to get the value(s) associated with an object:
.IP \(bu 5
.PP
pdfioObjGetArray returns an object's array value, if any
.IP \(bu 5
.PP
pdfioObjGetDict returns an object's dictionary value, if any
.IP \(bu 5
.PP
pdfioObjGetLength returns the length of the data stream, if any
.IP \(bu 5
.PP
pdfioObjGetSubtype returns the sub\- type name of the object, for example "Image" for an image object.
.IP \(bu 5
.PP
pdfioObjGetType returns the type name of the object, for example "XObject" for an image object.
2021-06-07 14:34:30 +02:00
.SS PDF Streams
2021-06-07 23:06:13 +02:00
.SS PDF Content Helper Functions
2021-05-30 03:21:45 +02:00
.SH ENUMERATIONS
.SS pdfio_filter_e
Compression/decompression filters for streams
.TP 5
PDFIO_FILTER_ASCII85
.br
ASCII85Decode filter (reading only)
.TP 5
PDFIO_FILTER_ASCIIHEX
.br
ASCIIHexDecode filter (reading only)
.TP 5
PDFIO_FILTER_CCITTFAX
.br
CCITTFaxDecode filter
.TP 5
PDFIO_FILTER_CRYPT
.br
Encryption filter
.TP 5
PDFIO_FILTER_DCT
.br
DCTDecode (JPEG) filter
.TP 5
PDFIO_FILTER_FLATE
.br
FlateDecode filter
.TP 5
PDFIO_FILTER_JBIG2
.br
JBIG2Decode filter
.TP 5
PDFIO_FILTER_JPX
.br
JPXDecode filter (reading only)
.TP 5
PDFIO_FILTER_LZW
.br
LZWDecode filter (reading only)
.TP 5
PDFIO_FILTER_NONE
.br
No filter
.TP 5
PDFIO_FILTER_RUNLENGTH
.br
RunLengthDecode filter (reading only)
.SS pdfio_valtype_e
PDF value types
.TP 5
PDFIO_VALTYPE_ARRAY
.br
Array
.TP 5
PDFIO_VALTYPE_BINARY
.br
Binary data
.TP 5
PDFIO_VALTYPE_BOOLEAN
.br
Boolean
.TP 5
PDFIO_VALTYPE_DATE
.br
Date/time
.TP 5
PDFIO_VALTYPE_DICT
.br
Dictionary
.TP 5
PDFIO_VALTYPE_INDIRECT
.br
Indirect object (N G obj)
.TP 5
PDFIO_VALTYPE_NAME
.br
Name
.TP 5
PDFIO_VALTYPE_NONE
.br
No value, not set
.TP 5
PDFIO_VALTYPE_NULL
.br
Null object
.TP 5
PDFIO_VALTYPE_NUMBER
.br
Number (integer or real)
.TP 5
PDFIO_VALTYPE_STRING
.br
String
.SH FUNCTIONS
.SS pdfioArrayAppendArray
Add an array value to an array.
.PP
.nf
bool pdfioArrayAppendArray (
pdfio_array_t *a,
pdfio_array_t *value
);
.fi
.SS pdfioArrayAppendBinary
Add a binary string value to an array.
.PP
.nf
bool pdfioArrayAppendBinary (
pdfio_array_t *a,
2021-06-07 14:34:30 +02:00
const unsigned char *value,
2021-05-30 03:21:45 +02:00
size_t valuelen
);
.fi
.SS pdfioArrayAppendBoolean
Add a boolean value to an array.
.PP
.nf
bool pdfioArrayAppendBoolean (
pdfio_array_t *a,
bool value
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioArrayAppendDate
Add a date value to an array.
.PP
.nf
bool pdfioArrayAppendDate (
pdfio_array_t *a,
time_t value
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioArrayAppendDict
Add a dictionary to an array.
.PP
.nf
bool pdfioArrayAppendDict (
pdfio_array_t *a,
pdfio_dict_t *value
);
.fi
.SS pdfioArrayAppendName
Add a name to an array.
.PP
.nf
bool pdfioArrayAppendName (
pdfio_array_t *a,
const char *value
);
.fi
.SS pdfioArrayAppendNumber
Add a number to an array.
.PP
.nf
bool pdfioArrayAppendNumber (
pdfio_array_t *a,
double value
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioArrayAppendObj
2021-05-30 03:21:45 +02:00
Add an indirect object reference to an array.
.PP
.nf
2021-06-07 14:34:30 +02:00
bool pdfioArrayAppendObj (
2021-05-30 03:21:45 +02:00
pdfio_array_t *a,
pdfio_obj_t *value
);
.fi
.SS pdfioArrayAppendString
Add a string to an array.
.PP
.nf
bool pdfioArrayAppendString (
pdfio_array_t *a,
const char *value
);
.fi
.SS pdfioArrayCopy
Copy an array.
.PP
.nf
pdfio_array_t * pdfioArrayCopy (
pdfio_file_t *pdf,
pdfio_array_t *a
);
.fi
.SS pdfioArrayCreate
Create an empty array.
.PP
.nf
pdfio_array_t * pdfioArrayCreate (
pdfio_file_t *pdf
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioArrayCreateColorFromICCObj
Create an ICC-based color space array.
.PP
.nf
pdfio_array_t * pdfioArrayCreateColorFromICCObj (
pdfio_file_t *pdf,
pdfio_obj_t *icc_object
);
.fi
.SS pdfioArrayCreateColorFromMatrix
2021-06-07 14:34:30 +02:00
Create a calibrated color space array using a CIE XYZ transform matrix.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_array_t * pdfioArrayCreateColorFromMatrix (
2021-06-07 14:34:30 +02:00
pdfio_file_t *pdf,
size_t num_colors,
double gamma,
const double matrix[3][3],
const double white_point[3]
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioArrayCreateColorFromPalette
Create an indexed color space array.
.PP
.nf
pdfio_array_t * pdfioArrayCreateColorFromPalette (
pdfio_file_t *pdf,
size_t num_colors,
const unsigned char *colors
);
.fi
.SS pdfioArrayCreateColorFromPrimaries
2021-06-07 14:34:30 +02:00
Create a calibrated color sapce array using CIE xy primary chromacities.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_array_t * pdfioArrayCreateColorFromPrimaries (
2021-06-07 14:34:30 +02:00
pdfio_file_t *pdf,
size_t num_colors,
double gamma,
double wx,
double wy,
double rx,
double ry,
double gx,
double gy,
double bx,
double by
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioArrayGetArray
Get an array value from an array.
.PP
.nf
pdfio_array_t * pdfioArrayGetArray (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetBinary
Get a binary string value from an array.
.PP
.nf
unsigned char * pdfioArrayGetBinary (
pdfio_array_t *a,
size_t n,
size_t *length
);
.fi
.SS pdfioArrayGetBoolean
Get a boolean value from an array.
.PP
.nf
bool pdfioArrayGetBoolean (
pdfio_array_t *a,
size_t n
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioArrayGetDate
Get a date value from an array.
.PP
.nf
time_t pdfioArrayGetDate (
pdfio_array_t *a,
size_t n
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioArrayGetDict
Get a dictionary value from an array.
.PP
.nf
pdfio_dict_t * pdfioArrayGetDict (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetName
Get a name value from an array.
.PP
.nf
const char * pdfioArrayGetName (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetNumber
Get a number from an array.
.PP
.nf
double pdfioArrayGetNumber (
pdfio_array_t *a,
size_t n
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioArrayGetObj
2021-05-30 03:21:45 +02:00
Get an indirect object reference from an array.
.PP
.nf
2021-06-07 14:34:30 +02:00
pdfio_obj_t * pdfioArrayGetObj (
2021-05-30 03:21:45 +02:00
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetSize
Get the length of an array.
.PP
.nf
size_t pdfioArrayGetSize (
pdfio_array_t *a
);
.fi
.SS pdfioArrayGetString
Get a string value from an array.
.PP
.nf
const char * pdfioArrayGetString (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetType
Get a value type from an array.
.PP
.nf
pdfio_valtype_t pdfioArrayGetType (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioContentClip
Clip output to the current path.
.PP
.nf
bool pdfioContentClip (
pdfio_stream_t *st,
bool even_odd
);
.fi
.SS pdfioContentDrawImage
Draw an image object.
.PP
.nf
bool pdfioContentDrawImage (
pdfio_stream_t *st,
const char *name,
double x,
double y,
2021-06-07 14:34:30 +02:00
double width,
double height
2021-05-30 03:21:45 +02:00
);
.fi
.PP
The object name must be part of the page dictionary resources, typically
using the \fI pdfioPageDictAddImage\fR function.
.SS pdfioContentFill
Fill the current path.
.PP
.nf
bool pdfioContentFill (
pdfio_stream_t *st,
bool even_odd
);
.fi
.SS pdfioContentFillAndStroke
Fill and stroke the current path.
.PP
.nf
bool pdfioContentFillAndStroke (
pdfio_stream_t *st,
bool even_odd
);
.fi
.SS pdfioContentMatrixConcat
Concatenate a matrix to the current graphics
state.
.PP
.nf
bool pdfioContentMatrixConcat (
pdfio_stream_t *st,
pdfio_matrix_t m
);
.fi
.SS pdfioContentMatrixRotate
Rotate the current transform matrix.
.PP
.nf
bool pdfioContentMatrixRotate (
pdfio_stream_t *st,
double degrees
);
.fi
.SS pdfioContentMatrixScale
Scale the current transform matrix.
.PP
.nf
bool pdfioContentMatrixScale (
pdfio_stream_t *st,
double sx,
double sy
);
.fi
.SS pdfioContentMatrixTranslate
Translate the current transform matrix.
.PP
.nf
bool pdfioContentMatrixTranslate (
pdfio_stream_t *st,
double tx,
double ty
);
.fi
.SS pdfioContentPathClose
Close the current path.
.PP
.nf
bool pdfioContentPathClose (
pdfio_stream_t *st
);
.fi
.SS pdfioContentPathCurve
Add a Bezier curve with two control points.
.PP
.nf
bool pdfioContentPathCurve (
pdfio_stream_t *st,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3
);
.fi
.SS pdfioContentPathCurve13
Add a Bezier curve with an initial control point.
.PP
.nf
bool pdfioContentPathCurve13 (
pdfio_stream_t *st,
double x1,
double y1,
double x3,
double y3
);
.fi
.SS pdfioContentPathCurve23
Add a Bezier curve with a trailing control point.
.PP
.nf
bool pdfioContentPathCurve23 (
pdfio_stream_t *st,
double x2,
double y2,
double x3,
double y3
);
.fi
.SS pdfioContentPathLineTo
Add a straight line to the current path.
.PP
.nf
bool pdfioContentPathLineTo (
pdfio_stream_t *st,
double x,
double y
);
.fi
.SS pdfioContentPathMoveTo
Start a new subpath.
.PP
.nf
bool pdfioContentPathMoveTo (
pdfio_stream_t *st,
double x,
double y
);
.fi
.SS pdfioContentPathRect
Add a rectangle to the current path.
.PP
.nf
bool pdfioContentPathRect (
pdfio_stream_t *st,
2021-06-07 14:34:30 +02:00
double x,
double y,
double width,
double height
2021-05-30 03:21:45 +02:00
);
.fi
.SS pdfioContentRestore
Restore a previous graphics state.
.PP
.nf
bool pdfioContentRestore (
pdfio_stream_t *st
);
.fi
.SS pdfioContentSave
Save the current graphics state.
.PP
.nf
bool pdfioContentSave (
pdfio_stream_t *st
);
.fi
.SS pdfioContentSetDashPattern
Set the stroke pattern.
.PP
.nf
bool pdfioContentSetDashPattern (
pdfio_stream_t *st,
int phase,
int on,
int off
);
.fi
.SS pdfioContentSetFillColorDeviceCMYK
Set device CMYK fill color.
.PP
.nf
bool pdfioContentSetFillColorDeviceCMYK (
pdfio_stream_t *st,
double c,
double m,
double y,
double k
);
.fi
.SS pdfioContentSetFillColorDeviceGray
Set the device gray fill color.
.PP
.nf
bool pdfioContentSetFillColorDeviceGray (
pdfio_stream_t *st,
double g
);
.fi
.SS pdfioContentSetFillColorDeviceRGB
Set the device RGB fill color.
.PP
.nf
bool pdfioContentSetFillColorDeviceRGB (
pdfio_stream_t *st,
double r,
double g,
double b
);
.fi
.SS pdfioContentSetFillColorGray
Set the calibrated gray fill color.
.PP
.nf
bool pdfioContentSetFillColorGray (
pdfio_stream_t *st,
double g
);
.fi
.SS pdfioContentSetFillColorRGB
Set the calibrated RGB fill color.
.PP
.nf
bool pdfioContentSetFillColorRGB (
pdfio_stream_t *st,
double r,
double g,
double b
);
.fi
.SS pdfioContentSetFillColorSpace
Set the fill colorspace.
.PP
.nf
bool pdfioContentSetFillColorSpace (
pdfio_stream_t *st,
const char *name
);
.fi
.SS pdfioContentSetFlatness
Set the flatness tolerance.
.PP
.nf
bool pdfioContentSetFlatness (
pdfio_stream_t *st,
double flatness
);
.fi
.SS pdfioContentSetLineCap
Set the line ends style.
.PP
.nf
bool pdfioContentSetLineCap (
pdfio_stream_t *st,
pdfio_linecap_t lc
);
.fi
.SS pdfioContentSetLineJoin
Set the line joining style.
.PP
.nf
bool pdfioContentSetLineJoin (
pdfio_stream_t *st,
pdfio_linejoin_t lj
);
.fi
.SS pdfioContentSetLineWidth
Set the line width.
.PP
.nf
bool pdfioContentSetLineWidth (
pdfio_stream_t *st,
double width
);
.fi
.SS pdfioContentSetMiterLimit
Set the miter limit.
.PP
.nf
bool pdfioContentSetMiterLimit (
pdfio_stream_t *st,
double limit
);
.fi
.SS pdfioContentSetStrokeColorDeviceCMYK
Set the device CMYK stroke color.
.PP
.nf
bool pdfioContentSetStrokeColorDeviceCMYK (
pdfio_stream_t *st,
double c,
double m,
double y,
double k
);
.fi
.SS pdfioContentSetStrokeColorDeviceGray
Set the device gray stroke color.
.PP
.nf
bool pdfioContentSetStrokeColorDeviceGray (
pdfio_stream_t *st,
double g
);
.fi
.SS pdfioContentSetStrokeColorDeviceRGB
Set the device RGB stroke color.
.PP
.nf
bool pdfioContentSetStrokeColorDeviceRGB (
pdfio_stream_t *st,
double r,
double g,
double b
);
.fi
.SS pdfioContentSetStrokeColorGray
Set the calibrated gray stroke color.
.PP
.nf
bool pdfioContentSetStrokeColorGray (
pdfio_stream_t *st,
double g
);
.fi
.SS pdfioContentSetStrokeColorRGB
Set the calibrated RGB stroke color.
.PP
.nf
bool pdfioContentSetStrokeColorRGB (
pdfio_stream_t *st,
double r,
double g,
double b
);
.fi
.SS pdfioContentSetStrokeColorSpace
Set the stroke color space.
.PP
.nf
bool pdfioContentSetStrokeColorSpace (
pdfio_stream_t *st,
const char *name
);
.fi
.SS pdfioContentSetTextCharacterSpacing
Set the spacing between characters.
.PP
.nf
bool pdfioContentSetTextCharacterSpacing (
pdfio_stream_t *st,
double spacing
);
.fi
.SS pdfioContentSetTextFont
Set the text font and size.
.PP
.nf
bool pdfioContentSetTextFont (
pdfio_stream_t *st,
const char *name,
double size
);
.fi
.SS pdfioContentSetTextLeading
Set text leading (line height) value.
.PP
.nf
bool pdfioContentSetTextLeading (
pdfio_stream_t *st,
double leading
);
.fi
.SS pdfioContentSetTextMatrix
Set the text transform matrix.
.PP
.nf
bool pdfioContentSetTextMatrix (
pdfio_stream_t *st,
pdfio_matrix_t m
);
.fi
.SS pdfioContentSetTextRenderingMode
Set the text rendering mode.
.PP
.nf
bool pdfioContentSetTextRenderingMode (
pdfio_stream_t *st,
pdfio_textrendering_t mode
);
.fi
.SS pdfioContentSetTextRise
Set the text baseline offset.
.PP
.nf
bool pdfioContentSetTextRise (
pdfio_stream_t *st,
double rise
);
.fi
.SS pdfioContentSetTextWordSpacing
Set the inter-word spacing.
.PP
.nf
bool pdfioContentSetTextWordSpacing (
pdfio_stream_t *st,
double spacing
);
.fi
.SS pdfioContentSetTextXScaling
Set the horizontal scaling value.
.PP
.nf
bool pdfioContentSetTextXScaling (
pdfio_stream_t *st,
double percent
);
.fi
.SS pdfioContentStroke
Stroke the current path.
.PP
.nf
bool pdfioContentStroke (
pdfio_stream_t *st
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioContentTextBegin
Begin a text block.
.PP
.nf
bool pdfioContentTextBegin (
pdfio_stream_t *st
);
.fi
.SS pdfioContentTextEnd
End a text block.
.PP
.nf
bool pdfioContentTextEnd (
pdfio_stream_t *st
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioContentTextMoveLine
Move to the next line and offset.
.PP
.nf
bool pdfioContentTextMoveLine (
pdfio_stream_t *st,
double tx,
double ty
);
.fi
.SS pdfioContentTextMoveTo
Offset within the current line.
.PP
.nf
bool pdfioContentTextMoveTo (
pdfio_stream_t *st,
double tx,
double ty
);
.fi
.SS pdfioContentTextNextLine
Move to the next line.
.PP
.nf
bool pdfioContentTextNextLine (
pdfio_stream_t *st
);
.fi
.SS pdfioContentTextShow
Show text.
.PP
.nf
bool pdfioContentTextShow (
pdfio_stream_t *st,
2021-07-08 04:06:25 +02:00
bool unicode,
2021-06-07 14:34:30 +02:00
const char *s
2021-05-30 03:21:45 +02:00
);
.fi
2021-07-08 04:06:25 +02:00
.PP
This function shows some text in a PDF content stream. The "unicode" argument
specifies that the current font maps to full Unicode. The "s" argument
specifies a UTF-8 encoded string.
2021-05-30 03:21:45 +02:00
.SS pdfioContentTextShowJustified
Show justified text.
.PP
.nf
bool pdfioContentTextShowJustified (
pdfio_stream_t *st,
2021-07-08 04:06:25 +02:00
bool unicode,
2021-05-30 03:21:45 +02:00
size_t num_fragments,
const double *offsets,
const char *const *fragments
);
.fi
2021-07-08 04:06:25 +02:00
.PP
This function shows some text in a PDF content stream. The "unicode" argument
specifies that the current font maps to full Unicode. The "fragments"
argument specifies an array of UTF-8 encoded strings.
2021-06-07 14:34:30 +02:00
.SS pdfioContentTextShowf
.PP
.nf
bool pdfioContentTextShowf (
pdfio_stream_t *st,
2021-07-08 04:06:25 +02:00
bool unicode,
2021-06-07 14:34:30 +02:00
const char *format,
...
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioDictCopy
Copy a dictionary to a PDF file.
.PP
.nf
pdfio_dict_t * pdfioDictCopy (
pdfio_file_t *pdf,
pdfio_dict_t *dict
);
.fi
.SS pdfioDictCreate
Create a dictionary to hold key/value pairs.
.PP
.nf
pdfio_dict_t * pdfioDictCreate (
pdfio_file_t *pdf
);
.fi
.SS pdfioDictGetArray
Get a key array value from a dictionary.
.PP
.nf
pdfio_array_t * pdfioDictGetArray (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetBinary
Get a key binary string value from a dictionary.
.PP
.nf
unsigned char * pdfioDictGetBinary (
pdfio_dict_t *dict,
const char *key,
size_t *length
);
.fi
.SS pdfioDictGetBoolean
Get a key boolean value from a dictionary.
.PP
.nf
bool pdfioDictGetBoolean (
pdfio_dict_t *dict,
const char *key
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioDictGetDate
Get a date value from a dictionary.
.PP
.nf
time_t pdfioDictGetDate (
pdfio_dict_t *dict,
const char *key
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioDictGetDict
Get a key dictionary value from a dictionary.
.PP
.nf
pdfio_dict_t * pdfioDictGetDict (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetName
Get a key name value from a dictionary.
.PP
.nf
const char * pdfioDictGetName (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetNumber
Get a key number value from a dictionary.
.PP
.nf
double pdfioDictGetNumber (
pdfio_dict_t *dict,
const char *key
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioDictGetObj
2021-05-30 03:21:45 +02:00
Get a key indirect object value from a dictionary.
.PP
.nf
2021-06-07 14:34:30 +02:00
pdfio_obj_t * pdfioDictGetObj (
2021-05-30 03:21:45 +02:00
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetRect
Get a key rectangle value from a dictionary.
.PP
.nf
pdfio_rect_t * pdfioDictGetRect (
pdfio_dict_t *dict,
const char *key,
pdfio_rect_t *rect
);
.fi
.SS pdfioDictGetString
Get a key string value from a dictionary.
.PP
.nf
const char * pdfioDictGetString (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetType
Get a key value type from a dictionary.
.PP
.nf
pdfio_valtype_t pdfioDictGetType (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictSetArray
Set a key array in a dictionary.
.PP
.nf
bool pdfioDictSetArray (
pdfio_dict_t *dict,
const char *key,
pdfio_array_t *value
);
.fi
.SS pdfioDictSetBinary
Set a key binary string in a dictionary.
.PP
.nf
bool pdfioDictSetBinary (
pdfio_dict_t *dict,
const char *key,
2021-06-07 14:34:30 +02:00
const unsigned char *value,
2021-05-30 03:21:45 +02:00
size_t valuelen
);
.fi
.SS pdfioDictSetBoolean
Set a key boolean in a dictionary.
.PP
.nf
bool pdfioDictSetBoolean (
pdfio_dict_t *dict,
const char *key,
bool value
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioDictSetDate
Set a date value in a dictionary.
.PP
.nf
bool pdfioDictSetDate (
pdfio_dict_t *dict,
const char *key,
time_t value
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioDictSetDict
Set a key dictionary in a dictionary.
.PP
.nf
bool pdfioDictSetDict (
pdfio_dict_t *dict,
const char *key,
pdfio_dict_t *value
);
.fi
.SS pdfioDictSetName
Set a key name in a dictionary.
.PP
.nf
bool pdfioDictSetName (
pdfio_dict_t *dict,
const char *key,
const char *value
);
.fi
.SS pdfioDictSetNull
Set a key null in a dictionary.
.PP
.nf
bool pdfioDictSetNull (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictSetNumber
Set a key number in a dictionary.
.PP
.nf
bool pdfioDictSetNumber (
pdfio_dict_t *dict,
const char *key,
double value
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioDictSetObj
2021-05-30 03:21:45 +02:00
Set a key indirect object reference in a dictionary.
.PP
.nf
2021-06-07 14:34:30 +02:00
bool pdfioDictSetObj (
2021-05-30 03:21:45 +02:00
pdfio_dict_t *dict,
const char *key,
pdfio_obj_t *value
);
.fi
.SS pdfioDictSetRect
Set a key rectangle in a dictionary.
.PP
.nf
bool pdfioDictSetRect (
pdfio_dict_t *dict,
const char *key,
pdfio_rect_t *value
);
.fi
.SS pdfioDictSetString
Set a key literal string in a dictionary.
.PP
.nf
bool pdfioDictSetString (
pdfio_dict_t *dict,
const char *key,
const char *value
);
.fi
.SS pdfioDictSetStringf
Set a key formatted string in a dictionary.
.PP
.nf
bool pdfioDictSetStringf (
pdfio_dict_t *dict,
const char *key,
const char *format,
...
);
.fi
.SS pdfioFileClose
Close a PDF file and free all memory used for it.
.PP
.nf
bool pdfioFileClose (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileCreate
Create a PDF file.
.PP
.nf
pdfio_file_t * pdfioFileCreate (
const char *filename,
const char *version,
pdfio_rect_t *media_box,
pdfio_rect_t *crop_box,
pdfio_error_cb_t error_cb,
void *error_data
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioFileCreateArrayObj
Create a new object in a PDF file containing an array.
.PP
.nf
pdfio_obj_t * pdfioFileCreateArrayObj (
pdfio_file_t *pdf,
pdfio_array_t *array
);
.fi
.PP
This function creates a new object with an array value in a PDF file.
You must call \fI pdfioObjClose\fR to write the object to the file.
.SS pdfioFileCreateFontObjFromBase
2021-06-07 14:34:30 +02:00
Create one of the base 14 PDF fonts.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_obj_t * pdfioFileCreateFontObjFromBase (
2021-06-07 14:34:30 +02:00
pdfio_file_t *pdf,
const char *name
);
.fi
.PP
This function creates one of the base 14 PDF fonts. The "name" parameter
specifies the font nane:
.PP
.IP \(bu 5
\fB Courier\fR
.IP \(bu 5
\fB Courier-Bold\fR
.IP \(bu 5
\fB Courier-BoldItalic\fR
.IP \(bu 5
\fB Courier-Italic\fR
.IP \(bu 5
\fB Helvetica\fR
.IP \(bu 5
\fB Helvetica-Bold\fR
.IP \(bu 5
\fB Helvetica-BoldOblique\fR
.IP \(bu 5
\fB Helvetica-Oblique\fR
.IP \(bu 5
\fB Symbol\fR
.IP \(bu 5
\fB Times-Bold\fR
.IP \(bu 5
\fB Times-BoldItalic\fR
.IP \(bu 5
\fB Times-Italic\fR
.IP \(bu 5
\fB Times-Roman\fR
.IP \(bu 5
2021-07-08 04:06:25 +02:00
\fB ZapfDingbats\fR
.PP
Base fonts always use the Windows CP1252 (ISO-8859-1 with additional
characters such as the Euro symbol) subset of Unicode.
.SS pdfioFileCreateFontObjFromFile
2021-05-30 03:21:45 +02:00
Add a font object to a PDF file.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_obj_t * pdfioFileCreateFontObjFromFile (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
2021-06-07 14:34:30 +02:00
const char *filename,
bool unicode
2021-05-30 03:21:45 +02:00
);
.fi
2021-07-08 04:06:25 +02:00
.PP
This function embeds a TrueType/OpenType font into a PDF file. The
"unicode" parameter controls whether the font is encoded for two-byte
characters (potentially full Unicode, but more typically a subset)
or to only support the Windows CP1252 (ISO-8859-1 with additional
characters such as the Euro symbol) subset of Unicode.
.SS pdfioFileCreateICCObjFromFile
2021-05-30 03:21:45 +02:00
Add an ICC profile object to a PDF file.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_obj_t * pdfioFileCreateICCObjFromFile (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
2021-07-08 04:06:25 +02:00
const char *filename,
size_t num_colors
2021-05-30 03:21:45 +02:00
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioFileCreateImageObjFromFile
2021-05-30 03:21:45 +02:00
Add an image object to a PDF file.
.PP
.nf
2021-07-08 04:06:25 +02:00
pdfio_obj_t * pdfioFileCreateImageObjFromFile (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
const char *filename,
bool interpolate
);
.fi
.PP
2021-07-08 04:06:25 +02:00
This function creates an image object in a PDF file from a JPEG or PNG file.
.PP
.IP 5
Note: Currently PNG support is limited to grayscale, RGB, or indexed files
.IP 5
without interlacing or alpha. Transparency (masking) based on color/index
.IP 5
is supported.
2021-06-07 14:34:30 +02:00
.SS pdfioFileCreateObj
2021-05-30 03:21:45 +02:00
Create a new object in a PDF file.
.PP
.nf
2021-06-07 14:34:30 +02:00
pdfio_obj_t * pdfioFileCreateObj (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
pdfio_dict_t *dict
);
.fi
.SS pdfioFileCreatePage
Create a page in a PDF file.
.PP
.nf
pdfio_stream_t * pdfioFileCreatePage (
pdfio_file_t *pdf,
pdfio_dict_t *dict
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioFileFindObj
2021-05-30 03:21:45 +02:00
Find an object using its object number.
.PP
.nf
2021-06-07 14:34:30 +02:00
pdfio_obj_t * pdfioFileFindObj (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
size_t number
);
.fi
.PP
2021-06-07 14:34:30 +02:00
This differs from \fI pdfioFileGetObj\fR which takes an index into the
2021-05-30 03:21:45 +02:00
list of objects while this function takes the object number.
2021-07-08 04:06:25 +02:00
.SS pdfioFileGetAuthor
Get the author for a PDF file.
.PP
.nf
const char * pdfioFileGetAuthor (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetCreationDate
Get the creation date for a PDF file.
.PP
.nf
time_t pdfioFileGetCreationDate (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetCreator
Get the creator string for a PDF file.
.PP
.nf
const char * pdfioFileGetCreator (
pdfio_file_t *pdf
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioFileGetID
Get the PDF file's ID strings.
.PP
.nf
pdfio_array_t * pdfioFileGetID (
pdfio_file_t *pdf
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioFileGetKeywords
Get the keywords for a PDF file.
.PP
.nf
const char * pdfioFileGetKeywords (
pdfio_file_t *pdf
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioFileGetName
Get a PDF's filename.
.PP
.nf
const char * pdfioFileGetName (
pdfio_file_t *pdf
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioFileGetNumObjs
2021-05-30 03:21:45 +02:00
Get the number of objects in a PDF file.
.PP
.nf
2021-06-07 14:34:30 +02:00
size_t pdfioFileGetNumObjs (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetNumPages
Get the number of pages in a PDF file.
.PP
.nf
size_t pdfioFileGetNumPages (
pdfio_file_t *pdf
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioFileGetObj
2021-05-30 03:21:45 +02:00
Get an object from a PDF file.
.PP
.nf
2021-06-07 14:34:30 +02:00
pdfio_obj_t * pdfioFileGetObj (
2021-05-30 03:21:45 +02:00
pdfio_file_t *pdf,
size_t n
);
.fi
.SS pdfioFileGetPage
Get a page object from a PDF file.
.PP
.nf
pdfio_obj_t * pdfioFileGetPage (
pdfio_file_t *pdf,
size_t n
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioFileGetProducer
Get the producer string for a PDF file.
.PP
.nf
const char * pdfioFileGetProducer (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetSubject
Get the subject for a PDF file.
.PP
.nf
const char * pdfioFileGetSubject (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetTitle
Get the title for a PDF file.
.PP
.nf
const char * pdfioFileGetTitle (
pdfio_file_t *pdf
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioFileGetVersion
Get the PDF version number for a PDF file.
.PP
.nf
const char * pdfioFileGetVersion (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileOpen
Open a PDF file for reading.
.PP
.nf
pdfio_file_t * pdfioFileOpen (
const char *filename,
pdfio_error_cb_t error_cb,
void *error_data
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioFileSetAuthor
Set the author for a PDF file.
.PP
.nf
void pdfioFileSetAuthor (
pdfio_file_t *pdf,
const char *value
);
.fi
.SS pdfioFileSetCreationDate
Set the creation date for a PDF file.
.PP
.nf
void pdfioFileSetCreationDate (
pdfio_file_t *pdf,
time_t value
);
.fi
.SS pdfioFileSetCreator
Set the creator string for a PDF file.
.PP
.nf
void pdfioFileSetCreator (
pdfio_file_t *pdf,
const char *value
);
.fi
.SS pdfioFileSetKeywords
Set the keywords string for a PDF file.
.PP
.nf
void pdfioFileSetKeywords (
pdfio_file_t *pdf,
const char *value
);
.fi
.SS pdfioFileSetSubject
Set the subject for a PDF file.
.PP
.nf
void pdfioFileSetSubject (
pdfio_file_t *pdf,
const char *value
);
.fi
.SS pdfioFileSetTitle
Set the title for a PDF file.
.PP
.nf
void pdfioFileSetTitle (
pdfio_file_t *pdf,
const char *value
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioImageGetBytesPerLine
Get the number of bytes to read for each line.
.PP
.nf
size_t pdfioImageGetBytesPerLine (
pdfio_obj_t *obj
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioImageGetHeight
Get the height of an image object.
.PP
.nf
double pdfioImageGetHeight (
pdfio_obj_t *obj
);
.fi
.SS pdfioImageGetWidth
Get the width of an image object.
.PP
.nf
double pdfioImageGetWidth (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjClose
Close an object, writing any data as needed to the PDF
file.
.PP
.nf
bool pdfioObjClose (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjCopy
Copy an object to another PDF file.
.PP
.nf
pdfio_obj_t * pdfioObjCopy (
pdfio_file_t *pdf,
pdfio_obj_t *srcobj
);
.fi
.SS pdfioObjCreateStream
Create an object (data) stream for writing.
.PP
.nf
pdfio_stream_t * pdfioObjCreateStream (
pdfio_obj_t *obj,
pdfio_filter_t filter
);
.fi
.SS pdfioObjGetArray
Get the array associated with an object.
.PP
.nf
pdfio_array_t * pdfioObjGetArray (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjGetDict
Get the dictionary associated with an object.
.PP
.nf
pdfio_dict_t * pdfioObjGetDict (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjGetGeneration
Get the object's generation number.
.PP
.nf
unsigned short pdfioObjGetGeneration (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjGetLength
Get the length of the object's (data) stream.
.PP
.nf
size_t pdfioObjGetLength (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjGetNumber
Get the object's number.
.PP
.nf
size_t pdfioObjGetNumber (
pdfio_obj_t *obj
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioObjGetSubtype
Get an object's subtype.
.PP
.nf
const char * pdfioObjGetSubtype (
pdfio_obj_t *obj
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioObjGetType
Get an object's type.
.PP
.nf
const char * pdfioObjGetType (
pdfio_obj_t *obj
);
.fi
.SS pdfioObjOpenStream
Open an object's (data) stream for reading.
.PP
.nf
pdfio_stream_t * pdfioObjOpenStream (
pdfio_obj_t *obj,
bool decode
);
.fi
.SS pdfioPageCopy
Copy a page to a PDF file.
.PP
.nf
bool pdfioPageCopy (
pdfio_file_t *pdf,
pdfio_obj_t *srcpage
);
.fi
2021-06-07 14:34:30 +02:00
.SS pdfioPageDictAddColorSpace
Add a color space to the page dictionary.
2021-05-30 03:21:45 +02:00
.PP
.nf
2021-06-07 14:34:30 +02:00
bool pdfioPageDictAddColorSpace (
2021-05-30 03:21:45 +02:00
pdfio_dict_t *dict,
const char *name,
2021-06-07 14:34:30 +02:00
pdfio_array_t *data
2021-05-30 03:21:45 +02:00
);
.fi
2021-06-07 14:34:30 +02:00
.PP
This function adds a named color space to the page dictionary.
.PP
The names "DefaultCMYK", "DefaultGray", and "DefaultRGB" specify the default
device color space used for the page.
.PP
The "data" array contains a calibrated, indexed, or ICC-based color space
array that was created using the
\fI pdfioArrayCreateCalibratedColorFromMatrix\fR ,
\fI pdfioArrayCreateCalibratedColorFromPrimaries\fR ,
\fI pdfioArrayCreateICCBasedColor\fR , or
\fI pdfioArrayCreateIndexedColor\fR functions.
2021-05-30 03:21:45 +02:00
.SS pdfioPageDictAddFont
Add a font object to the page dictionary.
.PP
.nf
bool pdfioPageDictAddFont (
pdfio_dict_t *dict,
const char *name,
pdfio_obj_t *obj
);
.fi
.SS pdfioPageDictAddImage
Add an image object to the page dictionary.
.PP
.nf
bool pdfioPageDictAddImage (
pdfio_dict_t *dict,
const char *name,
pdfio_obj_t *obj
);
.fi
.SS pdfioStreamClose
Close a (data) stream in a PDF file.
.PP
.nf
bool pdfioStreamClose (
pdfio_stream_t *st
);
.fi
.SS pdfioStreamConsume
Consume bytes from the stream.
.PP
.nf
bool pdfioStreamConsume (
pdfio_stream_t *st,
size_t bytes
);
.fi
.SS pdfioStreamGetToken
Read a single PDF token from a stream.
.PP
.nf
bool pdfioStreamGetToken (
pdfio_stream_t *st,
char *buffer,
size_t bufsize
);
.fi
.SS pdfioStreamPeek
Peek at data in a stream.
.PP
.nf
ssize_t pdfioStreamPeek (
pdfio_stream_t *st,
void *buffer,
size_t bytes
);
.fi
.SS pdfioStreamPrintf
Write a formatted string to a stream.
.PP
.nf
bool pdfioStreamPrintf (
pdfio_stream_t *st,
const char *format,
...
);
.fi
2021-07-08 04:06:25 +02:00
.SS pdfioStreamPutChar
Write a single character to a stream.
.PP
.nf
bool pdfioStreamPutChar (
pdfio_stream_t *st,
int ch
);
.fi
2021-05-30 03:21:45 +02:00
.SS pdfioStreamPuts
Write a literal string to a stream.
.PP
.nf
bool pdfioStreamPuts (
pdfio_stream_t *st,
const char *s
);
.fi
.SS pdfioStreamRead
Read data from a stream.
.PP
.nf
ssize_t pdfioStreamRead (
pdfio_stream_t *st,
void *buffer,
size_t bytes
);
.fi
2021-06-07 14:34:30 +02:00
.PP
This function reads data from a stream. When reading decoded image data
from a stream, you \fI must\fR read whole scanlines. The
\fI pdfioImageGetBytesPerLine\fR function can be used to determine the
proper read length.
2021-05-30 03:21:45 +02:00
.SS pdfioStreamWrite
Write data to a stream.
.PP
.nf
bool pdfioStreamWrite (
pdfio_stream_t *st,
const void *buffer,
size_t bytes
);
.fi
.SS pdfioStringCreate
Create a durable literal string.
.PP
.nf
char * pdfioStringCreate (
pdfio_file_t *pdf,
const char *s
);
.fi
.PP
This function creates a literal string associated with the PDF file
2021-06-07 23:06:13 +02:00
"pdf". The "s" string points to a nul-terminated C string.
2021-05-30 03:21:45 +02:00
.PP
\fB NULL\fR is returned on error, otherwise a \fB char *\fR that is valid until
\fB pdfioFileClose\fR is called.
.SS pdfioStringCreatef
Create a durable formatted string.
.PP
.nf
char * pdfioStringCreatef (
pdfio_file_t *pdf,
const char *format,
...
);
.fi
.PP
This function creates a formatted string associated with the PDF file
2021-06-07 23:06:13 +02:00
"pdf". The "format" string contains \fB printf\fR -style format characters.
2021-05-30 03:21:45 +02:00
.PP
\fB NULL\fR is returned on error, otherwise a \fB char *\fR that is valid until
\fB pdfioFileClose\fR is called.
2021-07-08 04:06:25 +02:00
.SS ttfCreate
Create a new font object for the named font family.
.PP
.nf
ttf_t * ttfCreate (
const char *filename,
size_t idx,
ttf_err_cb_t err_cb,
void *err_data
);
.fi
.SS ttfDelete
Free all memory used for a font family object.
.PP
.nf
void ttfDelete (
ttf_t *font
);
.fi
.SS ttfGetAscent
Get the maximum height of non-accented characters.
.PP
.nf
int ttfGetAscent (
ttf_t *font
);
.fi
.SS ttfGetBounds
Get the bounds of all characters in a font.
.PP
.nf
ttf_rect_t * ttfGetBounds (
ttf_t *font,
ttf_rect_t *bounds
);
.fi
.SS ttfGetCMap
Get the Unicode to glyph mapping table.
.PP
.nf
const int * ttfGetCMap (
ttf_t *font,
size_t *num_cmap
);
.fi
.SS ttfGetCapHeight
Get the height of capital letters.
.PP
.nf
int ttfGetCapHeight (
ttf_t *font
);
.fi
.SS ttfGetCopyright
Get the copyright text for a font.
.PP
.nf
const char * ttfGetCopyright (
ttf_t *font
);
.fi
.SS ttfGetDescent
Get the maximum depth of non-accented characters.
.PP
.nf
int ttfGetDescent (
ttf_t *font
);
.fi
.SS ttfGetExtents
Get the extents of a UTF-8 string.
.PP
.nf
ttf_rect_t * ttfGetExtents (
ttf_t *font,
float size,
const char *s,
ttf_rect_t *extents
);
.fi
.PP
This function computes the extents of a UTF-8 string when rendered using the
specified font and size.
.SS ttfGetFamily
Get the family name of a font.
.PP
.nf
const char * ttfGetFamily (
ttf_t *font
);
.fi
.SS ttfGetItalicAngle
Get the italic angle.
.PP
.nf
float ttfGetItalicAngle (
ttf_t *font
);
.fi
.SS ttfGetMaxChar
Get the last character in the font.
.PP
.nf
int ttfGetMaxChar (
ttf_t *font
);
.fi
.SS ttfGetMinChar
Get the first character in the font.
.PP
.nf
int ttfGetMinChar (
ttf_t *font
);
.fi
.SS ttfGetNumFonts
Get the number of fonts in this collection.
.PP
.nf
size_t ttfGetNumFonts (
ttf_t *font
);
.fi
.SS ttfGetPostScriptName
Get the PostScript name of a font.
.PP
.nf
const char * ttfGetPostScriptName (
ttf_t *font
);
.fi
.SS ttfGetStretch
Get the font "stretch" value...
.PP
.nf
ttf_stretch_t ttfGetStretch (
ttf_t *font
);
.fi
.SS ttfGetStyle
Get the font style.
.PP
.nf
ttf_style_t ttfGetStyle (
ttf_t *font
);
.fi
.SS ttfGetVersion
Get the version number of a font.
.PP
.nf
const char * ttfGetVersion (
ttf_t *font
);
.fi
.SS ttfGetWeight
Get the weight of a font.
.PP
.nf
ttf_weight_t ttfGetWeight (
ttf_t *font
);
.fi
.SS ttfGetWidth
Get the width of a single character.
.PP
.nf
int ttfGetWidth (
ttf_t *font,
int ch
);
.fi
.SS ttfGetXHeight
Get the height of lowercase letters.
.PP
.nf
int ttfGetXHeight (
ttf_t *font
);
.fi
.SS ttfIsFixedPitch
Determine whether a font is fixedpitch.
.PP
.nf
bool ttfIsFixedPitch (
ttf_t *font
);
.fi
2021-05-30 03:21:45 +02:00
.SH STRUCTURES
.SS pdfio_rect_s
PDF rectangle
.PP
.nf
struct pdfio_rect_s
{
double x1;
double x2;
double y1;
double y2;
};
.fi
.SH TYPES
.SS pdfio_array_t
Array of PDF values
.PP
.nf
typedef struct _pdfio_array_s pdfio_array_t;
.fi
.SS pdfio_dict_t
Key/value dictionary
.PP
.nf
typedef struct _pdfio_dict_s pdfio_dict_t;
.fi
.SS pdfio_error_cb_t
Error callback
.PP
.nf
typedef bool(*)(pdfio_file_t *pdf, const char *message, void *data) pdfio_error_cb_t;
.fi
.SS pdfio_file_t
PDF file
.PP
.nf
typedef struct _pdfio_file_s pdfio_file_t;
.fi
.SS pdfio_filter_t
Compression/decompression filters for streams
.PP
.nf
typedef enum pdfio_filter_e pdfio_filter_t;
.fi
.SS pdfio_obj_t
Numbered object in PDF file
.PP
.nf
typedef struct _pdfio_obj_s pdfio_obj_t;
.fi
.SS pdfio_rect_t
PDF rectangle
.PP
.nf
typedef struct pdfio_rect_s pdfio_rect_t;
.fi
.SS pdfio_stream_t
Object data stream in PDF file
.PP
.nf
typedef struct _pdfio_stream_s pdfio_stream_t;
.fi
.SS pdfio_valtype_t
PDF value types
.PP
.nf
typedef enum pdfio_valtype_e pdfio_valtype_t;
.fi
2021-07-08 04:06:25 +02:00
.SS ssize_t
POSIX type not present on Windows...
.PP
.nf
typedef __int64 ssize_t;
.fi
2021-05-30 03:21:45 +02:00
.SH AUTHOR
.PP
Michael R Sweet
.SH COPYRIGHT
.PP
Copyright (c) 2021 by Michael R Sweet