Compare commits

...

5 Commits

Author SHA1 Message Date
Michael R Sweet
1116e929f7
Add pdfioFileGet/SetLanguage functions (Issue #124) 2025-04-13 20:21:23 -04:00
Michael R Sweet
c75611e274
Update documentation. 2025-04-13 17:15:53 -04:00
Michael R Sweet
c507cabbda
Update Windows DLL exports. 2025-04-13 16:56:50 -04:00
Michael R Sweet
81aeef46d2
Add XMP metadata to output (Issue #103) 2025-04-13 16:56:30 -04:00
Michael R Sweet
ba7371b2e1
Fix location of OutputIntents (catalog, not info dict) 2025-04-13 14:31:14 -04:00
13 changed files with 604 additions and 49 deletions

View File

@ -5,6 +5,7 @@ Changes in PDFio
v1.6.0 - YYYY-MM-DD v1.6.0 - YYYY-MM-DD
------------------- -------------------
- Added generation of XMP metadata when writing PDFs (Issue #103)
- Added "standard" `PDFIO_CS_CGATS001` color space for non-device CMYK - Added "standard" `PDFIO_CS_CGATS001` color space for non-device CMYK
(Issue #104) (Issue #104)
- Added CMYK JPEG support with embedded ICC profiles or using the CGATS001 - Added CMYK JPEG support with embedded ICC profiles or using the CGATS001
@ -13,6 +14,8 @@ v1.6.0 - YYYY-MM-DD
to a PDF file (Issue #104) to a PDF file (Issue #104)
- Added `pdfioFileCreateFontObjFromData` function for embedding fonts in - Added `pdfioFileCreateFontObjFromData` function for embedding fonts in
memory (Issue #120) memory (Issue #120)
- Added `pdfioFileGetLanguage` and `pdfioFileSetLanguage` functions for getting
and setting the default/primary language of a PDF file (Issue #124)
- Now add default grayscale, RGB, and CMYK profile resources to pages as needed - Now add default grayscale, RGB, and CMYK profile resources to pages as needed
(Issue #104) (Issue #104)

View File

@ -1,4 +1,4 @@
.TH pdfio 3 "pdf read/write library" "2025-04-12" "pdf read/write library" .TH pdfio 3 "pdf read/write library" "2025-04-13" "pdf read/write library"
.SH NAME .SH NAME
pdfio \- pdf read/write library pdfio \- pdf read/write library
.SH Introduction .SH Introduction
@ -2449,6 +2449,10 @@ PDFIO_CS_ADOBE
.br .br
AdobeRGB 1998 AdobeRGB 1998
.TP 5 .TP 5
PDFIO_CS_CGATS001
.br
CGATS001 (CMYK)
.TP 5
PDFIO_CS_P3_D65 PDFIO_CS_P3_D65
.br .br
Display P3 Display P3
@ -2477,7 +2481,7 @@ PDFIO_ENCRYPTION_RC4_128
.TP 5 .TP 5
PDFIO_ENCRYPTION_RC4_40 PDFIO_ENCRYPTION_RC4_40
.br .br
40-bit RC4 encryption (PDF 1.3) 40-bit RC4 encryption (PDF 1.3, reading only)
.SS pdfio_filter_e .SS pdfio_filter_e
Compression/decompression filters for streams Compression/decompression filters for streams
.TP 5 .TP 5
@ -2838,7 +2842,8 @@ pdfio_array_t * pdfioArrayCreateColorFromStandard (
.fi .fi
.PP .PP
This function creates a color array for a standard \fBPDFIO_CS_\fR enumerated color space. This function creates a color array for a standard \fBPDFIO_CS_\fR enumerated color space.
The "num_colors" argument must be \fB1\fR for grayscale and \fB3\fR for RGB color. The "num_colors" argument must be \fB1\fR for grayscale, \fB3\fR for RGB color, and
\fB4\fR for CMYK color.
.SS pdfioArrayGetArray .SS pdfioArrayGetArray
Get an array value from an array. Get an array value from an array.
.PP .PP
@ -2947,6 +2952,8 @@ bool pdfioArrayRemove (
size_t n size_t n
); );
.fi .fi
.PP
.SS pdfioContentClip .SS pdfioContentClip
Clip output to the current path. Clip output to the current path.
.PP .PP
@ -3083,6 +3090,8 @@ bool pdfioContentPathEnd (
pdfio_stream_t *st pdfio_stream_t *st
); );
.fi .fi
.PP
.SS pdfioContentPathLineTo .SS pdfioContentPathLineTo
Add a straight line to the current path. Add a straight line to the current path.
.PP .PP
@ -3423,6 +3432,8 @@ double pdfioContentTextMeasure (
This function measures the given text string "s" and returns its width based This function measures the given text string "s" and returns its width based
on "size". The text string must always use the UTF-8 (Unicode) encoding but on "size". The text string must always use the UTF-8 (Unicode) encoding but
any control characters (such as newlines) are ignored. any control characters (such as newlines) are ignored.
.SS pdfioContentTextMoveLine .SS pdfioContentTextMoveLine
Move to the next line and offset. Move to the next line and offset.
.PP .PP
@ -3451,6 +3462,8 @@ bool pdfioContentTextNewLine (
pdfio_stream_t *st pdfio_stream_t *st
); );
.fi .fi
.PP
.SS pdfioContentTextNewLineShow .SS pdfioContentTextNewLineShow
Move to the next line and show text. Move to the next line and show text.
.PP .PP
@ -3468,6 +3481,8 @@ This function moves to the next line and then shows some text with optional
word and character spacing in a PDF content stream. The "unicode" argument word and character spacing in a PDF content stream. The "unicode" argument
specifies that the current font maps to full Unicode. The "s" argument specifies that the current font maps to full Unicode. The "s" argument
specifies a UTF-8 encoded string. specifies a UTF-8 encoded string.
.SS pdfioContentTextNewLineShowf .SS pdfioContentTextNewLineShowf
Show formatted text. Show formatted text.
.PP .PP
@ -3486,6 +3501,8 @@ This function moves to the next line and shows some formatted text with
optional word and character spacing in a PDF content stream. The "unicode" optional word and character spacing in a PDF content stream. The "unicode"
argument specifies that the current font maps to full Unicode. The "format" argument specifies that the current font maps to full Unicode. The "format"
argument specifies a UTF-8 encoded \fBprintf\fR-style format string. argument specifies a UTF-8 encoded \fBprintf\fR-style format string.
.SS pdfioContentTextShow .SS pdfioContentTextShow
Show text. Show text.
.PP .PP
@ -3536,6 +3553,8 @@ bool pdfioDictClear (
const char *key const char *key
); );
.fi .fi
.PP
.SS pdfioDictCopy .SS pdfioDictCopy
Copy a dictionary to a PDF file. Copy a dictionary to a PDF file.
.PP .PP
@ -3608,6 +3627,8 @@ const char * pdfioDictGetKey (
size_t n size_t n
); );
.fi .fi
.PP
.SS pdfioDictGetName .SS pdfioDictGetName
Get a key name value from a dictionary. Get a key name value from a dictionary.
.PP .PP
@ -3625,6 +3646,8 @@ size_t pdfioDictGetNumPairs (
pdfio_dict_t *dict pdfio_dict_t *dict
); );
.fi .fi
.PP
.SS pdfioDictGetNumber .SS pdfioDictGetNumber
Get a key number value from a dictionary. Get a key number value from a dictionary.
.PP .PP
@ -3697,6 +3720,8 @@ function "cb":
The iteration continues as long as the callback returns \fBtrue\fR or all keys The iteration continues as long as the callback returns \fBtrue\fR or all keys
have been iterated. have been iterated.
.SS pdfioDictSetArray .SS pdfioDictSetArray
Set a key array in a dictionary. Set a key array in a dictionary.
.PP .PP
@ -3818,6 +3843,39 @@ bool pdfioDictSetStringf (
... ...
); );
.fi .fi
.SS pdfioFileAddOutputIntent
Add an OutputIntent to a file.
.PP
.nf
void pdfioFileAddOutputIntent (
pdfio_file_t *pdf,
const char *subtype,
const char *condition,
const char *cond_id,
const char *reg_name,
const char *info,
pdfio_obj_t *profile
);
.fi
.PP
This function adds an OutputIntent dictionary to the PDF file catalog.
The "subtype" argument specifies the intent subtype and is typically
"GTS_PDFX" for PDF/X, "GTS_PDFA1" for PDF/A, or "ISO_PDFE1" for PDF/E.
Passing \fBNULL\fR defaults the subtype to "GTS_PDFA1".
.PP
The "condition" argument specifies a short name for the output intent, while
the "info" argument specifies a longer description for the output intent.
Both can be \fBNULL\fR to omit this information.
.PP
The "cond_id" argument specifies a unique identifier such as a registration
("CGATS001") or color space name ("sRGB"). The "reg_name" argument provides
a URL for the identifier.
.PP
The "profile" argument specifies an ICC profile object for the output
condition. If \fBNULL\fR, the PDF consumer will attempt to look up the correct
profile using the "cond_id" value.
.SS pdfioFileClose .SS pdfioFileClose
Close a PDF file and free all memory used for it. Close a PDF file and free all memory used for it.
.PP .PP
@ -3911,8 +3969,27 @@ specifies the font nane:
Aside from "Symbol" and "Zapf-Dingbats", Base fonts use the Windows CP1252 Aside from "Symbol" and "Zapf-Dingbats", Base fonts use the Windows CP1252
(ISO-8859-1 with additional characters such as the Euro symbol) subset of (ISO-8859-1 with additional characters such as the Euro symbol) subset of
Unicode. Unicode.
.SS pdfioFileCreateFontObjFromData
Add a font in memory to a PDF file.
.PP
.nf
pdfio_obj_t * pdfioFileCreateFontObjFromData (
pdfio_file_t *pdf,
const void *data,
size_t datasize,
bool unicode
);
.fi
.PP
This function embeds TrueType/OpenType font data 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 pdfioFileCreateFontObjFromFile .SS pdfioFileCreateFontObjFromFile
Add a font object to a PDF file. Add a font file to a PDF file.
.PP .PP
.nf .nf
pdfio_obj_t * pdfioFileCreateFontObjFromFile ( pdfio_obj_t * pdfioFileCreateFontObjFromFile (
@ -3922,7 +3999,7 @@ pdfio_obj_t * pdfioFileCreateFontObjFromFile (
); );
.fi .fi
.PP .PP
This function embeds a TrueType/OpenType font into a PDF file. The This function embeds a TrueType/OpenType font file into a PDF file. The
"unicode" parameter controls whether the font is encoded for two-byte "unicode" parameter controls whether the font is encoded for two-byte
characters (potentially full Unicode, but more typically a subset) characters (potentially full Unicode, but more typically a subset)
or to only support the Windows CP1252 (ISO-8859-1 with additional or to only support the Windows CP1252 (ISO-8859-1 with additional
@ -4011,6 +4088,8 @@ pdfio_obj_t * pdfioFileCreateNameObj (
.PP .PP
This function creates a new object with a name value in a PDF file. This function creates a new object with a name value in a PDF file.
You must call \fIpdfioObjClose\fR to write the object to the file. You must call \fIpdfioObjClose\fR to write the object to the file.
.SS pdfioFileCreateNumberObj .SS pdfioFileCreateNumberObj
Create a new object in a PDF file containing a number. Create a new object in a PDF file containing a number.
.PP .PP
@ -4023,6 +4102,8 @@ pdfio_obj_t * pdfioFileCreateNumberObj (
.PP .PP
This function creates a new object with a number value in a PDF file. This function creates a new object with a number value in a PDF file.
You must call \fIpdfioObjClose\fR to write the object to the file. You must call \fIpdfioObjClose\fR to write the object to the file.
.SS pdfioFileCreateObj .SS pdfioFileCreateObj
Create a new object in a PDF file. Create a new object in a PDF file.
.PP .PP
@ -4101,6 +4182,8 @@ pdfio_obj_t * pdfioFileCreateStringObj (
.PP .PP
This function creates a new object with a string value in a PDF file. This function creates a new object with a string value in a PDF file.
You must call \fIpdfioObjClose\fR to write the object to the file. You must call \fIpdfioObjClose\fR to write the object to the file.
.SS pdfioFileCreateTemporary .SS pdfioFileCreateTemporary
.PP .PP
@ -4177,6 +4260,21 @@ const char * pdfioFileGetKeywords (
pdfio_file_t *pdf pdfio_file_t *pdf
); );
.fi .fi
.SS pdfioFileGetLanguage
Get the language metadata for a PDF file.
.PP
.nf
const char * pdfioFileGetLanguage (
pdfio_file_t *pdf
);
.fi
.PP
This function gets the (primary/default) language metadata, if any, for a PDF
file. The returned string is an IETF BCP 47 language tag of the form
"lang-REGION". For example, the string "en-CA" specifies Canadian English
and the string "fr-CA" specifies Canadian French.
.SS pdfioFileGetModificationDate .SS pdfioFileGetModificationDate
Get the most recent modification date for a PDF file. Get the most recent modification date for a PDF file.
.PP .PP
@ -4332,6 +4430,22 @@ void pdfioFileSetKeywords (
const char *value const char *value
); );
.fi .fi
.SS pdfioFileSetLanguage
Set the language metadata for a PDF file.
.PP
.nf
void pdfioFileSetLanguage (
pdfio_file_t *pdf,
const char *value
);
.fi
.PP
This function sets the (primary/default) language metadata for a PDF file.
The "value" argument is an IETF BCP 47 language tag string of the form
"lang-REGION". For example, the string "en-CA" specifies Canadian English
and the string "fr-CA" specifies Canadian French.
.SS pdfioFileSetModificationDate .SS pdfioFileSetModificationDate
Set the modification date for a PDF file. Set the modification date for a PDF file.
.PP .PP
@ -4474,6 +4588,8 @@ const char * pdfioObjGetName (
pdfio_obj_t *obj pdfio_obj_t *obj
); );
.fi .fi
.PP
.SS pdfioObjGetNumber .SS pdfioObjGetNumber
Get the object's number. Get the object's number.
.PP .PP
@ -4677,8 +4793,9 @@ bool pdfioStreamPrintf (
.fi .fi
.PP .PP
This function writes a formatted string to a stream. In addition to the This function writes a formatted string to a stream. In addition to the
standard \fBprintf\fR format characters, you can use "%N" to format a PDF name standard \fBprintf\fR format characters, you can use "%H" to format a HTML/XML
value ("/Name") and "%S" to format a PDF string ("(String)") value. string value, "%N" to format a PDF name value ("/Name"), and "%S" to format
a PDF string ("(String)") value.
.SS pdfioStreamPutChar .SS pdfioStreamPutChar
Write a single character to a stream. Write a single character to a stream.
.PP .PP

View File

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en-US"> <html lang="en-US">
<head> <head>
<title>PDFio Programming Manual v1.5.2</title> <title>PDFio Programming Manual v1.6.0</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.8"> <meta name="generator" content="codedoc v3.8">
<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-2025 by Michael R Sweet"> <meta name="copyright" content="Copyright © 2021-2025 by Michael R Sweet">
<meta name="version" content="1.5.2"> <meta name="version" content="1.6.0">
<style type="text/css"><!-- <style type="text/css"><!--
body { body {
background: white; background: white;
@ -251,7 +251,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 v1.5.2</h1> <h1 class="title">PDFio Programming Manual v1.6.0</h1>
<p>Michael R Sweet</p> <p>Michael R Sweet</p>
<p>Copyright © 2021-2025 by Michael R Sweet</p> <p>Copyright © 2021-2025 by Michael R Sweet</p>
</div> </div>
@ -395,10 +395,12 @@ span.string {
<li><a href="#pdfioDictSetRect">pdfioDictSetRect</a></li> <li><a href="#pdfioDictSetRect">pdfioDictSetRect</a></li>
<li><a href="#pdfioDictSetString">pdfioDictSetString</a></li> <li><a href="#pdfioDictSetString">pdfioDictSetString</a></li>
<li><a href="#pdfioDictSetStringf">pdfioDictSetStringf</a></li> <li><a href="#pdfioDictSetStringf">pdfioDictSetStringf</a></li>
<li><a href="#pdfioFileAddOutputIntent">pdfioFileAddOutputIntent</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="#pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</a></li> <li><a href="#pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</a></li>
<li><a href="#pdfioFileCreateFontObjFromBase">pdfioFileCreateFontObjFromBase</a></li> <li><a href="#pdfioFileCreateFontObjFromBase">pdfioFileCreateFontObjFromBase</a></li>
<li><a href="#pdfioFileCreateFontObjFromData">pdfioFileCreateFontObjFromData</a></li>
<li><a href="#pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></li> <li><a href="#pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></li>
<li><a href="#pdfioFileCreateICCObjFromData">pdfioFileCreateICCObjFromData</a></li> <li><a href="#pdfioFileCreateICCObjFromData">pdfioFileCreateICCObjFromData</a></li>
<li><a href="#pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></li> <li><a href="#pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></li>
@ -418,6 +420,7 @@ span.string {
<li><a href="#pdfioFileGetCreator">pdfioFileGetCreator</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="#pdfioFileGetKeywords">pdfioFileGetKeywords</a></li>
<li><a href="#pdfioFileGetLanguage">pdfioFileGetLanguage</a></li>
<li><a href="#pdfioFileGetModificationDate">pdfioFileGetModificationDate</a></li> <li><a href="#pdfioFileGetModificationDate">pdfioFileGetModificationDate</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>
@ -434,6 +437,7 @@ span.string {
<li><a href="#pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></li> <li><a href="#pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></li>
<li><a href="#pdfioFileSetCreator">pdfioFileSetCreator</a></li> <li><a href="#pdfioFileSetCreator">pdfioFileSetCreator</a></li>
<li><a href="#pdfioFileSetKeywords">pdfioFileSetKeywords</a></li> <li><a href="#pdfioFileSetKeywords">pdfioFileSetKeywords</a></li>
<li><a href="#pdfioFileSetLanguage">pdfioFileSetLanguage</a></li>
<li><a href="#pdfioFileSetModificationDate">pdfioFileSetModificationDate</a></li> <li><a href="#pdfioFileSetModificationDate">pdfioFileSetModificationDate</a></li>
<li><a href="#pdfioFileSetPermissions">pdfioFileSetPermissions</a></li> <li><a href="#pdfioFileSetPermissions">pdfioFileSetPermissions</a></li>
<li><a href="#pdfioFileSetSubject">pdfioFileSetSubject</a></li> <li><a href="#pdfioFileSetSubject">pdfioFileSetSubject</a></li>
@ -2594,7 +2598,7 @@ dd-&gt;y = row_y - row-&gt;height;
<tr><th>pdf</th> <tr><th>pdf</th>
<td class="description">PDF file</td></tr> <td class="description">PDF file</td></tr>
<tr><th>num_colors</th> <tr><th>num_colors</th>
<td class="description">Number of colors (1 or 3)</td></tr> <td class="description">Number of colors (1, 3, or 4)</td></tr>
<tr><th>cs</th> <tr><th>cs</th>
<td class="description">Color space enumeration</td></tr> <td class="description">Color space enumeration</td></tr>
</tbody></table> </tbody></table>
@ -2602,7 +2606,8 @@ dd-&gt;y = row_y - row-&gt;height;
<p class="description">Color array</p> <p class="description">Color array</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function creates a color array for a standard <code>PDFIO_CS_</code> enumerated color space. <p class="discussion">This function creates a color array for a standard <code>PDFIO_CS_</code> enumerated color space.
The &quot;num_colors&quot; argument must be <code>1</code> for grayscale and <code>3</code> for RGB color.</p> The &quot;num_colors&quot; argument must be <code>1</code> for grayscale, <code>3</code> for RGB color, and
<code>4</code> for CMYK color.</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">
@ -2746,7 +2751,7 @@ size_t pdfioArrayGetSize(<a href="#pdfio_array_t">pdfio_array_t</a> *a);</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Value type</p> <p class="description">Value type</p>
<h3 class="function"><a id="pdfioArrayRemove">pdfioArrayRemove</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioArrayRemove">pdfioArrayRemove</a></h3>
<p class="description">Remove an array entry.</p> <p class="description">Remove an array entry.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioArrayRemove(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p> <span class="reserved">bool</span> pdfioArrayRemove(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
@ -2951,7 +2956,7 @@ using the <a href="#pdfioPageDictAddImage"><code>pdfioPageDictAddImage</code></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>
<h3 class="function"><a id="pdfioContentPathEnd">pdfioContentPathEnd</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.1&#160;</span><a id="pdfioContentPathEnd">pdfioContentPathEnd</a></h3>
<p class="description">Clear the current path.</p> <p class="description">Clear the current path.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioContentPathEnd(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p> <span class="reserved">bool</span> pdfioContentPathEnd(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
@ -3441,7 +3446,7 @@ are 0, a solid line is drawn.</p>
</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="pdfioContentTextMeasure">pdfioContentTextMeasure</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioContentTextMeasure">pdfioContentTextMeasure</a></h3>
<p class="description">Measure a text string and return its width.</p> <p class="description">Measure a text string and return its width.</p>
<p class="code"> <p class="code">
<span class="reserved">double</span> pdfioContentTextMeasure(<a href="#pdfio_obj_t">pdfio_obj_t</a> *font, <span class="reserved">const</span> <span class="reserved">char</span> *s, <span class="reserved">double</span> size);</p> <span class="reserved">double</span> pdfioContentTextMeasure(<a href="#pdfio_obj_t">pdfio_obj_t</a> *font, <span class="reserved">const</span> <span class="reserved">char</span> *s, <span class="reserved">double</span> size);</p>
@ -3459,7 +3464,9 @@ are 0, a solid line is drawn.</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function measures the given text string &quot;s&quot; and returns its width based <p class="discussion">This function measures the given text string &quot;s&quot; and returns its width based
on &quot;size&quot;. The text string must always use the UTF-8 (Unicode) encoding but on &quot;size&quot;. The text string must always use the UTF-8 (Unicode) encoding but
any control characters (such as newlines) are ignored.</p> any control characters (such as newlines) are ignored.
</p>
<h3 class="function"><a id="pdfioContentTextMoveLine">pdfioContentTextMoveLine</a></h3> <h3 class="function"><a id="pdfioContentTextMoveLine">pdfioContentTextMoveLine</a></h3>
<p class="description">Move to the next line and offset.</p> <p class="description">Move to the next line and offset.</p>
<p class="code"> <p class="code">
@ -3490,7 +3497,7 @@ any control characters (such as newlines) are ignored.</p>
</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="pdfioContentTextNewLine">pdfioContentTextNewLine</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioContentTextNewLine">pdfioContentTextNewLine</a></h3>
<p class="description">Move to the next line.</p> <p class="description">Move to the next line.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioContentTextNewLine(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p> <span class="reserved">bool</span> pdfioContentTextNewLine(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
@ -3501,7 +3508,7 @@ any control characters (such as newlines) are ignored.</p>
</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="pdfioContentTextNewLineShow">pdfioContentTextNewLineShow</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioContentTextNewLineShow">pdfioContentTextNewLineShow</a></h3>
<p class="description">Move to the next line and show text.</p> <p class="description">Move to the next line and show text.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioContentTextNewLineShow(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> ws, <span class="reserved">double</span> cs, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p> <span class="reserved">bool</span> pdfioContentTextNewLineShow(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> ws, <span class="reserved">double</span> cs, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p>
@ -3524,8 +3531,10 @@ any control characters (such as newlines) are ignored.</p>
<p class="discussion">This function moves to the next line and then shows some text with optional <p class="discussion">This function moves to the next line and then shows some text with optional
word and character spacing in a PDF content stream. The &quot;unicode&quot; argument word and character spacing 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 that the current font maps to full Unicode. The &quot;s&quot; argument
specifies a UTF-8 encoded string.</p> specifies a UTF-8 encoded string.
<h3 class="function"><a id="pdfioContentTextNewLineShowf">pdfioContentTextNewLineShowf</a></h3>
</p>
<h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioContentTextNewLineShowf">pdfioContentTextNewLineShowf</a></h3>
<p class="description">Show formatted text.</p> <p class="description">Show formatted text.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioContentTextNewLineShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> ws, <span class="reserved">double</span> cs, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p> <span class="reserved">bool</span> pdfioContentTextNewLineShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> ws, <span class="reserved">double</span> cs, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
@ -3550,7 +3559,9 @@ specifies a UTF-8 encoded string.</p>
<p class="discussion">This function moves to the next line and shows some formatted text with <p class="discussion">This function moves to the next line and shows some formatted text with
optional word and character spacing in a PDF content stream. The &quot;unicode&quot; optional word and character spacing 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 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> argument specifies a UTF-8 encoded <code>printf</code>-style format string.
</p>
<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">
@ -3613,7 +3624,7 @@ argument specifies an array of UTF-8 encoded strings.</p>
<p class="discussion">This function shows some formatted text in a PDF content stream. The <p class="discussion">This function shows some formatted text in a PDF content stream. The
&quot;unicode&quot; argument specifies that the current font maps to full Unicode. &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> The &quot;format&quot; argument specifies a UTF-8 encoded <code>printf</code>-style format string.</p>
<h3 class="function"><a id="pdfioDictClear">pdfioDictClear</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioDictClear">pdfioDictClear</a></h3>
<p class="description">Remove a key/value pair from a dictionary.</p> <p class="description">Remove a key/value pair from a dictionary.</p>
<p class="code"> <p class="code">
<span class="reserved">bool</span> pdfioDictClear(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p> <span class="reserved">bool</span> pdfioDictClear(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
@ -3717,7 +3728,7 @@ time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span cl
</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="pdfioDictGetKey">pdfioDictGetKey</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioDictGetKey">pdfioDictGetKey</a></h3>
<p class="description">Get the key for the specified pair.</p> <p class="description">Get the key for the specified pair.</p>
<p class="code"> <p class="code">
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioDictGetKey(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, size_t n);</p> <span class="reserved">const</span> <span class="reserved">char</span> *pdfioDictGetKey(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, size_t n);</p>
@ -3743,7 +3754,7 @@ time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span cl
</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="pdfioDictGetNumPairs">pdfioDictGetNumPairs</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioDictGetNumPairs">pdfioDictGetNumPairs</a></h3>
<p class="description">Get the number of key/value pairs in a dictionary.</p> <p class="description">Get the number of key/value pairs in a dictionary.</p>
<p class="code"> <p class="code">
size_t pdfioDictGetNumPairs(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p> size_t pdfioDictGetNumPairs(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p>
@ -3821,7 +3832,7 @@ size_t pdfioDictGetNumPairs(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Value type</p> <p class="description">Value type</p>
<h3 class="function"><a id="pdfioDictIterateKeys">pdfioDictIterateKeys</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.1&#160;</span><a id="pdfioDictIterateKeys">pdfioDictIterateKeys</a></h3>
<p class="description">Iterate the keys in a dictionary.</p> <p class="description">Iterate the keys in a dictionary.</p>
<p class="code"> <p class="code">
<span class="reserved">void</span> pdfioDictIterateKeys(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <a href="#pdfio_dict_cb_t">pdfio_dict_cb_t</a> cb, <span class="reserved">void</span> *cb_data);</p> <span class="reserved">void</span> pdfioDictIterateKeys(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <a href="#pdfio_dict_cb_t">pdfio_dict_cb_t</a> cb, <span class="reserved">void</span> *cb_data);</p>
@ -3848,7 +3859,9 @@ my_dict_cb(pdfio_dict_t *dict, const char *key, void *cb_data)
</pre> </pre>
The iteration continues as long as the callback returns <code>true</code> or all keys The iteration continues as long as the callback returns <code>true</code> or all keys
have been iterated.</p> have been iterated.
</p>
<h3 class="function"><a id="pdfioDictSetArray">pdfioDictSetArray</a></h3> <h3 class="function"><a id="pdfioDictSetArray">pdfioDictSetArray</a></h3>
<p class="description">Set a key array in a dictionary.</p> <p class="description">Set a key array in a dictionary.</p>
<p class="code"> <p class="code">
@ -4031,6 +4044,46 @@ have been iterated.</p>
</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"><span class="info">&#160;PDFio 1.6&#160;</span><a id="pdfioFileAddOutputIntent">pdfioFileAddOutputIntent</a></h3>
<p class="description">Add an OutputIntent to a file.</p>
<p class="code">
<span class="reserved">void</span> pdfioFileAddOutputIntent(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *subtype, <span class="reserved">const</span> <span class="reserved">char</span> *condition, <span class="reserved">const</span> <span class="reserved">char</span> *cond_id, <span class="reserved">const</span> <span class="reserved">char</span> *reg_name, <span class="reserved">const</span> <span class="reserved">char</span> *info, <a href="#pdfio_obj_t">pdfio_obj_t</a> *profile);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>subtype</th>
<td class="description">Intent subtype (standard)</td></tr>
<tr><th>condition</th>
<td class="description">Condition name or <code>NULL</code> for none</td></tr>
<tr><th>cond_id</th>
<td class="description">Identifier such as registration name or <code>NULL</code> for none</td></tr>
<tr><th>reg_name</th>
<td class="description">Registry URL or <code>NULL</code> for none</td></tr>
<tr><th>info</th>
<td class="description">Description or <code>NULL</code> for none</td></tr>
<tr><th>profile</th>
<td class="description">ICC profile object or <code>NULL</code> for none</td></tr>
</tbody></table>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function adds an OutputIntent dictionary to the PDF file catalog.
The &quot;subtype&quot; argument specifies the intent subtype and is typically
&quot;GTS_PDFX&quot; for PDF/X, &quot;GTS_PDFA1&quot; for PDF/A, or &quot;ISO_PDFE1&quot; for PDF/E.
Passing <code>NULL</code> defaults the subtype to &quot;GTS_PDFA1&quot;.<br>
<br>
The &quot;condition&quot; argument specifies a short name for the output intent, while
the &quot;info&quot; argument specifies a longer description for the output intent.
Both can be <code>NULL</code> to omit this information.<br>
<br>
The &quot;cond_id&quot; argument specifies a unique identifier such as a registration
(&quot;CGATS001&quot;) or color space name (&quot;sRGB&quot;). The &quot;reg_name&quot; argument provides
a URL for the identifier.<br>
<br>
The &quot;profile&quot; argument specifies an ICC profile object for the output
condition. If <code>NULL</code>, the PDF consumer will attempt to look up the correct
profile using the &quot;cond_id&quot; value.
</p>
<h3 class="function"><a id="pdfioFileClose">pdfioFileClose</a></h3> <h3 class="function"><a id="pdfioFileClose">pdfioFileClose</a></h3>
<p class="description">Close a PDF file and free all memory used for it.</p> <p class="description">Close a PDF file and free all memory used for it.</p>
<p class="code"> <p class="code">
@ -4143,8 +4196,33 @@ specifies the font nane:
<p class="discussion">Aside from &quot;Symbol&quot; and &quot;Zapf-Dingbats&quot;, Base fonts use the Windows CP1252 <p class="discussion">Aside from &quot;Symbol&quot; and &quot;Zapf-Dingbats&quot;, Base fonts use the Windows CP1252
(ISO-8859-1 with additional characters such as the Euro symbol) subset of (ISO-8859-1 with additional characters such as the Euro symbol) subset of
Unicode.</p> Unicode.</p>
<h3 class="function"><span class="info">&#160;PDFio v1.6&#160;</span><a id="pdfioFileCreateFontObjFromData">pdfioFileCreateFontObjFromData</a></h3>
<p class="description">Add a font in memory to a PDF file.</p>
<p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromData(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">void</span> *data, size_t datasize, <span class="reserved">bool</span> unicode);</p>
<h4 class="parameters">Parameters</h4>
<table class="list"><tbody>
<tr><th>pdf</th>
<td class="description">PDF file</td></tr>
<tr><th>data</th>
<td class="description">Font data in memory</td></tr>
<tr><th>datasize</th>
<td class="description">Size of font in memory</td></tr>
<tr><th>unicode</th>
<td class="description">Force Unicode</td></tr>
</tbody></table>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Font object</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function embeds TrueType/OpenType font data 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="pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></h3> <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 file to a PDF file.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *filename, <span class="reserved">bool</span> unicode);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *filename, <span class="reserved">bool</span> unicode);</p>
<h4 class="parameters">Parameters</h4> <h4 class="parameters">Parameters</h4>
@ -4159,7 +4237,7 @@ Unicode.</p>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Font object</p> <p class="description">Font object</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function embeds a TrueType/OpenType font into a PDF file. The <p class="discussion">This function embeds a TrueType/OpenType font file into a PDF file. The
&quot;unicode&quot; parameter controls whether the font is encoded for two-byte &quot;unicode&quot; parameter controls whether the font is encoded for two-byte
characters (potentially full Unicode, but more typically a subset) characters (potentially full Unicode, but more typically a subset)
or to only support the Windows CP1252 (ISO-8859-1 with additional or to only support the Windows CP1252 (ISO-8859-1 with additional
@ -4260,7 +4338,7 @@ image on the page.<br>
Note: Currently PNG support is limited to grayscale, RGB, or indexed files Note: Currently PNG support is limited to grayscale, RGB, or indexed files
without interlacing or alpha. Transparency (masking) based on color/index without interlacing or alpha. Transparency (masking) based on color/index
is supported.</blockquote> is supported.</blockquote>
<h3 class="function"><a id="pdfioFileCreateNameObj">pdfioFileCreateNameObj</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioFileCreateNameObj">pdfioFileCreateNameObj</a></h3>
<p class="description">Create a new object in a PDF file containing a name.</p> <p class="description">Create a new object in a PDF file containing a name.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateNameObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateNameObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
@ -4275,8 +4353,10 @@ is supported.</blockquote>
<p class="description">New object</p> <p class="description">New object</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function creates a new object with a name value in a PDF file. <p class="discussion">This function creates a new object with a name value in a PDF file.
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.</p> You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.
<h3 class="function"><a id="pdfioFileCreateNumberObj">pdfioFileCreateNumberObj</a></h3>
</p>
<h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioFileCreateNumberObj">pdfioFileCreateNumberObj</a></h3>
<p class="description">Create a new object in a PDF file containing a number.</p> <p class="description">Create a new object in a PDF file containing a number.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateNumberObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">double</span> number);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateNumberObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">double</span> number);</p>
@ -4291,7 +4371,9 @@ You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write t
<p class="description">New object</p> <p class="description">New object</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function creates a new object with a number value in a PDF file. <p class="discussion">This function creates a new object with a number value in a PDF file.
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.</p> You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.
</p>
<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">
@ -4372,7 +4454,7 @@ stored as indirect object references.</blockquote>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Contents stream</p> <p class="description">Contents stream</p>
<h3 class="function"><a id="pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.2&#160;</span><a id="pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></h3>
<p class="description">Create a new object in a PDF file containing a string.</p> <p class="description">Create a new object in a PDF file containing a string.</p>
<p class="code"> <p class="code">
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateStringObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *string);</p> <a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateStringObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *string);</p>
@ -4387,7 +4469,9 @@ stored as indirect object references.</blockquote>
<p class="description">New object</p> <p class="description">New object</p>
<h4 class="discussion">Discussion</h4> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function creates a new object with a string value in a PDF file. <p class="discussion">This function creates a new object with a string value in a PDF file.
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.</p> You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.
</p>
<h3 class="function"><a id="pdfioFileCreateTemporary">pdfioFileCreateTemporary</a></h3> <h3 class="function"><a id="pdfioFileCreateTemporary">pdfioFileCreateTemporary</a></h3>
<p class="description"></p> <p class="description"></p>
<p class="code"> <p class="code">
@ -4510,6 +4594,24 @@ time_t pdfioFileGetCreationDate(<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">Keywords string or <code>NULL</code> for none</p> <p class="description">Keywords string or <code>NULL</code> for none</p>
<h3 class="function"><span class="info">&#160;PDFio 1.6&#160;</span><a id="pdfioFileGetLanguage">pdfioFileGetLanguage</a></h3>
<p class="description">Get the language metadata for a PDF file.</p>
<p class="code">
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetLanguage(<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">Language or <code>NULL</code> for none</p>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function gets the (primary/default) language metadata, if any, for a PDF
file. The returned string is an IETF BCP 47 language tag of the form
&quot;lang-REGION&quot;. For example, the string &quot;en-CA&quot; specifies Canadian English
and the string &quot;fr-CA&quot; specifies Canadian French.
</p>
<h3 class="function"><a id="pdfioFileGetModificationDate">pdfioFileGetModificationDate</a></h3> <h3 class="function"><a id="pdfioFileGetModificationDate">pdfioFileGetModificationDate</a></h3>
<p class="description">Get the most recent modification date for a PDF file.</p> <p class="description">Get the most recent modification date for a PDF file.</p>
<p class="code"> <p class="code">
@ -4716,6 +4818,24 @@ writes error messages to <code>stderr</code>.</p>
<tr><th>value</th> <tr><th>value</th>
<td class="description">Value</td></tr> <td class="description">Value</td></tr>
</tbody></table> </tbody></table>
<h3 class="function"><span class="info">&#160;PDFio 1.6&#160;</span><a id="pdfioFileSetLanguage">pdfioFileSetLanguage</a></h3>
<p class="description">Set the language metadata for a PDF file.</p>
<p class="code">
<span class="reserved">void</span> pdfioFileSetLanguage(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *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>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function sets the (primary/default) language metadata for a PDF file.
The &quot;value&quot; argument is an IETF BCP 47 language tag string of the form
&quot;lang-REGION&quot;. For example, the string &quot;en-CA&quot; specifies Canadian English
and the string &quot;fr-CA&quot; specifies Canadian French.
</p>
<h3 class="function"><a id="pdfioFileSetModificationDate">pdfioFileSetModificationDate</a></h3> <h3 class="function"><a id="pdfioFileSetModificationDate">pdfioFileSetModificationDate</a></h3>
<p class="description">Set the modification date for a PDF file.</p> <p class="description">Set the modification date for a PDF file.</p>
<p class="code"> <p class="code">
@ -4892,7 +5012,7 @@ size_t pdfioObjGetLength(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
</tbody></table> </tbody></table>
<h4 class="returnvalue">Return Value</h4> <h4 class="returnvalue">Return Value</h4>
<p class="description">Length in bytes or <code>0</code> for none</p> <p class="description">Length in bytes or <code>0</code> for none</p>
<h3 class="function"><a id="pdfioObjGetName">pdfioObjGetName</a></h3> <h3 class="function"><span class="info">&#160;PDFio v1.4&#160;</span><a id="pdfioObjGetName">pdfioObjGetName</a></h3>
<p class="description">Get the name value associated with an object.</p> <p class="description">Get the name value associated with an object.</p>
<p class="code"> <p class="code">
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioObjGetName(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p> <span class="reserved">const</span> <span class="reserved">char</span> *pdfioObjGetName(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
@ -5168,8 +5288,9 @@ ssize_t pdfioStreamPeek(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span
<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> <h4 class="discussion">Discussion</h4>
<p class="discussion">This function writes a formatted string to a stream. In addition to the <p class="discussion">This function writes a formatted string to a stream. In addition to the
standard <code>printf</code> format characters, you can use &quot;%N&quot; to format a PDF name standard <code>printf</code> format characters, you can use &quot;%H&quot; to format a HTML/XML
value (&quot;/Name&quot;) and &quot;%S&quot; to format a PDF string (&quot;(String)&quot;) value.</p> string value, &quot;%N&quot; to format a PDF name value (&quot;/Name&quot;), and &quot;%S&quot; to format
a PDF string (&quot;(String)&quot;) value.</p>
<h3 class="function"><a id="pdfioStreamPutChar">pdfioStreamPutChar</a></h3> <h3 class="function"><a id="pdfioStreamPutChar">pdfioStreamPutChar</a></h3>
<p class="description">Write a single character to a stream.</p> <p class="description">Write a single character to a stream.</p>
<p class="code"> <p class="code">
@ -5393,6 +5514,7 @@ typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
<h4 class="constants">Constants</h4> <h4 class="constants">Constants</h4>
<table class="list"><tbody> <table class="list"><tbody>
<tr><th>PDFIO_CS_ADOBE </th><td class="description">AdobeRGB 1998</td></tr> <tr><th>PDFIO_CS_ADOBE </th><td class="description">AdobeRGB 1998</td></tr>
<tr><th>PDFIO_CS_CGATS001 </th><td class="description">CGATS001 (CMYK)</td></tr>
<tr><th>PDFIO_CS_P3_D65 </th><td class="description">Display P3</td></tr> <tr><th>PDFIO_CS_P3_D65 </th><td class="description">Display P3</td></tr>
<tr><th>PDFIO_CS_SRGB </th><td class="description">sRGB</td></tr> <tr><th>PDFIO_CS_SRGB </th><td class="description">sRGB</td></tr>
</tbody></table> </tbody></table>
@ -5403,7 +5525,7 @@ typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
<tr><th>PDFIO_ENCRYPTION_AES_128 </th><td class="description">128-bit AES encryption (PDF 1.6)</td></tr> <tr><th>PDFIO_ENCRYPTION_AES_128 </th><td class="description">128-bit AES encryption (PDF 1.6)</td></tr>
<tr><th>PDFIO_ENCRYPTION_NONE </th><td class="description">No encryption</td></tr> <tr><th>PDFIO_ENCRYPTION_NONE </th><td class="description">No encryption</td></tr>
<tr><th>PDFIO_ENCRYPTION_RC4_128 </th><td class="description">128-bit RC4 encryption (PDF 1.4)</td></tr> <tr><th>PDFIO_ENCRYPTION_RC4_128 </th><td class="description">128-bit RC4 encryption (PDF 1.4)</td></tr>
<tr><th>PDFIO_ENCRYPTION_RC4_40 </th><td class="description">40-bit RC4 encryption (PDF 1.3)</td></tr> <tr><th>PDFIO_ENCRYPTION_RC4_40 </th><td class="description">40-bit RC4 encryption (PDF 1.3, reading only)</td></tr>
</tbody></table> </tbody></table>
<h3 class="enumeration"><a id="pdfio_filter_e">pdfio_filter_e</a></h3> <h3 class="enumeration"><a id="pdfio_filter_e">pdfio_filter_e</a></h3>
<p class="description">Compression/decompression filters for streams</p> <p class="description">Compression/decompression filters for streams</p>

View File

@ -640,6 +640,8 @@ _pdfioArrayRead(pdfio_file_t *pdf, // I - PDF file
// //
// 'pdfioArrayRemove()' - Remove an array entry. // 'pdfioArrayRemove()' - Remove an array entry.
// //
// @since PDFio v1.4@
//
bool // O - `true` on success, `false` otherwise bool // O - `true` on success, `false` otherwise
pdfioArrayRemove(pdfio_array_t *a, // I - Array pdfioArrayRemove(pdfio_array_t *a, // I - Array

View File

@ -643,6 +643,8 @@ pdfioContentPathCurve23(
// //
// 'pdfioContentPathEnd()' - Clear the current path. // 'pdfioContentPathEnd()' - Clear the current path.
// //
// @since PDFio v1.1@
//
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure
pdfioContentPathEnd(pdfio_stream_t *st) // I - Stream pdfioContentPathEnd(pdfio_stream_t *st) // I - Stream
@ -1122,6 +1124,8 @@ pdfioContentTextEnd(pdfio_stream_t *st) // I - Stream
// on "size". The text string must always use the UTF-8 (Unicode) encoding but // on "size". The text string must always use the UTF-8 (Unicode) encoding but
// any control characters (such as newlines) are ignored. // any control characters (such as newlines) are ignored.
// //
// @since PDFio v1.2@
//
double // O - Width double // O - Width
pdfioContentTextMeasure( pdfioContentTextMeasure(
@ -1278,6 +1282,8 @@ pdfioContentTextMoveTo(
// //
// 'pdfioContentTextNewLine()' - Move to the next line. // 'pdfioContentTextNewLine()' - Move to the next line.
// //
// @since PDFio v1.2@
//
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure
pdfioContentTextNewLine( pdfioContentTextNewLine(
@ -1309,6 +1315,8 @@ pdfioContentTextNextLine(
// specifies that the current font maps to full Unicode. The "s" argument // specifies that the current font maps to full Unicode. The "s" argument
// specifies a UTF-8 encoded string. // specifies a UTF-8 encoded string.
// //
// @since PDFio v1.2@
//
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure
pdfioContentTextNewLineShow( pdfioContentTextNewLineShow(
@ -1357,6 +1365,8 @@ pdfioContentTextNewLineShow(
// argument specifies that the current font maps to full Unicode. The "format" // argument specifies that the current font maps to full Unicode. The "format"
// argument specifies a UTF-8 encoded `printf`-style format string. // argument specifies a UTF-8 encoded `printf`-style format string.
// //
// @since PDFio v1.2@
//
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure
pdfioContentTextNewLineShowf( pdfioContentTextNewLineShowf(
@ -1537,7 +1547,7 @@ pdfioFileAddOutputIntent(
} }
// Get the OutputIntents array... // Get the OutputIntents array...
if ((output_intents = pdfioDictGetArray(pdfioObjGetDict(pdf->info_obj), "OutputIntents")) != NULL) if ((output_intents = pdfioDictGetArray(pdfioFileGetCatalog(pdf), "OutputIntents")) != NULL)
{ {
// See if we already have an intent for the given subtype... // See if we already have an intent for the given subtype...
size_t i, // Looping var size_t i, // Looping var
@ -1561,7 +1571,7 @@ pdfioFileAddOutputIntent(
if ((output_intents = pdfioArrayCreate(pdf)) == NULL) if ((output_intents = pdfioArrayCreate(pdf)) == NULL)
return; return;
pdfioDictSetArray(pdfioObjGetDict(pdf->info_obj), "OutputIntents", output_intents); pdfioDictSetArray(pdfioFileGetCatalog(pdf), "OutputIntents", output_intents);
} }
// Create an intent dictionary... // Create an intent dictionary...
@ -1652,6 +1662,8 @@ pdfioFileCreateFontObjFromBase(
// or to only support the Windows CP1252 (ISO-8859-1 with additional // or to only support the Windows CP1252 (ISO-8859-1 with additional
// characters such as the Euro symbol) subset of Unicode. // characters such as the Euro symbol) subset of Unicode.
// //
// @since PDFio v1.6@
//
pdfio_obj_t * // O - Font object pdfio_obj_t * // O - Font object
pdfioFileCreateFontObjFromData( pdfioFileCreateFontObjFromData(

View File

@ -20,6 +20,8 @@ static int compare_pairs(_pdfio_pair_t *a, _pdfio_pair_t *b);
// //
// 'pdfioDictClear()' - Remove a key/value pair from a dictionary. // 'pdfioDictClear()' - Remove a key/value pair from a dictionary.
// //
// @since PDFio v1.4@
//
bool // O - `true` if cleared, `false` otherwise bool // O - `true` if cleared, `false` otherwise
pdfioDictClear(pdfio_dict_t *dict, // I - Dictionary pdfioDictClear(pdfio_dict_t *dict, // I - Dictionary
@ -345,6 +347,8 @@ pdfioDictGetDict(pdfio_dict_t *dict, // I - Dictionary
// //
// 'pdfioDictGetKey()' - Get the key for the specified pair. // 'pdfioDictGetKey()' - Get the key for the specified pair.
// //
// @since PDFio v1.4@
//
const char * // O - Key for specified pair const char * // O - Key for specified pair
pdfioDictGetKey(pdfio_dict_t *dict, // I - Dictionary pdfioDictGetKey(pdfio_dict_t *dict, // I - Dictionary
@ -375,6 +379,8 @@ pdfioDictGetName(pdfio_dict_t *dict, // I - Dictionary
// //
// 'pdfioDictGetNumPairs()' - Get the number of key/value pairs in a dictionary. // 'pdfioDictGetNumPairs()' - Get the number of key/value pairs in a dictionary.
// //
// @since PDFio v1.4@
//
size_t // O - Number of pairs size_t // O - Number of pairs
pdfioDictGetNumPairs(pdfio_dict_t *dict)// I - Dictionary pdfioDictGetNumPairs(pdfio_dict_t *dict)// I - Dictionary
@ -562,6 +568,8 @@ _pdfioDictGetValue(pdfio_dict_t *dict, // I - Dictionary
// The iteration continues as long as the callback returns `true` or all keys // The iteration continues as long as the callback returns `true` or all keys
// have been iterated. // have been iterated.
// //
// @since PDFio v1.1@
//
void void
pdfioDictIterateKeys( pdfioDictIterateKeys(

View File

@ -22,11 +22,13 @@ static pdfio_obj_t *add_obj(pdfio_file_t *pdf, size_t number, unsigned short gen
static int compare_objmaps(_pdfio_objmap_t *a, _pdfio_objmap_t *b); static int compare_objmaps(_pdfio_objmap_t *a, _pdfio_objmap_t *b);
static pdfio_file_t *create_common(const char *filename, int fd, pdfio_output_cb_t output_cb, void *output_cbdata, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_cbdata); static pdfio_file_t *create_common(const char *filename, int fd, pdfio_output_cb_t output_cb, void *output_cbdata, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_cbdata);
static const char *get_info_string(pdfio_file_t *pdf, const char *key); static const char *get_info_string(pdfio_file_t *pdf, const char *key);
static char *get_iso_date(time_t t, char *buffer, size_t bufsize);
static struct lconv *get_lconv(void); static struct lconv *get_lconv(void);
static bool load_obj_stream(pdfio_obj_t *obj); static bool load_obj_stream(pdfio_obj_t *obj);
static bool load_pages(pdfio_file_t *pdf, pdfio_obj_t *obj, size_t depth); static bool load_pages(pdfio_file_t *pdf, pdfio_obj_t *obj, size_t depth);
static bool load_xref(pdfio_file_t *pdf, off_t xref_offset, pdfio_password_cb_t password_cb, void *password_data); static bool load_xref(pdfio_file_t *pdf, off_t xref_offset, pdfio_password_cb_t password_cb, void *password_data);
static bool repair_xref(pdfio_file_t *pdf, pdfio_password_cb_t password_cb, void *password_data); static bool repair_xref(pdfio_file_t *pdf, pdfio_password_cb_t password_cb, void *password_data);
static bool write_metadata(pdfio_file_t *pdf);
static bool write_pages(pdfio_file_t *pdf); static bool write_pages(pdfio_file_t *pdf);
static bool write_trailer(pdfio_file_t *pdf); static bool write_trailer(pdfio_file_t *pdf);
@ -125,10 +127,10 @@ pdfioFileClose(pdfio_file_t *pdf) // I - PDF file
ret = false; ret = false;
// Add default OutputIntent for PDF/A CMYK printing... // Add default OutputIntent for PDF/A CMYK printing...
pdfioFileAddOutputIntent(pdf, /*subtype*/"GTS_PDFA1", /*condition*/"CMYK", /*cond_id*/"CGATS001", /*reg_name*/NULL, /*info*/"CMYK Printing", /*profile*/pdf->cgats001_obj); pdfioFileAddOutputIntent(pdf, /*subtype*/"GTS_PDFA1", /*condition*/"CMYK", /*cond_id*/"CGATS001", /*reg_name*/NULL, /*info*/"CMYK Printing", /*profile*/NULL);
// Close and write out the last bits... // Close and write out the last bits...
if (pdfioObjClose(pdf->info_obj) && write_pages(pdf) && pdfioObjClose(pdf->root_obj) && write_trailer(pdf)) if (write_metadata(pdf) && pdfioObjClose(pdf->info_obj) && write_pages(pdf) && pdfioObjClose(pdf->root_obj) && write_trailer(pdf))
ret = _pdfioFileFlush(pdf); ret = _pdfioFileFlush(pdf);
} }
@ -265,6 +267,8 @@ pdfioFileCreateArrayObj(
// This function creates a new object with a name value in a PDF file. // This function creates a new object with a name value in a PDF file.
// You must call @link pdfioObjClose@ to write the object to the file. // You must call @link pdfioObjClose@ to write the object to the file.
// //
// @since PDFio v1.4@
//
pdfio_obj_t * // O - New object pdfio_obj_t * // O - New object
pdfioFileCreateNameObj( pdfioFileCreateNameObj(
@ -294,6 +298,8 @@ pdfioFileCreateNameObj(
// This function creates a new object with a number value in a PDF file. // This function creates a new object with a number value in a PDF file.
// You must call @link pdfioObjClose@ to write the object to the file. // You must call @link pdfioObjClose@ to write the object to the file.
// //
// @since PDFio v1.2@
//
pdfio_obj_t * // O - New object pdfio_obj_t * // O - New object
pdfioFileCreateNumberObj( pdfioFileCreateNumberObj(
@ -524,6 +530,8 @@ pdfioFileCreatePage(pdfio_file_t *pdf, // I - PDF file
// This function creates a new object with a string value in a PDF file. // This function creates a new object with a string value in a PDF file.
// You must call @link pdfioObjClose@ to write the object to the file. // You must call @link pdfioObjClose@ to write the object to the file.
// //
// @since PDFio v1.2@
//
pdfio_obj_t * // O - New object pdfio_obj_t * // O - New object
pdfioFileCreateStringObj( pdfioFileCreateStringObj(
@ -830,6 +838,24 @@ pdfioFileGetKeywords(pdfio_file_t *pdf) // I - PDF file
} }
//
// 'pdfioFileGetLanguage()' - Get the language metadata for a PDF file.
//
// This function gets the (primary/default) language metadata, if any, for a PDF
// file. The returned string is an IETF BCP 47 language tag of the form
// "lang-REGION". For example, the string "en-CA" specifies Canadian English
// and the string "fr-CA" specifies Canadian French.
//
// @since PDFio 1.6@
//
const char * // O - Language or `NULL` for none
pdfioFileGetLanguage(pdfio_file_t *pdf) // I - PDF file
{
return (pdfioDictGetString(pdfioFileGetCatalog(pdf), "Lang"));
}
// //
// 'pdfioFileGetModificationDate()' - Get the most recent modification date for a PDF file. // 'pdfioFileGetModificationDate()' - Get the most recent modification date for a PDF file.
// //
@ -1170,6 +1196,26 @@ pdfioFileSetKeywords(
} }
//
// 'pdfioFileSetLanguage()' - Set the language metadata for a PDF file.
//
// This function sets the (primary/default) language metadata for a PDF file.
// The "value" argument is an IETF BCP 47 language tag string of the form
// "lang-REGION". For example, the string "en-CA" specifies Canadian English
// and the string "fr-CA" specifies Canadian French.
//
// @since PDFio 1.6@
//
void
pdfioFileSetLanguage(
pdfio_file_t *pdf, // I - PDF file
const char *value) // I - Value
{
pdfioDictSetString(pdfioFileGetCatalog(pdf), "Lang", value);
}
// //
// 'pdfioFileSetModificationDate()' - Set the modification date for a PDF file. // 'pdfioFileSetModificationDate()' - Set the modification date for a PDF file.
// //
@ -1536,6 +1582,32 @@ get_info_string(pdfio_file_t *pdf, // I - PDF file
} }
//
// 'get_iso_date()' - Convert a time_t value to an ISO 8601 date/time value.
//
static char * // O - Date string
get_iso_date(time_t t, // I - Time value in seconds
char *buffer, // I - Date buffer
size_t bufsize) // I - Size of date buffer
{
struct tm d; // Date values
// Convert time to UTC date
#if _WIN32
gmtime_s(&d, &t);
#else
gmtime_r(&t, &d);
#endif // _WIN32
// Format the string and return...
snprintf(buffer, bufsize, "%04d-%02d-%02dT%02d:%02d:%02dZ", d.tm_year + 1900, d.tm_mon + 1, d.tm_mday, d.tm_hour, d.tm_min, d.tm_sec);
return (buffer);
}
// //
// 'get_lconv()' - Get any locale-specific numeric information. // 'get_lconv()' - Get any locale-specific numeric information.
// //
@ -2360,6 +2432,89 @@ repair_xref(
} }
//
// 'write_metadata()' - Write an XMP metadata stream.
//
static bool // O - `true` on success, `false` on failure
write_metadata(pdfio_file_t *pdf) // I - PDF file
{
pdfio_dict_t *dict; // XMP object dictionary
pdfio_obj_t *obj; // XMP object
pdfio_stream_t *st; // XMP stream
bool status = true; // Write status
const char *value; // Value from info dictionary
time_t t; // Date/time value in seconds
char d[64]; // Date/time string (ISO 8601)
// Create the Metadata object...
if ((dict = pdfioDictCreate(pdf)) == NULL)
return (false);
pdfioDictSetName(dict, "Type", "Metadata");
pdfioDictSetName(dict, "Subtype", "XML");
if ((obj = pdfioFileCreateObj(pdf, dict)) == NULL)
return (false);
// Write the XMP stream...
if ((st = pdfioObjCreateStream(obj, PDFIO_FILTER_NONE)) == NULL)
return (false);
status &= pdfioStreamPuts(st, "<?xpacket begin=\"\" id=\"W5M0MpCehiHzreSzNTczkc9d\"?>\n");
status &= pdfioStreamPuts(st, "<x:xmpmeta xmlns:x=\"adobe:ns:meta/\">\n");
status &= pdfioStreamPuts(st, " <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n");
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:xmp=\"http://ns.adobe.com/xap/1.0/\">\n");
t = pdfioFileGetCreationDate(pdf);
status &= pdfioStreamPrintf(st, " <xmp:CreateDate>%H</xmp:CreateDate>\n", get_iso_date(t, d, sizeof(d)));
if ((value = pdfioFileGetCreator(pdf)) != NULL)
status &= pdfioStreamPrintf(st, " <xmp:CreatorTool>%H</xmp:CreatorTool>\n", value);
status &= pdfioStreamPrintf(st, " <xmp:MetadataDate>%H</xmp:MetadataDate>\n", d);
if ((t = pdfioFileGetModificationDate(pdf)) > 0)
status &= pdfioStreamPrintf(st, " <xmp:ModifyDate>%H</xmp:ModifyDate>\n", get_iso_date(t, d, sizeof(d)));
status &= pdfioStreamPuts(st, " </rdf:Description>\n");
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:pdf=\"http://ns.adobe.com/pdf/1.3/\">\n");
status &= pdfioStreamPrintf(st, " <pdf:Producer>%H</pdf:Producer>\n", pdfioFileGetProducer(pdf));
if ((value = pdfioFileGetKeywords(pdf)) != NULL)
status &= pdfioStreamPrintf(st, " <pdf:Keywords>%H</pdf:Keywords>\n", value);
status &= pdfioStreamPuts(st, " </rdf:Description>\n");
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n");
status &= pdfioStreamPrintf(st, " <dc:format>application/pdf</dc:format>\n");
if ((value = pdfioFileGetTitle(pdf)) != NULL)
status &= pdfioStreamPrintf(st, " <dc:title><rdf:Alt><rdf:li xml:lang=\"x-default\">%H</rdf:li></rdf:Alt></dc:title>\n", value);
if ((value = pdfioFileGetAuthor(pdf)) != NULL)
status &= pdfioStreamPrintf(st, " <dc:creator><rdf:Seq><rdf:li>%H</rdf:li></rdf:Seq></dc:creator>\n", value);
if ((value = pdfioFileGetSubject(pdf)) != NULL)
status &= pdfioStreamPrintf(st, " <dc:description><rdf:Alt><rdf:li xml:lang=\"x-default\">%H</rdf:li></rdf:Alt></dc:description>\n", value);
status &= pdfioStreamPuts(st, " </rdf:Description>\n");
// TODO: Need a better way to choose the output profile - something that lets
// us choose the base PDF version and PDF/A, PDF/E, PDF/X, etc.
#if 0
status &= pdfioStreamPuts(st, " <rdf:Description rdf:about=\"\" xmlns:pdfaid=\"http://www.aiim.org/pdfa/ns/id/\">\n");
status &= pdfioStreamPuts(st, " <pdfaid:conformance>A</pdfaid:conformance>\n");
status &= pdfioStreamPuts(st, " <pdfaid:part>1</pdfaid:part>\n");
status &= pdfioStreamPuts(st, " </rdf:Description>\n");
#endif // 0
status &= pdfioStreamPuts(st, " </rdf:RDF>\n");
status &= pdfioStreamPuts(st, "</x:xmpmeta>\n");
status &= pdfioStreamPuts(st, "<?xpacket end=\"r\"?>\n");
status &= pdfioStreamClose(st);
if (!status)
return (false);
// If we get this far, add the Metadata key/value to the catalog/root object.
return (pdfioDictSetObj(pdfioFileGetCatalog(pdf), "Metadata", obj));
}
// //
// 'write_pages()' - Write the PDF pages objects. // 'write_pages()' - Write the PDF pages objects.
// //

View File

@ -330,6 +330,8 @@ pdfioObjGetLength(pdfio_obj_t *obj) // I - Object
// //
// 'pdfioObjGetName()' - Get the name value associated with an object. // 'pdfioObjGetName()' - Get the name value associated with an object.
// //
// @since PDFio v1.4@
//
const char * // O - Dictionary or `NULL` on error const char * // O - Dictionary or `NULL` on error
pdfioObjGetName(pdfio_obj_t *obj) // I - Object pdfioObjGetName(pdfio_obj_t *obj) // I - Object

View File

@ -690,8 +690,9 @@ pdfioStreamPeek(pdfio_stream_t *st, // I - Stream
// 'pdfioStreamPrintf()' - Write a formatted string to a stream. // 'pdfioStreamPrintf()' - Write a formatted string to a stream.
// //
// This function writes a formatted string to a stream. In addition to the // This function writes a formatted string to a stream. In addition to the
// standard `printf` format characters, you can use "%N" to format a PDF name // standard `printf` format characters, you can use "%H" to format a HTML/XML
// value ("/Name") and "%S" to format a PDF string ("(String)") value. // string value, "%N" to format a PDF name value ("/Name"), and "%S" to format
// a PDF string ("(String)") value.
// //
bool // O - `true` on success, `false` on failure bool // O - `true` on success, `false` on failure

View File

@ -486,6 +486,59 @@ _pdfio_vsnprintf(pdfio_file_t *pdf, // I - PDF file
} }
break; break;
case 'H' : // XML/HTML string
if ((s = va_arg(ap, char *)) == NULL)
s = "(null)";
// Loop through the literal string...
while (*s)
{
// Escape special characters
if (*s == '&')
{
// &amp;
if (bufptr < bufend)
{
_pdfio_strlcpy(bufptr, "&amp;", (size_t)(bufend - bufptr + 1));
bufptr += strlen(bufptr);
}
bytes += 5;
}
else if (*s == '<')
{
// &lt;
if (bufptr < bufend)
{
_pdfio_strlcpy(bufptr, "&lt;", (size_t)(bufend - bufptr + 1));
bufptr += strlen(bufptr);
}
bytes += 4;
}
else if (*s == '>')
{
// &gt;
if (bufptr < bufend)
{
_pdfio_strlcpy(bufptr, "&gt;", (size_t)(bufend - bufptr + 1));
bufptr += strlen(bufptr);
}
bytes += 4;
}
else
{
// Literal character...
if (bufptr < bufend)
*bufptr++ = *s;
bytes ++;
}
s ++;
}
break;
case 'S' : // PDF string case 'S' : // PDF string
if ((s = va_arg(ap, char *)) == NULL) if ((s = va_arg(ap, char *)) == NULL)
s = "(null)"; s = "(null)";

View File

@ -201,6 +201,7 @@ extern time_t pdfioFileGetCreationDate(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern const char *pdfioFileGetCreator(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern const char *pdfioFileGetCreator(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern pdfio_array_t *pdfioFileGetID(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern pdfio_array_t *pdfioFileGetID(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern const char *pdfioFileGetKeywords(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern const char *pdfioFileGetKeywords(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern const char *pdfioFileGetLanguage(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern time_t pdfioFileGetModificationDate(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern time_t pdfioFileGetModificationDate(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern const char *pdfioFileGetName(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern const char *pdfioFileGetName(pdfio_file_t *pdf) _PDFIO_PUBLIC;
extern size_t pdfioFileGetNumObjs(pdfio_file_t *pdf) _PDFIO_PUBLIC; extern size_t pdfioFileGetNumObjs(pdfio_file_t *pdf) _PDFIO_PUBLIC;
@ -217,6 +218,7 @@ extern void pdfioFileSetAuthor(pdfio_file_t *pdf, const char *value) _PDFIO_PUB
extern void pdfioFileSetCreationDate(pdfio_file_t *pdf, time_t value) _PDFIO_PUBLIC; extern void pdfioFileSetCreationDate(pdfio_file_t *pdf, time_t value) _PDFIO_PUBLIC;
extern void pdfioFileSetCreator(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC; extern void pdfioFileSetCreator(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC;
extern void pdfioFileSetKeywords(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC; extern void pdfioFileSetKeywords(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC;
extern void pdfioFileSetLanguage(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC;
extern void pdfioFileSetModificationDate(pdfio_file_t *pdf, time_t value) _PDFIO_PUBLIC; extern void pdfioFileSetModificationDate(pdfio_file_t *pdf, time_t value) _PDFIO_PUBLIC;
extern bool pdfioFileSetPermissions(pdfio_file_t *pdf, pdfio_permission_t permissions, pdfio_encryption_t encryption, const char *owner_password, const char *user_password) _PDFIO_PUBLIC; extern bool pdfioFileSetPermissions(pdfio_file_t *pdf, pdfio_permission_t permissions, pdfio_encryption_t encryption, const char *owner_password, const char *user_password) _PDFIO_PUBLIC;
extern void pdfioFileSetSubject(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC; extern void pdfioFileSetSubject(pdfio_file_t *pdf, const char *value) _PDFIO_PUBLIC;

View File

@ -1,20 +1,78 @@
LIBRARY pdfio1 LIBRARY pdfio1
VERSION 1.5 VERSION 1.6
EXPORTS EXPORTS
_pdfioArrayDebug
_pdfioArrayDecrypt
_pdfioArrayDelete
_pdfioArrayGetValue
_pdfioArrayRead
_pdfioArrayWrite
_pdfioCryptoAESDecrypt _pdfioCryptoAESDecrypt
_pdfioCryptoAESEncrypt _pdfioCryptoAESEncrypt
_pdfioCryptoAESInit _pdfioCryptoAESInit
_pdfioCryptoLock
_pdfioCryptoMD5Append _pdfioCryptoMD5Append
_pdfioCryptoMD5Finish _pdfioCryptoMD5Finish
_pdfioCryptoMD5Init _pdfioCryptoMD5Init
_pdfioCryptoMakeRandom
_pdfioCryptoMakeReader
_pdfioCryptoMakeWriter
_pdfioCryptoRC4Crypt _pdfioCryptoRC4Crypt
_pdfioCryptoRC4Init _pdfioCryptoRC4Init
_pdfioCryptoSHA256Append _pdfioCryptoSHA256Append
_pdfioCryptoSHA256Finish _pdfioCryptoSHA256Finish
_pdfioCryptoSHA256Init _pdfioCryptoSHA256Init
_pdfioCryptoUnlock
_pdfioDictDebug
_pdfioDictDecrypt
_pdfioDictDelete
_pdfioDictGetValue
_pdfioDictRead
_pdfioDictSetValue
_pdfioDictWrite
_pdfioFileAddMappedObj
_pdfioFileAddPage
_pdfioFileConsume
_pdfioFileCreateObj
_pdfioFileDefaultError
_pdfioFileError
_pdfioFileFindMappedObj
_pdfioFileFlush
_pdfioFileGetChar
_pdfioFileGets
_pdfioFilePeek
_pdfioFilePrintf
_pdfioFilePuts
_pdfioFileRead
_pdfioFileSeek
_pdfioFileTell
_pdfioFileWrite
_pdfioObjDelete
_pdfioObjGetExtension
_pdfioObjLoad
_pdfioObjSetExtension
_pdfioObjWriteHeader
_pdfioStreamCreate
_pdfioStreamOpen
_pdfioStringAllocBuffer
_pdfioStringFreeBuffer
_pdfioStringIsAllocated
_pdfioTokenClear
_pdfioTokenFlush
_pdfioTokenGet
_pdfioTokenInit _pdfioTokenInit
_pdfioTokenPush
_pdfioTokenRead
_pdfioValueCopy
_pdfioValueDebug _pdfioValueDebug
_pdfioValueDecrypt
_pdfioValueDelete
_pdfioValueRead _pdfioValueRead
_pdfioValueWrite
_pdfio_strlcpy
_pdfio_strtod
_pdfio_utf16cpy
_pdfio_vsnprintf
pdfioArrayAppendArray pdfioArrayAppendArray
pdfioArrayAppendBinary pdfioArrayAppendBinary
pdfioArrayAppendBoolean pdfioArrayAppendBoolean
@ -129,10 +187,12 @@ pdfioDictSetObj
pdfioDictSetRect pdfioDictSetRect
pdfioDictSetString pdfioDictSetString
pdfioDictSetStringf pdfioDictSetStringf
pdfioFileAddOutputIntent
pdfioFileClose pdfioFileClose
pdfioFileCreate pdfioFileCreate
pdfioFileCreateArrayObj pdfioFileCreateArrayObj
pdfioFileCreateFontObjFromBase pdfioFileCreateFontObjFromBase
pdfioFileCreateFontObjFromData
pdfioFileCreateFontObjFromFile pdfioFileCreateFontObjFromFile
pdfioFileCreateICCObjFromData pdfioFileCreateICCObjFromData
pdfioFileCreateICCObjFromFile pdfioFileCreateICCObjFromFile
@ -152,6 +212,7 @@ pdfioFileGetCreationDate
pdfioFileGetCreator pdfioFileGetCreator
pdfioFileGetID pdfioFileGetID
pdfioFileGetKeywords pdfioFileGetKeywords
pdfioFileGetLanguage
pdfioFileGetModificationDate pdfioFileGetModificationDate
pdfioFileGetName pdfioFileGetName
pdfioFileGetNumObjs pdfioFileGetNumObjs
@ -168,6 +229,7 @@ pdfioFileSetAuthor
pdfioFileSetCreationDate pdfioFileSetCreationDate
pdfioFileSetCreator pdfioFileSetCreator
pdfioFileSetKeywords pdfioFileSetKeywords
pdfioFileSetLanguage
pdfioFileSetModificationDate pdfioFileSetModificationDate
pdfioFileSetPermissions pdfioFileSetPermissions
pdfioFileSetSubject pdfioFileSetSubject

View File

@ -1399,18 +1399,18 @@ read_unit_file(const char *filename, // I - File to read
} }
fputs("pdfioDictGetString(Lang): ", stdout); fputs("pdfioDictGetString(Lang): ", stdout);
if ((s = pdfioDictGetString(catalog, "Lang")) != NULL && !strcmp(s, "en")) if ((s = pdfioDictGetString(catalog, "Lang")) != NULL && !strcmp(s, "en-CA"))
{ {
puts("PASS"); puts("PASS");
} }
else if (s) else if (s)
{ {
printf("FAIL (got '%s', expected 'en')\n", s); printf("FAIL (got '%s', expected 'en-CA')\n", s);
return (1); return (1);
} }
else else
{ {
puts("FAIL (got NULL, expected 'en')"); puts("FAIL (got NULL, expected 'en-CA')");
return (1); return (1);
} }
@ -3555,7 +3555,6 @@ write_unit_file(
// Set some catalog values... // Set some catalog values...
pdfioDictSetName(catalog, "PageLayout", "SinglePage"); pdfioDictSetName(catalog, "PageLayout", "SinglePage");
pdfioDictSetName(catalog, "PageMode", "UseThumbs"); pdfioDictSetName(catalog, "PageMode", "UseThumbs");
pdfioDictSetString(catalog, "Lang", "en");
// Set info values... // Set info values...
fputs("pdfioFileGet/SetAuthor: ", stdout); fputs("pdfioFileGet/SetAuthor: ", stdout);
@ -3609,6 +3608,23 @@ write_unit_file(
return (1); return (1);
} }
fputs("pdfioFileGet/SetLanguage: ", stdout);
pdfioFileSetLanguage(outpdf, "en-CA");
if ((s = pdfioFileGetLanguage(outpdf)) != NULL && !strcmp(s, "en-CA"))
{
puts("PASS");
}
else if (s)
{
printf("FAIL (got '%s', expected 'en-CA')\n", s);
return (1);
}
else
{
puts("FAIL (got NULL, expected 'en-CA')");
return (1);
}
fputs("pdfioFileGet/SetSubject: ", stdout); fputs("pdfioFileGet/SetSubject: ", stdout);
pdfioFileSetSubject(outpdf, "Unit test document"); pdfioFileSetSubject(outpdf, "Unit test document");
if ((s = pdfioFileGetSubject(outpdf)) != NULL && !strcmp(s, "Unit test document")) if ((s = pdfioFileGetSubject(outpdf)) != NULL && !strcmp(s, "Unit test document"))