Implement date value support (Issue #13)

This commit is contained in:
Michael R Sweet 2021-07-07 22:06:25 -04:00
parent 43b5e03c71
commit d62faa51e1
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
7 changed files with 1225 additions and 105 deletions

View File

@ -1,4 +1,4 @@
.TH pdfio 3 "pdf read/write library" "2021-06-07" "pdf read/write library" .TH pdfio 3 "pdf read/write library" "2021-07-07" "pdf read/write library"
.SH NAME .SH NAME
pdfio \- pdf read/write library pdfio \- pdf read/write library
.SH Introduction .SH Introduction
@ -424,6 +424,15 @@ bool pdfioArrayAppendBoolean (
bool value bool value
); );
.fi .fi
.SS pdfioArrayAppendDate
Add a date value to an array.
.PP
.nf
bool pdfioArrayAppendDate (
pdfio_array_t *a,
time_t value
);
.fi
.SS pdfioArrayAppendDict .SS pdfioArrayAppendDict
Add a dictionary to an array. Add a dictionary to an array.
.PP .PP
@ -486,11 +495,20 @@ pdfio_array_t * pdfioArrayCreate (
pdfio_file_t *pdf pdfio_file_t *pdf
); );
.fi .fi
.SS pdfioArrayCreateCalibratedColorFromMatrix .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
Create a calibrated color space array using a CIE XYZ transform matrix. Create a calibrated color space array using a CIE XYZ transform matrix.
.PP .PP
.nf .nf
pdfio_array_t * pdfioArrayCreateCalibratedColorFromMatrix ( pdfio_array_t * pdfioArrayCreateColorFromMatrix (
pdfio_file_t *pdf, pdfio_file_t *pdf,
size_t num_colors, size_t num_colors,
double gamma, double gamma,
@ -498,11 +516,21 @@ pdfio_array_t * pdfioArrayCreateCalibratedColorFromMatrix (
const double white_point[3] const double white_point[3]
); );
.fi .fi
.SS pdfioArrayCreateCalibratedColorFromPrimaries .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
Create a calibrated color sapce array using CIE xy primary chromacities. Create a calibrated color sapce array using CIE xy primary chromacities.
.PP .PP
.nf .nf
pdfio_array_t * pdfioArrayCreateCalibratedColorFromPrimaries ( pdfio_array_t * pdfioArrayCreateColorFromPrimaries (
pdfio_file_t *pdf, pdfio_file_t *pdf,
size_t num_colors, size_t num_colors,
double gamma, double gamma,
@ -516,25 +544,6 @@ pdfio_array_t * pdfioArrayCreateCalibratedColorFromPrimaries (
double by double by
); );
.fi .fi
.SS pdfioArrayCreateICCBasedColor
Create an ICC-based color space array.
.PP
.nf
pdfio_array_t * pdfioArrayCreateICCBasedColor (
pdfio_file_t *pdf,
pdfio_obj_t *icc_object
);
.fi
.SS pdfioArrayCreateIndexedColor
Create an indexed color space array.
.PP
.nf
pdfio_array_t * pdfioArrayCreateIndexedColor (
pdfio_file_t *pdf,
size_t num_colors,
const unsigned char *colors
);
.fi
.SS pdfioArrayGetArray .SS pdfioArrayGetArray
Get an array value from an array. Get an array value from an array.
.PP .PP
@ -563,6 +572,15 @@ bool pdfioArrayGetBoolean (
size_t n size_t n
); );
.fi .fi
.SS pdfioArrayGetDate
Get a date value from an array.
.PP
.nf
time_t pdfioArrayGetDate (
pdfio_array_t *a,
size_t n
);
.fi
.SS pdfioArrayGetDict .SS pdfioArrayGetDict
Get a dictionary value from an array. Get a dictionary value from an array.
.PP .PP
@ -1110,26 +1128,37 @@ Show text.
.nf .nf
bool pdfioContentTextShow ( bool pdfioContentTextShow (
pdfio_stream_t *st, pdfio_stream_t *st,
bool unicode,
const char *s const char *s
); );
.fi .fi
.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.
.SS pdfioContentTextShowJustified .SS pdfioContentTextShowJustified
Show justified text. Show justified text.
.PP .PP
.nf .nf
bool pdfioContentTextShowJustified ( bool pdfioContentTextShowJustified (
pdfio_stream_t *st, pdfio_stream_t *st,
bool unicode,
size_t num_fragments, size_t num_fragments,
const double *offsets, const double *offsets,
const char *const *fragments const char *const *fragments
); );
.fi .fi
.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.
.SS pdfioContentTextShowf .SS pdfioContentTextShowf
.PP .PP
.nf .nf
bool pdfioContentTextShowf ( bool pdfioContentTextShowf (
pdfio_stream_t *st, pdfio_stream_t *st,
bool unicode,
const char *format, const char *format,
... ...
); );
@ -1179,6 +1208,15 @@ bool pdfioDictGetBoolean (
const char *key const char *key
); );
.fi .fi
.SS pdfioDictGetDate
Get a date value from a dictionary.
.PP
.nf
time_t pdfioDictGetDate (
pdfio_dict_t *dict,
const char *key
);
.fi
.SS pdfioDictGetDict .SS pdfioDictGetDict
Get a key dictionary value from a dictionary. Get a key dictionary value from a dictionary.
.PP .PP
@ -1274,6 +1312,16 @@ bool pdfioDictSetBoolean (
bool value bool value
); );
.fi .fi
.SS pdfioDictSetDate
Set a date value in a dictionary.
.PP
.nf
bool pdfioDictSetDate (
pdfio_dict_t *dict,
const char *key,
time_t value
);
.fi
.SS pdfioDictSetDict .SS pdfioDictSetDict
Set a key dictionary in a dictionary. Set a key dictionary in a dictionary.
.PP .PP
@ -1375,11 +1423,23 @@ pdfio_file_t * pdfioFileCreate (
void *error_data void *error_data
); );
.fi .fi
.SS pdfioFileCreateBaseFontObj .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 \fIpdfioObjClose\fR to write the object to the file.
.SS pdfioFileCreateFontObjFromBase
Create one of the base 14 PDF fonts. Create one of the base 14 PDF fonts.
.PP .PP
.nf .nf
pdfio_obj_t * pdfioFileCreateBaseFontObj ( pdfio_obj_t * pdfioFileCreateFontObjFromBase (
pdfio_file_t *pdf, pdfio_file_t *pdf,
const char *name const char *name
); );
@ -1415,39 +1475,55 @@ specifies the font nane:
.IP \(bu 5 .IP \(bu 5
\fBTimes-Roman\fR \fBTimes-Roman\fR
.IP \(bu 5 .IP \(bu 5
\fBZapfDingbats\fR</li> \fBZapfDingbats\fR
</ul> .PP
.SS pdfioFileCreateFontObj Base fonts always use the Windows CP1252 (ISO-8859-1 with additional
characters such as the Euro symbol) subset of Unicode.
.SS pdfioFileCreateFontObjFromFile
Add a font object to a PDF file. Add a font object to a PDF file.
.PP .PP
.nf .nf
pdfio_obj_t * pdfioFileCreateFontObj ( pdfio_obj_t * pdfioFileCreateFontObjFromFile (
pdfio_file_t *pdf, pdfio_file_t *pdf,
const char *filename, const char *filename,
bool unicode bool unicode
); );
.fi .fi
.SS pdfioFileCreateICCProfileObj .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
Add an ICC profile object to a PDF file. Add an ICC profile object to a PDF file.
.PP .PP
.nf .nf
pdfio_obj_t * pdfioFileCreateICCProfileObj ( pdfio_obj_t * pdfioFileCreateICCObjFromFile (
pdfio_file_t *pdf, pdfio_file_t *pdf,
const char *filename const char *filename,
size_t num_colors
); );
.fi .fi
.SS pdfioFileCreateImageObj .SS pdfioFileCreateImageObjFromFile
Add an image object to a PDF file. Add an image object to a PDF file.
.PP .PP
.nf .nf
pdfio_obj_t * pdfioFileCreateImageObj ( pdfio_obj_t * pdfioFileCreateImageObjFromFile (
pdfio_file_t *pdf, pdfio_file_t *pdf,
const char *filename, const char *filename,
bool interpolate bool interpolate
); );
.fi .fi
.PP .PP
Currently only GIF, JPEG, and PNG files are supported. 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.
.SS pdfioFileCreateObj .SS pdfioFileCreateObj
Create a new object in a PDF file. Create a new object in a PDF file.
.PP .PP
@ -1478,6 +1554,30 @@ pdfio_obj_t * pdfioFileFindObj (
.PP .PP
This differs from \fIpdfioFileGetObj\fR which takes an index into the This differs from \fIpdfioFileGetObj\fR which takes an index into the
list of objects while this function takes the object number. list of objects while this function takes the object number.
.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
.SS pdfioFileGetID .SS pdfioFileGetID
Get the PDF file's ID strings. Get the PDF file's ID strings.
.PP .PP
@ -1486,6 +1586,14 @@ pdfio_array_t * pdfioFileGetID (
pdfio_file_t *pdf pdfio_file_t *pdf
); );
.fi .fi
.SS pdfioFileGetKeywords
Get the keywords for a PDF file.
.PP
.nf
const char * pdfioFileGetKeywords (
pdfio_file_t *pdf
);
.fi
.SS pdfioFileGetName .SS pdfioFileGetName
Get a PDF's filename. Get a PDF's filename.
.PP .PP
@ -1528,6 +1636,30 @@ pdfio_obj_t * pdfioFileGetPage (
size_t n size_t n
); );
.fi .fi
.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
.SS pdfioFileGetVersion .SS pdfioFileGetVersion
Get the PDF version number for a PDF file. Get the PDF version number for a PDF file.
.PP .PP
@ -1546,6 +1678,60 @@ pdfio_file_t * pdfioFileOpen (
void *error_data void *error_data
); );
.fi .fi
.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
.SS pdfioImageGetBytesPerLine .SS pdfioImageGetBytesPerLine
Get the number of bytes to read for each line. Get the number of bytes to read for each line.
.PP .PP
@ -1760,6 +1946,15 @@ bool pdfioStreamPrintf (
... ...
); );
.fi .fi
.SS pdfioStreamPutChar
Write a single character to a stream.
.PP
.nf
bool pdfioStreamPutChar (
pdfio_stream_t *st,
int ch
);
.fi
.SS pdfioStreamPuts .SS pdfioStreamPuts
Write a literal string to a stream. Write a literal string to a stream.
.PP .PP
@ -1825,6 +2020,194 @@ This function creates a formatted string associated with the PDF file
.PP .PP
\fBNULL\fR is returned on error, otherwise a \fBchar *\fR that is valid until \fBNULL\fR is returned on error, otherwise a \fBchar *\fR that is valid until
\fBpdfioFileClose\fR is called. \fBpdfioFileClose\fR is called.
.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
.SH STRUCTURES .SH STRUCTURES
.SS pdfio_rect_s .SS pdfio_rect_s
PDF rectangle PDF rectangle
@ -1893,6 +2276,12 @@ PDF value types
.nf .nf
typedef enum pdfio_valtype_e pdfio_valtype_t; typedef enum pdfio_valtype_e pdfio_valtype_t;
.fi .fi
.SS ssize_t
POSIX type not present on Windows...
.PP
.nf
typedef __int64 ssize_t;
.fi
.SH AUTHOR .SH AUTHOR
.PP .PP
Michael R Sweet Michael R Sweet

View File

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-US"> <html lang="en-US">
<head> <head>
<title>PDFio Programming Manual v0.1</title> <title>PDFio Programming Manual v0.2</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="generator" content="codedoc v3.7"> <meta name="generator" content="codedoc v3.7">
<meta name="author" content="Michael R Sweet"> <meta name="author" content="Michael R Sweet">
<meta name="language" content="en-US"> <meta name="language" content="en-US">
<meta name="copyright" content="Copyright © 2021 by Michael R Sweet"> <meta name="copyright" content="Copyright © 2021 by Michael R Sweet">
<meta name="version" content="0.1"> <meta name="version" content="0.2">
<style type="text/css"><!-- <style type="text/css"><!--
body { body {
background: white; background: white;
@ -245,7 +245,7 @@ span.string {
<body> <body>
<div class="header"> <div class="header">
<p><img class="title" src="pdfio-512.png"></p> <p><img class="title" src="pdfio-512.png"></p>
<h1 class="title">PDFio Programming Manual v0.1</h1> <h1 class="title">PDFio Programming Manual v0.2</h1>
<p>Michael R Sweet</p> <p>Michael R Sweet</p>
<p>Copyright © 2021 by Michael R Sweet</p> <p>Copyright © 2021 by Michael R Sweet</p>
</div> </div>
@ -271,6 +271,7 @@ span.string {
<li><a href="#pdfioArrayAppendArray">pdfioArrayAppendArray</a></li> <li><a href="#pdfioArrayAppendArray">pdfioArrayAppendArray</a></li>
<li><a href="#pdfioArrayAppendBinary">pdfioArrayAppendBinary</a></li> <li><a href="#pdfioArrayAppendBinary">pdfioArrayAppendBinary</a></li>
<li><a href="#pdfioArrayAppendBoolean">pdfioArrayAppendBoolean</a></li> <li><a href="#pdfioArrayAppendBoolean">pdfioArrayAppendBoolean</a></li>
<li><a href="#pdfioArrayAppendDate">pdfioArrayAppendDate</a></li>
<li><a href="#pdfioArrayAppendDict">pdfioArrayAppendDict</a></li> <li><a href="#pdfioArrayAppendDict">pdfioArrayAppendDict</a></li>
<li><a href="#pdfioArrayAppendName">pdfioArrayAppendName</a></li> <li><a href="#pdfioArrayAppendName">pdfioArrayAppendName</a></li>
<li><a href="#pdfioArrayAppendNumber">pdfioArrayAppendNumber</a></li> <li><a href="#pdfioArrayAppendNumber">pdfioArrayAppendNumber</a></li>
@ -278,13 +279,14 @@ span.string {
<li><a href="#pdfioArrayAppendString">pdfioArrayAppendString</a></li> <li><a href="#pdfioArrayAppendString">pdfioArrayAppendString</a></li>
<li><a href="#pdfioArrayCopy">pdfioArrayCopy</a></li> <li><a href="#pdfioArrayCopy">pdfioArrayCopy</a></li>
<li><a href="#pdfioArrayCreate">pdfioArrayCreate</a></li> <li><a href="#pdfioArrayCreate">pdfioArrayCreate</a></li>
<li><a href="#pdfioArrayCreateCalibratedColorFromMatrix">pdfioArrayCreateCalibratedColorFromMatrix</a></li> <li><a href="#pdfioArrayCreateColorFromICCObj">pdfioArrayCreateColorFromICCObj</a></li>
<li><a href="#pdfioArrayCreateCalibratedColorFromPrimaries">pdfioArrayCreateCalibratedColorFromPrimaries</a></li> <li><a href="#pdfioArrayCreateColorFromMatrix">pdfioArrayCreateColorFromMatrix</a></li>
<li><a href="#pdfioArrayCreateICCBasedColor">pdfioArrayCreateICCBasedColor</a></li> <li><a href="#pdfioArrayCreateColorFromPalette">pdfioArrayCreateColorFromPalette</a></li>
<li><a href="#pdfioArrayCreateIndexedColor">pdfioArrayCreateIndexedColor</a></li> <li><a href="#pdfioArrayCreateColorFromPrimaries">pdfioArrayCreateColorFromPrimaries</a></li>
<li><a href="#pdfioArrayGetArray">pdfioArrayGetArray</a></li> <li><a href="#pdfioArrayGetArray">pdfioArrayGetArray</a></li>
<li><a href="#pdfioArrayGetBinary">pdfioArrayGetBinary</a></li> <li><a href="#pdfioArrayGetBinary">pdfioArrayGetBinary</a></li>
<li><a href="#pdfioArrayGetBoolean">pdfioArrayGetBoolean</a></li> <li><a href="#pdfioArrayGetBoolean">pdfioArrayGetBoolean</a></li>
<li><a href="#pdfioArrayGetDate">pdfioArrayGetDate</a></li>
<li><a href="#pdfioArrayGetDict">pdfioArrayGetDict</a></li> <li><a href="#pdfioArrayGetDict">pdfioArrayGetDict</a></li>
<li><a href="#pdfioArrayGetName">pdfioArrayGetName</a></li> <li><a href="#pdfioArrayGetName">pdfioArrayGetName</a></li>
<li><a href="#pdfioArrayGetNumber">pdfioArrayGetNumber</a></li> <li><a href="#pdfioArrayGetNumber">pdfioArrayGetNumber</a></li>
@ -349,6 +351,7 @@ span.string {
<li><a href="#pdfioDictGetArray">pdfioDictGetArray</a></li> <li><a href="#pdfioDictGetArray">pdfioDictGetArray</a></li>
<li><a href="#pdfioDictGetBinary">pdfioDictGetBinary</a></li> <li><a href="#pdfioDictGetBinary">pdfioDictGetBinary</a></li>
<li><a href="#pdfioDictGetBoolean">pdfioDictGetBoolean</a></li> <li><a href="#pdfioDictGetBoolean">pdfioDictGetBoolean</a></li>
<li><a href="#pdfioDictGetDate">pdfioDictGetDate</a></li>
<li><a href="#pdfioDictGetDict">pdfioDictGetDict</a></li> <li><a href="#pdfioDictGetDict">pdfioDictGetDict</a></li>
<li><a href="#pdfioDictGetName">pdfioDictGetName</a></li> <li><a href="#pdfioDictGetName">pdfioDictGetName</a></li>
<li><a href="#pdfioDictGetNumber">pdfioDictGetNumber</a></li> <li><a href="#pdfioDictGetNumber">pdfioDictGetNumber</a></li>
@ -359,6 +362,7 @@ span.string {
<li><a href="#pdfioDictSetArray">pdfioDictSetArray</a></li> <li><a href="#pdfioDictSetArray">pdfioDictSetArray</a></li>
<li><a href="#pdfioDictSetBinary">pdfioDictSetBinary</a></li> <li><a href="#pdfioDictSetBinary">pdfioDictSetBinary</a></li>
<li><a href="#pdfioDictSetBoolean">pdfioDictSetBoolean</a></li> <li><a href="#pdfioDictSetBoolean">pdfioDictSetBoolean</a></li>
<li><a href="#pdfioDictSetDate">pdfioDictSetDate</a></li>
<li><a href="#pdfioDictSetDict">pdfioDictSetDict</a></li> <li><a href="#pdfioDictSetDict">pdfioDictSetDict</a></li>
<li><a href="#pdfioDictSetName">pdfioDictSetName</a></li> <li><a href="#pdfioDictSetName">pdfioDictSetName</a></li>
<li><a href="#pdfioDictSetNull">pdfioDictSetNull</a></li> <li><a href="#pdfioDictSetNull">pdfioDictSetNull</a></li>
@ -369,21 +373,35 @@ span.string {
<li><a href="#pdfioDictSetStringf">pdfioDictSetStringf</a></li> <li><a href="#pdfioDictSetStringf">pdfioDictSetStringf</a></li>
<li><a href="#pdfioFileClose">pdfioFileClose</a></li> <li><a href="#pdfioFileClose">pdfioFileClose</a></li>
<li><a href="#pdfioFileCreate">pdfioFileCreate</a></li> <li><a href="#pdfioFileCreate">pdfioFileCreate</a></li>
<li><a href="#pdfioFileCreateBaseFontObj">pdfioFileCreateBaseFontObj</a></li> <li><a href="#pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</a></li>
<li><a href="#pdfioFileCreateFontObj">pdfioFileCreateFontObj</a></li> <li><a href="#pdfioFileCreateFontObjFromBase">pdfioFileCreateFontObjFromBase</a></li>
<li><a href="#pdfioFileCreateICCProfileObj">pdfioFileCreateICCProfileObj</a></li> <li><a href="#pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></li>
<li><a href="#pdfioFileCreateImageObj">pdfioFileCreateImageObj</a></li> <li><a href="#pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></li>
<li><a href="#pdfioFileCreateImageObjFromFile">pdfioFileCreateImageObjFromFile</a></li>
<li><a href="#pdfioFileCreateObj">pdfioFileCreateObj</a></li> <li><a href="#pdfioFileCreateObj">pdfioFileCreateObj</a></li>
<li><a href="#pdfioFileCreatePage">pdfioFileCreatePage</a></li> <li><a href="#pdfioFileCreatePage">pdfioFileCreatePage</a></li>
<li><a href="#pdfioFileFindObj">pdfioFileFindObj</a></li> <li><a href="#pdfioFileFindObj">pdfioFileFindObj</a></li>
<li><a href="#pdfioFileGetAuthor">pdfioFileGetAuthor</a></li>
<li><a href="#pdfioFileGetCreationDate">pdfioFileGetCreationDate</a></li>
<li><a href="#pdfioFileGetCreator">pdfioFileGetCreator</a></li>
<li><a href="#pdfioFileGetID">pdfioFileGetID</a></li> <li><a href="#pdfioFileGetID">pdfioFileGetID</a></li>
<li><a href="#pdfioFileGetKeywords">pdfioFileGetKeywords</a></li>
<li><a href="#pdfioFileGetName">pdfioFileGetName</a></li> <li><a href="#pdfioFileGetName">pdfioFileGetName</a></li>
<li><a href="#pdfioFileGetNumObjs">pdfioFileGetNumObjs</a></li> <li><a href="#pdfioFileGetNumObjs">pdfioFileGetNumObjs</a></li>
<li><a href="#pdfioFileGetNumPages">pdfioFileGetNumPages</a></li> <li><a href="#pdfioFileGetNumPages">pdfioFileGetNumPages</a></li>
<li><a href="#pdfioFileGetObj">pdfioFileGetObj</a></li> <li><a href="#pdfioFileGetObj">pdfioFileGetObj</a></li>
<li><a href="#pdfioFileGetPage">pdfioFileGetPage</a></li> <li><a href="#pdfioFileGetPage">pdfioFileGetPage</a></li>
<li><a href="#pdfioFileGetProducer">pdfioFileGetProducer</a></li>
<li><a href="#pdfioFileGetSubject">pdfioFileGetSubject</a></li>
<li><a href="#pdfioFileGetTitle">pdfioFileGetTitle</a></li>
<li><a href="#pdfioFileGetVersion">pdfioFileGetVersion</a></li> <li><a href="#pdfioFileGetVersion">pdfioFileGetVersion</a></li>
<li><a href="#pdfioFileOpen">pdfioFileOpen</a></li> <li><a href="#pdfioFileOpen">pdfioFileOpen</a></li>
<li><a href="#pdfioFileSetAuthor">pdfioFileSetAuthor</a></li>
<li><a href="#pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></li>
<li><a href="#pdfioFileSetCreator">pdfioFileSetCreator</a></li>
<li><a href="#pdfioFileSetKeywords">pdfioFileSetKeywords</a></li>
<li><a href="#pdfioFileSetSubject">pdfioFileSetSubject</a></li>
<li><a href="#pdfioFileSetTitle">pdfioFileSetTitle</a></li>
<li><a href="#pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></li> <li><a href="#pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></li>
<li><a href="#pdfioImageGetHeight">pdfioImageGetHeight</a></li> <li><a href="#pdfioImageGetHeight">pdfioImageGetHeight</a></li>
<li><a href="#pdfioImageGetWidth">pdfioImageGetWidth</a></li> <li><a href="#pdfioImageGetWidth">pdfioImageGetWidth</a></li>
@ -407,11 +425,34 @@ span.string {
<li><a href="#pdfioStreamGetToken">pdfioStreamGetToken</a></li> <li><a href="#pdfioStreamGetToken">pdfioStreamGetToken</a></li>
<li><a href="#pdfioStreamPeek">pdfioStreamPeek</a></li> <li><a href="#pdfioStreamPeek">pdfioStreamPeek</a></li>
<li><a href="#pdfioStreamPrintf">pdfioStreamPrintf</a></li> <li><a href="#pdfioStreamPrintf">pdfioStreamPrintf</a></li>
<li><a href="#pdfioStreamPutChar">pdfioStreamPutChar</a></li>
<li><a href="#pdfioStreamPuts">pdfioStreamPuts</a></li> <li><a href="#pdfioStreamPuts">pdfioStreamPuts</a></li>
<li><a href="#pdfioStreamRead">pdfioStreamRead</a></li> <li><a href="#pdfioStreamRead">pdfioStreamRead</a></li>
<li><a href="#pdfioStreamWrite">pdfioStreamWrite</a></li> <li><a href="#pdfioStreamWrite">pdfioStreamWrite</a></li>
<li><a href="#pdfioStringCreate">pdfioStringCreate</a></li> <li><a href="#pdfioStringCreate">pdfioStringCreate</a></li>
<li><a href="#pdfioStringCreatef">pdfioStringCreatef</a></li> <li><a href="#pdfioStringCreatef">pdfioStringCreatef</a></li>
<li><a href="#ttfCreate">ttfCreate</a></li>
<li><a href="#ttfDelete">ttfDelete</a></li>
<li><a href="#ttfGetAscent">ttfGetAscent</a></li>
<li><a href="#ttfGetBounds">ttfGetBounds</a></li>
<li><a href="#ttfGetCMap">ttfGetCMap</a></li>
<li><a href="#ttfGetCapHeight">ttfGetCapHeight</a></li>
<li><a href="#ttfGetCopyright">ttfGetCopyright</a></li>
<li><a href="#ttfGetDescent">ttfGetDescent</a></li>
<li><a href="#ttfGetExtents">ttfGetExtents</a></li>
<li><a href="#ttfGetFamily">ttfGetFamily</a></li>
<li><a href="#ttfGetItalicAngle">ttfGetItalicAngle</a></li>
<li><a href="#ttfGetMaxChar">ttfGetMaxChar</a></li>
<li><a href="#ttfGetMinChar">ttfGetMinChar</a></li>
<li><a href="#ttfGetNumFonts">ttfGetNumFonts</a></li>
<li><a href="#ttfGetPostScriptName">ttfGetPostScriptName</a></li>
<li><a href="#ttfGetStretch">ttfGetStretch</a></li>
<li><a href="#ttfGetStyle">ttfGetStyle</a></li>
<li><a href="#ttfGetVersion">ttfGetVersion</a></li>
<li><a href="#ttfGetWeight">ttfGetWeight</a></li>
<li><a href="#ttfGetWidth">ttfGetWidth</a></li>
<li><a href="#ttfGetXHeight">ttfGetXHeight</a></li>
<li><a href="#ttfIsFixedPitch">ttfIsFixedPitch</a></li>
</ul></li> </ul></li>
<li><a href="#TYPES">Data Types</a><ul class="subcontents"> <li><a href="#TYPES">Data Types</a><ul class="subcontents">
<li><a href="#pdfio_array_t">pdfio_array_t</a></li> <li><a href="#pdfio_array_t">pdfio_array_t</a></li>
@ -423,6 +464,7 @@ span.string {
<li><a href="#pdfio_rect_t">pdfio_rect_t</a></li> <li><a href="#pdfio_rect_t">pdfio_rect_t</a></li>
<li><a href="#pdfio_stream_t">pdfio_stream_t</a></li> <li><a href="#pdfio_stream_t">pdfio_stream_t</a></li>
<li><a href="#pdfio_valtype_t">pdfio_valtype_t</a></li> <li><a href="#pdfio_valtype_t">pdfio_valtype_t</a></li>
<li><a href="#ssize_t">ssize_t</a></li>
</ul></li> </ul></li>
<li><a href="#STRUCTURES">Structures</a><ul class="subcontents"> <li><a href="#STRUCTURES">Structures</a><ul class="subcontents">
<li><a href="#pdfio_rect_s">pdfio_rect_s</a></li> <li><a href="#pdfio_rect_s">pdfio_rect_s</a></li>
@ -652,6 +694,19 @@ bool pdfioArrayAppendBoolean(<a href="#pdfio_array_t">pdfio_array_t</a> *a, bool
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p> <p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioArrayAppendDate">pdfioArrayAppendDate</a></h3>
<p class="description">Add a date value to an array.</p>
<p class="code">
bool pdfioArrayAppendDate(<a href="#pdfio_array_t">pdfio_array_t</a> *a, time_t value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>a</th>
<td class="description">Array</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioArrayAppendDict">pdfioArrayAppendDict</a></h3> <h3 class="function"><a id="pdfioArrayAppendDict">pdfioArrayAppendDict</a></h3>
<p class="description">Add a dictionary to an array.</p> <p class="description">Add a dictionary to an array.</p>
<p class="code"> <p class="code">
@ -741,10 +796,23 @@ bool pdfioArrayAppendString(<a href="#pdfio_array_t">pdfio_array_t</a> *a, const
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">New array or <code>NULL</code> on error</p> <p class="description">New array or <code>NULL</code> on error</p>
<h3 class="function"><a id="pdfioArrayCreateCalibratedColorFromMatrix">pdfioArrayCreateCalibratedColorFromMatrix</a></h3> <h3 class="function"><a id="pdfioArrayCreateColorFromICCObj">pdfioArrayCreateColorFromICCObj</a></h3>
<p class="description">Create an ICC-based color space array.</p>
<p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromICCObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_obj_t">pdfio_obj_t</a> *icc_object);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>icc_object</th>
<td class="description">ICC profile object</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Color array</p>
<h3 class="function"><a id="pdfioArrayCreateColorFromMatrix">pdfioArrayCreateColorFromMatrix</a></h3>
<p class="description">Create a calibrated color space array using a CIE XYZ transform matrix.</p> <p class="description">Create a calibrated color space array using a CIE XYZ transform matrix.</p>
<p class="code"> <p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateCalibratedColorFromMatrix(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, double gamma, const double matrix[3][3], const double white_point[3]);</p> <a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromMatrix(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, double gamma, const double matrix[3][3], const double white_point[3]);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
@ -760,10 +828,25 @@ bool pdfioArrayAppendString(<a href="#pdfio_array_t">pdfio_array_t</a> *a, const
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Color space array</p> <p class="description">Color space array</p>
<h3 class="function"><a id="pdfioArrayCreateCalibratedColorFromPrimaries">pdfioArrayCreateCalibratedColorFromPrimaries</a></h3> <h3 class="function"><a id="pdfioArrayCreateColorFromPalette">pdfioArrayCreateColorFromPalette</a></h3>
<p class="description">Create an indexed color space array.</p>
<p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromPalette(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, const unsigned char *colors);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>num_colors</th>
<td class="description">Number of colors</td></tr>
<tr><th>colors</th>
<td class="description">RGB values for colors</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Color array</p>
<h3 class="function"><a id="pdfioArrayCreateColorFromPrimaries">pdfioArrayCreateColorFromPrimaries</a></h3>
<p class="description">Create a calibrated color sapce array using CIE xy primary chromacities.</p> <p class="description">Create a calibrated color sapce array using CIE xy primary chromacities.</p>
<p class="code"> <p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateCalibratedColorFromPrimaries(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, double gamma, double wx, double wy, double rx, double ry, double gx, double gy, double bx, double by);</p> <a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromPrimaries(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, double gamma, double wx, double wy, double rx, double ry, double gx, double gy, double bx, double by);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
@ -791,34 +874,6 @@ bool pdfioArrayAppendString(<a href="#pdfio_array_t">pdfio_array_t</a> *a, const
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Color space array</p> <p class="description">Color space array</p>
<h3 class="function"><a id="pdfioArrayCreateICCBasedColor">pdfioArrayCreateICCBasedColor</a></h3>
<p class="description">Create an ICC-based color space array.</p>
<p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateICCBasedColor(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_obj_t">pdfio_obj_t</a> *icc_object);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>icc_object</th>
<td class="description">ICC profile object</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Color array</p>
<h3 class="function"><a id="pdfioArrayCreateIndexedColor">pdfioArrayCreateIndexedColor</a></h3>
<p class="description">Create an indexed color space array.</p>
<p class="code">
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateIndexedColor(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, const unsigned char *colors);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>num_colors</th>
<td class="description">Number of colors</td></tr>
<tr><th>colors</th>
<td class="description">RGB values for colors</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Color array</p>
<h3 class="function"><a id="pdfioArrayGetArray">pdfioArrayGetArray</a></h3> <h3 class="function"><a id="pdfioArrayGetArray">pdfioArrayGetArray</a></h3>
<p class="description">Get an array value from an array.</p> <p class="description">Get an array value from an array.</p>
<p class="code"> <p class="code">
@ -860,6 +915,19 @@ bool pdfioArrayGetBoolean(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Value</p> <p class="description">Value</p>
<h3 class="function"><a id="pdfioArrayGetDate">pdfioArrayGetDate</a></h3>
<p class="description">Get a date value from an array.</p>
<p class="code">
time_t pdfioArrayGetDate(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>a</th>
<td class="description">Array</td></tr>
<tr><th>n</th>
<td class="description">Index</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Value</p>
<h3 class="function"><a id="pdfioArrayGetDict">pdfioArrayGetDict</a></h3> <h3 class="function"><a id="pdfioArrayGetDict">pdfioArrayGetDict</a></h3>
<p class="description">Get a dictionary value from an array.</p> <p class="description">Get a dictionary value from an array.</p>
<p class="code"> <p class="code">
@ -1661,24 +1729,32 @@ bool pdfioContentTextNextLine(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);
<h3 class="function"><a id="pdfioContentTextShow">pdfioContentTextShow</a></h3> <h3 class="function"><a id="pdfioContentTextShow">pdfioContentTextShow</a></h3>
<p class="description">Show text.</p> <p class="description">Show text.</p>
<p class="code"> <p class="code">
bool pdfioContentTextShow(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, const char *s);</p> bool pdfioContentTextShow(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, bool unicode, const char *s);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>st</th> <tr><th>st</th>
<td class="description">Stream</td></tr> <td class="description">Stream</td></tr>
<tr><th>unicode</th>
<td class="description">Unicode text?</td></tr>
<tr><th>s</th> <tr><th>s</th>
<td class="description">String to show</td></tr> <td class="description">String to show</td></tr>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p> <p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function shows some text in a PDF content stream. The &quot;unicode&quot; argument
specifies that the current font maps to full Unicode. The &quot;s&quot; argument
specifies a UTF-8 encoded string.</p>
<h3 class="function"><a id="pdfioContentTextShowJustified">pdfioContentTextShowJustified</a></h3> <h3 class="function"><a id="pdfioContentTextShowJustified">pdfioContentTextShowJustified</a></h3>
<p class="description">Show justified text.</p> <p class="description">Show justified text.</p>
<p class="code"> <p class="code">
bool pdfioContentTextShowJustified(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, size_t num_fragments, const double *offsets, const char *const *fragments);</p> bool pdfioContentTextShowJustified(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, bool unicode, size_t num_fragments, const double *offsets, const char *const *fragments);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>st</th> <tr><th>st</th>
<td class="description">Stream</td></tr> <td class="description">Stream</td></tr>
<tr><th>unicode</th>
<td class="description">Unicode text?</td></tr>
<tr><th>num_fragments</th> <tr><th>num_fragments</th>
<td class="description">Number of text fragments</td></tr> <td class="description">Number of text fragments</td></tr>
<tr><th>offsets</th> <tr><th>offsets</th>
@ -1688,14 +1764,20 @@ bool pdfioContentTextShowJustified(<a href="#pdfio_stream_t">pdfio_stream_t</a>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p> <p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function shows some text in a PDF content stream. The &quot;unicode&quot; argument
specifies that the current font maps to full Unicode. The &quot;fragments&quot;
argument specifies an array of UTF-8 encoded strings.</p>
<h3 class="function"><a id="pdfioContentTextShowf">pdfioContentTextShowf</a></h3> <h3 class="function"><a id="pdfioContentTextShowf">pdfioContentTextShowf</a></h3>
<p class="description"></p> <p class="description"></p>
<p class="code"> <p class="code">
bool pdfioContentTextShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, const char *format, ...);</p> bool pdfioContentTextShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, bool unicode, const char *format, ...);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>st</th> <tr><th>st</th>
<td class="description">Stream</td></tr> <td class="description">Stream</td></tr>
<tr><th>unicode</th>
<td class="description">Unicode text?</td></tr>
<tr><th>format</th> <tr><th>format</th>
<td class="description"><code>printf</code>-style format string</td></tr> <td class="description"><code>printf</code>-style format string</td></tr>
<tr><th>...</th> <tr><th>...</th>
@ -1703,6 +1785,9 @@ bool pdfioContentTextShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, con
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Show formatted text.</p> <p class="description">Show formatted text.</p>
<p class="discussion">This function shows some text in a PDF content stream. The &quot;unicode&quot; argument
specifies that the current font maps to full Unicode. The &quot;format&quot; argument
specifies a UTF-8 encoded <code>printf</code>-style format string.</p>
<h3 class="function"><a id="pdfioDictCopy">pdfioDictCopy</a></h3> <h3 class="function"><a id="pdfioDictCopy">pdfioDictCopy</a></h3>
<p class="description">Copy a dictionary to a PDF file.</p> <p class="description">Copy a dictionary to a PDF file.</p>
<p class="code"> <p class="code">
@ -1768,6 +1853,19 @@ bool pdfioDictGetBoolean(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, const c
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Value</p> <p class="description">Value</p>
<h3 class="function"><a id="pdfioDictGetDate">pdfioDictGetDate</a></h3>
<p class="description">Get a date value from a dictionary.</p>
<p class="code">
time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, const char *key);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>dict</th>
<td class="description">Dictionary</td></tr>
<tr><th>key</th>
<td class="description">Key</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Value</p>
<h3 class="function"><a id="pdfioDictGetDict">pdfioDictGetDict</a></h3> <h3 class="function"><a id="pdfioDictGetDict">pdfioDictGetDict</a></h3>
<p class="description">Get a key dictionary value from a dictionary.</p> <p class="description">Get a key dictionary value from a dictionary.</p>
<p class="code"> <p class="code">
@ -1908,6 +2006,21 @@ bool pdfioDictSetBoolean(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, const c
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p> <p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioDictSetDate">pdfioDictSetDate</a></h3>
<p class="description">Set a date value in a dictionary.</p>
<p class="code">
bool pdfioDictSetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, const char *key, time_t value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>dict</th>
<td class="description">Dictionary</td></tr>
<tr><th>key</th>
<td class="description">Key</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioDictSetDict">pdfioDictSetDict</a></h3> <h3 class="function"><a id="pdfioDictSetDict">pdfioDictSetDict</a></h3>
<p class="description">Set a key dictionary in a dictionary.</p> <p class="description">Set a key dictionary in a dictionary.</p>
<p class="code"> <p class="code">
@ -2060,10 +2173,26 @@ bool pdfioFileClose(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">PDF file or <code>NULL</code> on error</p> <p class="description">PDF file or <code>NULL</code> on error</p>
<h3 class="function"><a id="pdfioFileCreateBaseFontObj">pdfioFileCreateBaseFontObj</a></h3> <h3 class="function"><a id="pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</a></h3>
<p class="description">Create a new object in a PDF file containing an array.</p>
<p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateArrayObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_array_t">pdfio_array_t</a> *array);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>array</th>
<td class="description">Object array</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New object</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function creates a new object with an array value in a PDF file.
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.</p>
<h3 class="function"><a id="pdfioFileCreateFontObjFromBase">pdfioFileCreateFontObjFromBase</a></h3>
<p class="description">Create one of the base 14 PDF fonts.</p> <p class="description">Create one of the base 14 PDF fonts.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateBaseFontObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *name);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromBase(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *name);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
@ -2106,10 +2235,12 @@ specifies the font nane:
</li> </li>
<li><code>ZapfDingbats</code></li> <li><code>ZapfDingbats</code></li>
</ul> </ul>
<h3 class="function"><a id="pdfioFileCreateFontObj">pdfioFileCreateFontObj</a></h3> <p class="discussion">Base fonts always use the Windows CP1252 (ISO-8859-1 with additional
characters such as the Euro symbol) subset of Unicode.</p>
<h3 class="function"><a id="pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></h3>
<p class="description">Add a font object to a PDF file.</p> <p class="description">Add a font object to a PDF file.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename, bool unicode);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename, bool unicode);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
@ -2117,27 +2248,35 @@ specifies the font nane:
<tr><th>filename</th> <tr><th>filename</th>
<td class="description">Filename</td></tr> <td class="description">Filename</td></tr>
<tr><th>unicode</th> <tr><th>unicode</th>
<td class="description">Unicode font?</td></tr> <td class="description">Force Unicode</td></tr>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Font object</p> <p class="description">Font object</p>
<h3 class="function"><a id="pdfioFileCreateICCProfileObj">pdfioFileCreateICCProfileObj</a></h3> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function embeds a TrueType/OpenType font into a PDF file. The
&quot;unicode&quot; 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.</p>
<h3 class="function"><a id="pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></h3>
<p class="description">Add an ICC profile object to a PDF file.</p> <p class="description">Add an ICC profile object to a PDF file.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateICCProfileObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateICCObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename, size_t num_colors);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
<td class="description">PDF file</td></tr> <td class="description">PDF file</td></tr>
<tr><th>filename</th> <tr><th>filename</th>
<td class="description">Filename</td></tr> <td class="description">Filename</td></tr>
<tr><th>num_colors</th>
<td class="description">Number of color components (1, 3, or 4)</td></tr>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Object</p> <p class="description">Object</p>
<h3 class="function"><a id="pdfioFileCreateImageObj">pdfioFileCreateImageObj</a></h3> <h3 class="function"><a id="pdfioFileCreateImageObjFromFile">pdfioFileCreateImageObjFromFile</a></h3>
<p class="description">Add an image object to a PDF file.</p> <p class="description">Add an image object to a PDF file.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateImageObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename, bool interpolate);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateImageObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *filename, bool interpolate);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>pdf</th> <tr><th>pdf</th>
@ -2150,7 +2289,12 @@ specifies the font nane:
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Object</p> <p class="description">Object</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">Currently only GIF, JPEG, and PNG files are supported.</p> <p class="discussion">This function creates an image object in a PDF file from a JPEG or PNG file.<br>
<br>
</p><blockquote>
Note: Currently PNG support is limited to grayscale, RGB, or indexed files
without interlacing or alpha. Transparency (masking) based on color/index
is supported.</blockquote>
<h3 class="function"><a id="pdfioFileCreateObj">pdfioFileCreateObj</a></h3> <h3 class="function"><a id="pdfioFileCreateObj">pdfioFileCreateObj</a></h3>
<p class="description">Create a new object in a PDF file.</p> <p class="description">Create a new object in a PDF file.</p>
<p class="code"> <p class="code">
@ -2193,6 +2337,39 @@ specifies the font nane:
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This differs from <a href="#pdfioFileGetObj"><code>pdfioFileGetObj</code></a> which takes an index into the <p class="discussion">This differs from <a href="#pdfioFileGetObj"><code>pdfioFileGetObj</code></a> which takes an index into the
list of objects while this function takes the object number.</p> list of objects while this function takes the object number.</p>
<h3 class="function"><a id="pdfioFileGetAuthor">pdfioFileGetAuthor</a></h3>
<p class="description">Get the author for a PDF file.</p>
<p class="code">
const char *pdfioFileGetAuthor(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Author or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetCreationDate">pdfioFileGetCreationDate</a></h3>
<p class="description">Get the creation date for a PDF file.</p>
<p class="code">
time_t pdfioFileGetCreationDate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Creation date or <code>0</code> for none</p>
<h3 class="function"><a id="pdfioFileGetCreator">pdfioFileGetCreator</a></h3>
<p class="description">Get the creator string for a PDF file.</p>
<p class="code">
const char *pdfioFileGetCreator(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Creator string or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetID">pdfioFileGetID</a></h3> <h3 class="function"><a id="pdfioFileGetID">pdfioFileGetID</a></h3>
<p class="description">Get the PDF file's ID strings.</p> <p class="description">Get the PDF file's ID strings.</p>
<p class="code"> <p class="code">
@ -2204,6 +2381,17 @@ list of objects while this function takes the object number.</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Array with binary strings</p> <p class="description">Array with binary strings</p>
<h3 class="function"><a id="pdfioFileGetKeywords">pdfioFileGetKeywords</a></h3>
<p class="description">Get the keywords for a PDF file.</p>
<p class="code">
const char *pdfioFileGetKeywords(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Keywords string or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetName">pdfioFileGetName</a></h3> <h3 class="function"><a id="pdfioFileGetName">pdfioFileGetName</a></h3>
<p class="description">Get a PDF's filename.</p> <p class="description">Get a PDF's filename.</p>
<p class="code"> <p class="code">
@ -2263,6 +2451,39 @@ size_t pdfioFileGetNumPages(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Object</p> <p class="description">Object</p>
<h3 class="function"><a id="pdfioFileGetProducer">pdfioFileGetProducer</a></h3>
<p class="description">Get the producer string for a PDF file.</p>
<p class="code">
const char *pdfioFileGetProducer(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Producer string or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetSubject">pdfioFileGetSubject</a></h3>
<p class="description">Get the subject for a PDF file.</p>
<p class="code">
const char *pdfioFileGetSubject(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Subject or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetTitle">pdfioFileGetTitle</a></h3>
<p class="description">Get the title for a PDF file.</p>
<p class="code">
const char *pdfioFileGetTitle(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Title or <code>NULL</code> for none</p>
<h3 class="function"><a id="pdfioFileGetVersion">pdfioFileGetVersion</a></h3> <h3 class="function"><a id="pdfioFileGetVersion">pdfioFileGetVersion</a></h3>
<p class="description">Get the PDF version number for a PDF file.</p> <p class="description">Get the PDF version number for a PDF file.</p>
<p class="code"> <p class="code">
@ -2289,6 +2510,72 @@ const char *pdfioFileGetVersion(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);<
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">PDF file</p> <p class="description">PDF file</p>
<h3 class="function"><a id="pdfioFileSetAuthor">pdfioFileSetAuthor</a></h3>
<p class="description">Set the author for a PDF file.</p>
<p class="code">
void pdfioFileSetAuthor(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></h3>
<p class="description">Set the creation date for a PDF file.</p>
<p class="code">
void pdfioFileSetCreationDate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, time_t value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioFileSetCreator">pdfioFileSetCreator</a></h3>
<p class="description">Set the creator string for a PDF file.</p>
<p class="code">
void pdfioFileSetCreator(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioFileSetKeywords">pdfioFileSetKeywords</a></h3>
<p class="description">Set the keywords string for a PDF file.</p>
<p class="code">
void pdfioFileSetKeywords(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioFileSetSubject">pdfioFileSetSubject</a></h3>
<p class="description">Set the subject for a PDF file.</p>
<p class="code">
void pdfioFileSetSubject(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioFileSetTitle">pdfioFileSetTitle</a></h3>
<p class="description">Set the title for a PDF file.</p>
<p class="code">
void pdfioFileSetTitle(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *value);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>value</th>
<td class="description">Value</td></tr>
</tbody></table>
<h3 class="function"><a id="pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></h3> <h3 class="function"><a id="pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></h3>
<p class="description">Get the number of bytes to read for each line.</p> <p class="description">Get the number of bytes to read for each line.</p>
<p class="code"> <p class="code">
@ -2562,7 +2849,7 @@ bool pdfioStreamGetToken(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, char
<h3 class="function"><a id="pdfioStreamPeek">pdfioStreamPeek</a></h3> <h3 class="function"><a id="pdfioStreamPeek">pdfioStreamPeek</a></h3>
<p class="description">Peek at data in a stream.</p> <p class="description">Peek at data in a stream.</p>
<p class="code"> <p class="code">
ssize_t pdfioStreamPeek(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, void *buffer, size_t bytes);</p> <a href="#ssize_t">ssize_t</a> pdfioStreamPeek(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, void *buffer, size_t bytes);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>st</th> <tr><th>st</th>
@ -2589,6 +2876,19 @@ bool pdfioStreamPrintf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, const c
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p> <p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioStreamPutChar">pdfioStreamPutChar</a></h3>
<p class="description">Write a single character to a stream.</p>
<p class="code">
bool pdfioStreamPutChar(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, int ch);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>st</th>
<td class="description">Stream</td></tr>
<tr><th>ch</th>
<td class="description">Character</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
<h3 class="function"><a id="pdfioStreamPuts">pdfioStreamPuts</a></h3> <h3 class="function"><a id="pdfioStreamPuts">pdfioStreamPuts</a></h3>
<p class="description">Write a literal string to a stream.</p> <p class="description">Write a literal string to a stream.</p>
<p class="code"> <p class="code">
@ -2605,7 +2905,7 @@ bool pdfioStreamPuts(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, const cha
<h3 class="function"><a id="pdfioStreamRead">pdfioStreamRead</a></h3> <h3 class="function"><a id="pdfioStreamRead">pdfioStreamRead</a></h3>
<p class="description">Read data from a stream.</p> <p class="description">Read data from a stream.</p>
<p class="code"> <p class="code">
ssize_t pdfioStreamRead(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, void *buffer, size_t bytes);</p> <a href="#ssize_t">ssize_t</a> pdfioStreamRead(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, void *buffer, size_t bytes);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>st</th> <tr><th>st</th>
@ -2677,6 +2977,267 @@ char *pdfioStringCreatef(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const ch
<br> <br>
<code>NULL</code> is returned on error, otherwise a <code>char *</code> that is valid until <code>NULL</code> is returned on error, otherwise a <code>char *</code> that is valid until
<code>pdfioFileClose</code> is called.</p> <code>pdfioFileClose</code> is called.</p>
<h3 class="function"><a id="ttfCreate">ttfCreate</a></h3>
<p class="description">Create a new font object for the named font family.</p>
<p class="code">
ttf_t *ttfCreate(const char *filename, size_t idx, ttf_err_cb_t err_cb, void *err_data);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>filename</th>
<td class="description">Filename</td></tr>
<tr><th>idx</th>
<td class="description">Font number to create in collection (0-based)</td></tr>
<tr><th>err_cb</th>
<td class="description">Error callback or <code>NULL</code> to log to stderr</td></tr>
<tr><th>err_data</th>
<td class="description">Error callback data</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New font object</p>
<h3 class="function"><a id="ttfDelete">ttfDelete</a></h3>
<p class="description">Free all memory used for a font family object.</p>
<p class="code">
void ttfDelete(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h3 class="function"><a id="ttfGetAscent">ttfGetAscent</a></h3>
<p class="description">Get the maximum height of non-accented characters.</p>
<p class="code">
int ttfGetAscent(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Ascent in 1000ths</p>
<h3 class="function"><a id="ttfGetBounds">ttfGetBounds</a></h3>
<p class="description">Get the bounds of all characters in a font.</p>
<p class="code">
ttf_rect_t *ttfGetBounds(ttf_t *font, ttf_rect_t *bounds);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
<tr><th>bounds</th>
<td class="description">Bounds buffer</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Bounds or <code>NULL</code> on error</p>
<h3 class="function"><a id="ttfGetCMap">ttfGetCMap</a></h3>
<p class="description">Get the Unicode to glyph mapping table.</p>
<p class="code">
const int *ttfGetCMap(ttf_t *font, size_t *num_cmap);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
<tr><th>num_cmap</th>
<td class="description">Number of entries in table</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">CMap table</p>
<h3 class="function"><a id="ttfGetCapHeight">ttfGetCapHeight</a></h3>
<p class="description">Get the height of capital letters.</p>
<p class="code">
int ttfGetCapHeight(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Capital letter height in 1000ths</p>
<h3 class="function"><a id="ttfGetCopyright">ttfGetCopyright</a></h3>
<p class="description">Get the copyright text for a font.</p>
<p class="code">
const char *ttfGetCopyright(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Copyright text</p>
<h3 class="function"><a id="ttfGetDescent">ttfGetDescent</a></h3>
<p class="description">Get the maximum depth of non-accented characters.</p>
<p class="code">
int ttfGetDescent(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Descent in 1000ths</p>
<h3 class="function"><a id="ttfGetExtents">ttfGetExtents</a></h3>
<p class="description">Get the extents of a UTF-8 string.</p>
<p class="code">
ttf_rect_t *ttfGetExtents(ttf_t *font, float size, const char *s, ttf_rect_t *extents);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
<tr><th>size</th>
<td class="description">Font size</td></tr>
<tr><th>s</th>
<td class="description">String</td></tr>
<tr><th>extents</th>
<td class="description">Extents of the string</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Pointer to extents or <code>NULL</code> on error</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function computes the extents of a UTF-8 string when rendered using the
specified font and size.</p>
<h3 class="function"><a id="ttfGetFamily">ttfGetFamily</a></h3>
<p class="description">Get the family name of a font.</p>
<p class="code">
const char *ttfGetFamily(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Family name</p>
<h3 class="function"><a id="ttfGetItalicAngle">ttfGetItalicAngle</a></h3>
<p class="description">Get the italic angle.</p>
<p class="code">
float ttfGetItalicAngle(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Angle in degrees</p>
<h3 class="function"><a id="ttfGetMaxChar">ttfGetMaxChar</a></h3>
<p class="description">Get the last character in the font.</p>
<p class="code">
int ttfGetMaxChar(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Last character in font</p>
<h3 class="function"><a id="ttfGetMinChar">ttfGetMinChar</a></h3>
<p class="description">Get the first character in the font.</p>
<p class="code">
int ttfGetMinChar(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">First character in font</p>
<h3 class="function"><a id="ttfGetNumFonts">ttfGetNumFonts</a></h3>
<p class="description">Get the number of fonts in this collection.</p>
<p class="code">
size_t ttfGetNumFonts(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of fonts</p>
<h3 class="function"><a id="ttfGetPostScriptName">ttfGetPostScriptName</a></h3>
<p class="description">Get the PostScript name of a font.</p>
<p class="code">
const char *ttfGetPostScriptName(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">PostScript name</p>
<h3 class="function"><a id="ttfGetStretch">ttfGetStretch</a></h3>
<p class="description">Get the font &quot;stretch&quot; value...</p>
<p class="code">
ttf_stretch_t ttfGetStretch(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Stretch value</p>
<h3 class="function"><a id="ttfGetStyle">ttfGetStyle</a></h3>
<p class="description">Get the font style.</p>
<p class="code">
ttf_style_t ttfGetStyle(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Style</p>
<h3 class="function"><a id="ttfGetVersion">ttfGetVersion</a></h3>
<p class="description">Get the version number of a font.</p>
<p class="code">
const char *ttfGetVersion(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Version number</p>
<h3 class="function"><a id="ttfGetWeight">ttfGetWeight</a></h3>
<p class="description">Get the weight of a font.</p>
<p class="code">
ttf_weight_t ttfGetWeight(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Weight</p>
<h3 class="function"><a id="ttfGetWidth">ttfGetWidth</a></h3>
<p class="description">Get the width of a single character.</p>
<p class="code">
int ttfGetWidth(ttf_t *font, int ch);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
<tr><th>ch</th>
<td class="description">Unicode character</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Width in 1000ths</p>
<h3 class="function"><a id="ttfGetXHeight">ttfGetXHeight</a></h3>
<p class="description">Get the height of lowercase letters.</p>
<p class="code">
int ttfGetXHeight(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Lowercase letter height in 1000ths</p>
<h3 class="function"><a id="ttfIsFixedPitch">ttfIsFixedPitch</a></h3>
<p class="description">Determine whether a font is fixedpitch.</p>
<p class="code">
bool ttfIsFixedPitch(ttf_t *font);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>font</th>
<td class="description">Font</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description"><code>true</code> if fixed pitch, <code>false</code> otherwise</p>
<h2 class="title"><a id="TYPES">Data Types</a></h2> <h2 class="title"><a id="TYPES">Data Types</a></h2>
<h3 class="typedef"><a id="pdfio_array_t">pdfio_array_t</a></h3> <h3 class="typedef"><a id="pdfio_array_t">pdfio_array_t</a></h3>
<p class="description">Array of PDF values</p> <p class="description">Array of PDF values</p>
@ -2723,6 +3284,11 @@ typedef struct _pdfio_stream_s pdfio_stream_t;
<p class="code"> <p class="code">
typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t; typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
</p> </p>
<h3 class="typedef"><a id="ssize_t">ssize_t</a></h3>
<p class="description">POSIX type not present on Windows...</p>
<p class="code">
typedef __int64 ssize_t;
</p>
<h2 class="title"><a id="STRUCTURES">Structures</a></h2> <h2 class="title"><a id="STRUCTURES">Structures</a></h2>
<h3 class="struct"><a id="pdfio_rect_s">pdfio_rect_s</a></h3> <h3 class="struct"><a id="pdfio_rect_s">pdfio_rect_s</a></h3>
<p class="description">PDF rectangle</p> <p class="description">PDF rectangle</p>

View File

@ -107,6 +107,30 @@ pdfioArrayAppendBoolean(
} }
//
// 'pdfioArrayAppendDate()' - Add a date value to an array.
//
bool // O - `true` on success, `false` on failure
pdfioArrayAppendDate(
pdfio_array_t *a, // I - Array
time_t value) // I - Value
{
_pdfio_value_t v; // Value for array
// Range check input
if (!a)
return (false);
// Add a dictionary...
v.type = PDFIO_VALTYPE_DATE;
v.value.date = value;
return (append_value(a, &v));
}
// //
// 'pdfioArrayAppendDict()' - Add a dictionary to an array. // 'pdfioArrayAppendDict()' - Add a dictionary to an array.
// //
@ -395,6 +419,21 @@ pdfioArrayGetBoolean(pdfio_array_t *a, // I - Array
} }
//
// 'pdfioArrayGetDate()' - Get a date value from an array.
//
time_t // O - Value
pdfioArrayGetDate(pdfio_array_t *a, // I - Array
size_t n) // I - Index
{
if (!a || n >= a->num_values || a->values[n].type != PDFIO_VALTYPE_DATE)
return (0);
else
return (a->values[n].value.date);
}
// //
// 'pdfioArrayGetDict()' - Get a dictionary value from an array. // 'pdfioArrayGetDict()' - Get a dictionary value from an array.
// //

View File

@ -170,6 +170,7 @@ pdfioDictGetArray(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_ARRAY) if (value && value->type == PDFIO_VALTYPE_ARRAY)
return (value->value.array); return (value->value.array);
else else
@ -188,6 +189,7 @@ pdfioDictGetBinary(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (!length) if (!length)
return (NULL); return (NULL);
@ -214,6 +216,7 @@ pdfioDictGetBoolean(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_BOOLEAN) if (value && value->type == PDFIO_VALTYPE_BOOLEAN)
return (value->value.boolean); return (value->value.boolean);
else else
@ -221,6 +224,24 @@ pdfioDictGetBoolean(pdfio_dict_t *dict, // I - Dictionary
} }
//
// 'pdfioDictGetDate()' - Get a date value from a dictionary.
//
time_t // O - Value
pdfioDictGetDate(pdfio_dict_t *dict, // I - Dictionary
const char *key) // I - Key
{
_pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_DATE)
return (value->value.date);
else
return (0);
}
// //
// 'pdfioDictGetDict()' - Get a key dictionary value from a dictionary. // 'pdfioDictGetDict()' - Get a key dictionary value from a dictionary.
// //
@ -231,6 +252,7 @@ pdfioDictGetDict(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_DICT) if (value && value->type == PDFIO_VALTYPE_DICT)
return (value->value.dict); return (value->value.dict);
else else
@ -248,6 +270,7 @@ pdfioDictGetName(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_NAME) if (value && value->type == PDFIO_VALTYPE_NAME)
return (value->value.name); return (value->value.name);
else else
@ -265,6 +288,7 @@ pdfioDictGetNumber(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_NUMBER) if (value && value->type == PDFIO_VALTYPE_NUMBER)
return (value->value.number); return (value->value.number);
else else
@ -282,6 +306,7 @@ pdfioDictGetObj(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_INDIRECT) if (value && value->type == PDFIO_VALTYPE_INDIRECT)
return (pdfioFileFindObj(dict->pdf, value->value.indirect.number)); return (pdfioFileFindObj(dict->pdf, value->value.indirect.number));
else else
@ -300,6 +325,7 @@ pdfioDictGetRect(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_ARRAY && pdfioArrayGetSize(value->value.array) == 4) if (value && value->type == PDFIO_VALTYPE_ARRAY && pdfioArrayGetSize(value->value.array) == 4)
{ {
rect->x1 = pdfioArrayGetNumber(value->value.array, 0); rect->x1 = pdfioArrayGetNumber(value->value.array, 0);
@ -326,6 +352,7 @@ pdfioDictGetString(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
if (value && value->type == PDFIO_VALTYPE_STRING) if (value && value->type == PDFIO_VALTYPE_STRING)
return (value->value.string); return (value->value.string);
else else
@ -343,6 +370,7 @@ pdfioDictGetType(pdfio_dict_t *dict, // I - Dictionary
{ {
_pdfio_value_t *value = _pdfioDictGetValue(dict, key); _pdfio_value_t *value = _pdfioDictGetValue(dict, key);
return (value ? value->type : PDFIO_VALTYPE_NONE); return (value ? value->type : PDFIO_VALTYPE_NONE);
} }
@ -524,6 +552,30 @@ pdfioDictSetBoolean(pdfio_dict_t *dict, // I - Dictionary
} }
//
// 'pdfioDictSetDate()' - Set a date value in a dictionary.
//
bool // O - `true` on success, `false` on failure
pdfioDictSetDate(pdfio_dict_t *dict, // I - Dictionary
const char *key, // I - Key
time_t value) // I - Value
{
_pdfio_value_t temp; // New value
// Range check input...
if (!dict || !key)
return (false);
// Set the key/value pair...
temp.type = PDFIO_VALTYPE_DATE;
temp.value.date = value;
return (_pdfioDictSetValue(dict, key, &temp));
}
// //
// 'pdfioDictSetDict()' - Set a key dictionary in a dictionary. // 'pdfioDictSetDict()' - Set a key dictionary in a dictionary.
// //

View File

@ -279,7 +279,7 @@ pdfioFileCreate(
return (NULL); return (NULL);
} }
// pdfioDictSetDate(info_dict, "CreationDate", time(NULL)); pdfioDictSetDate(info_dict, "CreationDate", time(NULL));
pdfioDictSetString(info_dict, "Producer", "pdfio/" PDFIO_VERSION); pdfioDictSetString(info_dict, "Producer", "pdfio/" PDFIO_VERSION);
if ((pdf->info = pdfioFileCreateObj(pdf, info_dict)) == NULL) if ((pdf->info = pdfioFileCreateObj(pdf, info_dict)) == NULL)
@ -550,9 +550,7 @@ time_t // O - Creation date or `0` for none
pdfioFileGetCreationDate( pdfioFileGetCreationDate(
pdfio_file_t *pdf) // I - PDF file pdfio_file_t *pdf) // I - PDF file
{ {
(void)pdf; return (pdf && pdf->info ? pdfioDictGetDate(pdf->info->value.value.dict, "CreationDate") : 0);
return (0);
// return (pdf && pdf->info ? pdfioDictGetDate(pdf->info->value.value.dict, "CreationDate") : 0);
} }
@ -823,10 +821,8 @@ pdfioFileSetCreationDate(
pdfio_file_t *pdf, // I - PDF file pdfio_file_t *pdf, // I - PDF file
time_t value) // I - Value time_t value) // I - Value
{ {
(void)pdf; if (pdf && pdf->info)
(void)value; pdfioDictSetDate(pdf->info->value.value.dict, "CreationDate", value);
// if (pdf && pdf->info)
// pdfioDictSetDate(pdf->info->value.value.dict, "CreationDate", value);
} }

View File

@ -137,8 +137,17 @@ _pdfioValueDebug(_pdfio_value_t *v, // I - Value
fputs(v->value.boolean ? " true" : " false", fp); fputs(v->value.boolean ? " true" : " false", fp);
break; break;
case PDFIO_VALTYPE_DATE : case PDFIO_VALTYPE_DATE :
// TODO: Implement date value support {
fputs("(D:YYYYMMDDhhmmssZ)", fp); struct tm dateval; // Date value
#ifdef _WIN32
gmtime_s(&dateval, &v->value.date);
#else
gmtime_r(&v->value.date, &dateval);
#endif // _WIN32
fprintf(fp, "(D:%04d%02d%02d%02d%02d%02dZ)", dateval.tm_year + 1900, dateval.tm_mon + 1, dateval.tm_mday, dateval.tm_hour, dateval.tm_min, dateval.tm_sec);
}
break; break;
case PDFIO_VALTYPE_DICT : case PDFIO_VALTYPE_DICT :
fputs("<<", fp); fputs("<<", fp);
@ -226,9 +235,73 @@ _pdfioValueRead(pdfio_file_t *pdf, // I - PDF file
if ((v->value.dict = _pdfioDictRead(pdf, tb)) == NULL) if ((v->value.dict = _pdfioDictRead(pdf, tb)) == NULL)
return (NULL); return (NULL);
} }
else if (!strncmp(token, "(D:", 3))
{
// Possible date value of the form:
//
// (D:YYYYMMDDhhmmssZ)
// (D:YYYYMMDDhhmmss+HH'mm)
// (D:YYYYMMDDhhmmss-HH'mm)
//
int i; // Looping var
struct tm dateval; // Date value
int offset; // Date offset
for (i = 3; i < 17; i ++)
{
if (!isdigit(token[i] & 255))
break;
}
if (i >= 17)
{
if (token[i] == 'Z')
{
i ++;
}
else if (token[i] == '-' || token[i] == '+')
{
if (isdigit(token[i + 1] & 255) && isdigit(token[i + 2] & 255) && token[i + 3] == '\'' && isdigit(token[i + 4] & 255) && isdigit(token[i + 5] & 255))
{
i += 6;
if (token[i] == '\'')
i ++;
}
}
}
if (token[i])
{
// Just a string...
v->type = PDFIO_VALTYPE_STRING;
v->value.string = pdfioStringCreate(pdf, token + 1);
}
else
{
// Date value...
dateval.tm_year = (token[3] - '0') * 1000 + (token[4] - '0') * 100 + (token[5] - '0') * 10 + token[6] - '0' - 1900;
dateval.tm_mon = (token[7] - '0') * 10 + token[8] - '0' - 1;
dateval.tm_mday = (token[9] - '0') * 10 + token[10] - '0';
dateval.tm_hour = (token[11] - '0') * 10 + token[12] - '0';
dateval.tm_min = (token[13] - '0') * 10 + token[14] - '0';
dateval.tm_sec = (token[15] - '0') * 10 + token[16] - '0';
if (token[17] == 'Z')
{
offset = 0;
}
else
{
offset = (token[18] - '0') * 600 + (token[19] - '0') * 60 + (token[20] - '0') * 10 + token[21] - '0';
if (token[17] == '-')
offset = -offset;
}
v->type = PDFIO_VALTYPE_DATE;
v->value.date = mktime(&dateval) + offset;
}
}
else if (token[0] == '(') else if (token[0] == '(')
{ {
// TODO: Add date value support
// String // String
v->type = PDFIO_VALTYPE_STRING; v->type = PDFIO_VALTYPE_STRING;
v->value.string = pdfioStringCreate(pdf, token + 1); v->value.string = pdfioStringCreate(pdf, token + 1);
@ -413,6 +486,7 @@ _pdfioValueWrite(pdfio_file_t *pdf, // I - PDF file
#else #else
gmtime_r(&v->value.date, &date); gmtime_r(&v->value.date, &date);
#endif // _WIN32 #endif // _WIN32
return (_pdfioFilePrintf(pdf, "(D:%04d%02d%02d%02d%02d%02dZ)", date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec)); return (_pdfioFilePrintf(pdf, "(D:%04d%02d%02d%02d%02d%02dZ)", date.tm_year + 1900, date.tm_mon + 1, date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec));
} }

View File

@ -106,6 +106,7 @@ typedef enum pdfio_valtype_e // PDF value types
extern bool pdfioArrayAppendArray(pdfio_array_t *a, pdfio_array_t *value) PDFIO_PUBLIC; extern bool pdfioArrayAppendArray(pdfio_array_t *a, pdfio_array_t *value) PDFIO_PUBLIC;
extern bool pdfioArrayAppendBinary(pdfio_array_t *a, const unsigned char *value, size_t valuelen) PDFIO_PUBLIC; extern bool pdfioArrayAppendBinary(pdfio_array_t *a, const unsigned char *value, size_t valuelen) PDFIO_PUBLIC;
extern bool pdfioArrayAppendBoolean(pdfio_array_t *a, bool value) PDFIO_PUBLIC; extern bool pdfioArrayAppendBoolean(pdfio_array_t *a, bool value) PDFIO_PUBLIC;
extern bool pdfioArrayAppendDate(pdfio_array_t *a, time_t value) PDFIO_PUBLIC;
extern bool pdfioArrayAppendDict(pdfio_array_t *a, pdfio_dict_t *value) PDFIO_PUBLIC; extern bool pdfioArrayAppendDict(pdfio_array_t *a, pdfio_dict_t *value) PDFIO_PUBLIC;
extern bool pdfioArrayAppendName(pdfio_array_t *a, const char *value) PDFIO_PUBLIC; extern bool pdfioArrayAppendName(pdfio_array_t *a, const char *value) PDFIO_PUBLIC;
extern bool pdfioArrayAppendNumber(pdfio_array_t *a, double value) PDFIO_PUBLIC; extern bool pdfioArrayAppendNumber(pdfio_array_t *a, double value) PDFIO_PUBLIC;
@ -116,6 +117,7 @@ extern pdfio_array_t *pdfioArrayCreate(pdfio_file_t *pdf) PDFIO_PUBLIC;
extern pdfio_array_t *pdfioArrayGetArray(pdfio_array_t *a, size_t n) PDFIO_PUBLIC; extern pdfio_array_t *pdfioArrayGetArray(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
extern unsigned char *pdfioArrayGetBinary(pdfio_array_t *a, size_t n, size_t *length) PDFIO_PUBLIC; extern unsigned char *pdfioArrayGetBinary(pdfio_array_t *a, size_t n, size_t *length) PDFIO_PUBLIC;
extern bool pdfioArrayGetBoolean(pdfio_array_t *a, size_t n) PDFIO_PUBLIC; extern bool pdfioArrayGetBoolean(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
extern time_t pdfioArrayGetDate(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
extern pdfio_dict_t *pdfioArrayGetDict(pdfio_array_t *a, size_t n) PDFIO_PUBLIC; extern pdfio_dict_t *pdfioArrayGetDict(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
extern const char *pdfioArrayGetName(pdfio_array_t *a, size_t n) PDFIO_PUBLIC; extern const char *pdfioArrayGetName(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
extern double pdfioArrayGetNumber(pdfio_array_t *a, size_t n) PDFIO_PUBLIC; extern double pdfioArrayGetNumber(pdfio_array_t *a, size_t n) PDFIO_PUBLIC;
@ -129,6 +131,7 @@ extern pdfio_dict_t *pdfioDictCreate(pdfio_file_t *pdf) PDFIO_PUBLIC;
extern pdfio_array_t *pdfioDictGetArray(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern pdfio_array_t *pdfioDictGetArray(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
extern unsigned char *pdfioDictGetBinary(pdfio_dict_t *dict, const char *key, size_t *length) PDFIO_PUBLIC; extern unsigned char *pdfioDictGetBinary(pdfio_dict_t *dict, const char *key, size_t *length) PDFIO_PUBLIC;
extern bool pdfioDictGetBoolean(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern bool pdfioDictGetBoolean(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
extern time_t pdfioDictGetDate(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
extern pdfio_dict_t *pdfioDictGetDict(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern pdfio_dict_t *pdfioDictGetDict(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
extern const char *pdfioDictGetName(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern const char *pdfioDictGetName(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
extern double pdfioDictGetNumber(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern double pdfioDictGetNumber(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;
@ -139,6 +142,7 @@ extern pdfio_valtype_t pdfioDictGetType(pdfio_dict_t *dict, const char *key) PDF
extern bool pdfioDictSetArray(pdfio_dict_t *dict, const char *key, pdfio_array_t *value) PDFIO_PUBLIC; extern bool pdfioDictSetArray(pdfio_dict_t *dict, const char *key, pdfio_array_t *value) PDFIO_PUBLIC;
extern bool pdfioDictSetBinary(pdfio_dict_t *dict, const char *key, const unsigned char *value, size_t valuelen) PDFIO_PUBLIC; extern bool pdfioDictSetBinary(pdfio_dict_t *dict, const char *key, const unsigned char *value, size_t valuelen) PDFIO_PUBLIC;
extern bool pdfioDictSetBoolean(pdfio_dict_t *dict, const char *key, bool value) PDFIO_PUBLIC; extern bool pdfioDictSetBoolean(pdfio_dict_t *dict, const char *key, bool value) PDFIO_PUBLIC;
extern bool pdfioDictSetDate(pdfio_dict_t *dict, const char *key, time_t value) PDFIO_PUBLIC;
extern bool pdfioDictSetDict(pdfio_dict_t *dict, const char *key, pdfio_dict_t *value) PDFIO_PUBLIC; extern bool pdfioDictSetDict(pdfio_dict_t *dict, const char *key, pdfio_dict_t *value) PDFIO_PUBLIC;
extern bool pdfioDictSetName(pdfio_dict_t *dict, const char *key, const char *value) PDFIO_PUBLIC; extern bool pdfioDictSetName(pdfio_dict_t *dict, const char *key, const char *value) PDFIO_PUBLIC;
extern bool pdfioDictSetNull(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC; extern bool pdfioDictSetNull(pdfio_dict_t *dict, const char *key) PDFIO_PUBLIC;