mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2025-04-20 23:46:47 +02:00
Compare commits
5 Commits
ec64af8b20
...
1116e929f7
Author | SHA1 | Date | |
---|---|---|---|
|
1116e929f7 | ||
|
c75611e274 | ||
|
c507cabbda | ||
|
81aeef46d2 | ||
|
ba7371b2e1 |
@ -5,6 +5,7 @@ Changes in PDFio
|
||||
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
|
||||
(Issue #104)
|
||||
- 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)
|
||||
- Added `pdfioFileCreateFontObjFromData` function for embedding fonts in
|
||||
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
|
||||
(Issue #104)
|
||||
|
||||
|
131
doc/pdfio.3
131
doc/pdfio.3
@ -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
|
||||
pdfio \- pdf read/write library
|
||||
.SH Introduction
|
||||
@ -2449,6 +2449,10 @@ PDFIO_CS_ADOBE
|
||||
.br
|
||||
AdobeRGB 1998
|
||||
.TP 5
|
||||
PDFIO_CS_CGATS001
|
||||
.br
|
||||
CGATS001 (CMYK)
|
||||
.TP 5
|
||||
PDFIO_CS_P3_D65
|
||||
.br
|
||||
Display P3
|
||||
@ -2477,7 +2481,7 @@ PDFIO_ENCRYPTION_RC4_128
|
||||
.TP 5
|
||||
PDFIO_ENCRYPTION_RC4_40
|
||||
.br
|
||||
40-bit RC4 encryption (PDF 1.3)
|
||||
40-bit RC4 encryption (PDF 1.3, reading only)
|
||||
.SS pdfio_filter_e
|
||||
Compression/decompression filters for streams
|
||||
.TP 5
|
||||
@ -2838,7 +2842,8 @@ pdfio_array_t * pdfioArrayCreateColorFromStandard (
|
||||
.fi
|
||||
.PP
|
||||
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
|
||||
Get an array value from an array.
|
||||
.PP
|
||||
@ -2947,6 +2952,8 @@ bool pdfioArrayRemove (
|
||||
size_t n
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioContentClip
|
||||
Clip output to the current path.
|
||||
.PP
|
||||
@ -3083,6 +3090,8 @@ bool pdfioContentPathEnd (
|
||||
pdfio_stream_t *st
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioContentPathLineTo
|
||||
Add a straight line to the current path.
|
||||
.PP
|
||||
@ -3423,6 +3432,8 @@ double pdfioContentTextMeasure (
|
||||
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
|
||||
any control characters (such as newlines) are ignored.
|
||||
|
||||
|
||||
.SS pdfioContentTextMoveLine
|
||||
Move to the next line and offset.
|
||||
.PP
|
||||
@ -3451,6 +3462,8 @@ bool pdfioContentTextNewLine (
|
||||
pdfio_stream_t *st
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioContentTextNewLineShow
|
||||
Move to the next line and show text.
|
||||
.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
|
||||
specifies that the current font maps to full Unicode. The "s" argument
|
||||
specifies a UTF-8 encoded string.
|
||||
|
||||
|
||||
.SS pdfioContentTextNewLineShowf
|
||||
Show formatted text.
|
||||
.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"
|
||||
argument specifies that the current font maps to full Unicode. The "format"
|
||||
argument specifies a UTF-8 encoded \fBprintf\fR-style format string.
|
||||
|
||||
|
||||
.SS pdfioContentTextShow
|
||||
Show text.
|
||||
.PP
|
||||
@ -3536,6 +3553,8 @@ bool pdfioDictClear (
|
||||
const char *key
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioDictCopy
|
||||
Copy a dictionary to a PDF file.
|
||||
.PP
|
||||
@ -3608,6 +3627,8 @@ const char * pdfioDictGetKey (
|
||||
size_t n
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioDictGetName
|
||||
Get a key name value from a dictionary.
|
||||
.PP
|
||||
@ -3625,6 +3646,8 @@ size_t pdfioDictGetNumPairs (
|
||||
pdfio_dict_t *dict
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioDictGetNumber
|
||||
Get a key number value from a dictionary.
|
||||
.PP
|
||||
@ -3697,6 +3720,8 @@ function "cb":
|
||||
|
||||
The iteration continues as long as the callback returns \fBtrue\fR or all keys
|
||||
have been iterated.
|
||||
|
||||
|
||||
.SS pdfioDictSetArray
|
||||
Set a key array in a dictionary.
|
||||
.PP
|
||||
@ -3818,6 +3843,39 @@ bool pdfioDictSetStringf (
|
||||
...
|
||||
);
|
||||
.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
|
||||
Close a PDF file and free all memory used for it.
|
||||
.PP
|
||||
@ -3911,8 +3969,27 @@ specifies the font nane:
|
||||
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
|
||||
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
|
||||
Add a font object to a PDF file.
|
||||
Add a font file to a PDF file.
|
||||
.PP
|
||||
.nf
|
||||
pdfio_obj_t * pdfioFileCreateFontObjFromFile (
|
||||
@ -3922,7 +3999,7 @@ pdfio_obj_t * pdfioFileCreateFontObjFromFile (
|
||||
);
|
||||
.fi
|
||||
.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
|
||||
characters (potentially full Unicode, but more typically a subset)
|
||||
or to only support the Windows CP1252 (ISO-8859-1 with additional
|
||||
@ -4011,6 +4088,8 @@ pdfio_obj_t * pdfioFileCreateNameObj (
|
||||
.PP
|
||||
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.
|
||||
|
||||
|
||||
.SS pdfioFileCreateNumberObj
|
||||
Create a new object in a PDF file containing a number.
|
||||
.PP
|
||||
@ -4023,6 +4102,8 @@ pdfio_obj_t * pdfioFileCreateNumberObj (
|
||||
.PP
|
||||
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.
|
||||
|
||||
|
||||
.SS pdfioFileCreateObj
|
||||
Create a new object in a PDF file.
|
||||
.PP
|
||||
@ -4101,6 +4182,8 @@ pdfio_obj_t * pdfioFileCreateStringObj (
|
||||
.PP
|
||||
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.
|
||||
|
||||
|
||||
.SS pdfioFileCreateTemporary
|
||||
|
||||
.PP
|
||||
@ -4177,6 +4260,21 @@ const char * pdfioFileGetKeywords (
|
||||
pdfio_file_t *pdf
|
||||
);
|
||||
.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
|
||||
Get the most recent modification date for a PDF file.
|
||||
.PP
|
||||
@ -4332,6 +4430,22 @@ void pdfioFileSetKeywords (
|
||||
const char *value
|
||||
);
|
||||
.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
|
||||
Set the modification date for a PDF file.
|
||||
.PP
|
||||
@ -4474,6 +4588,8 @@ const char * pdfioObjGetName (
|
||||
pdfio_obj_t *obj
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
|
||||
.SS pdfioObjGetNumber
|
||||
Get the object's number.
|
||||
.PP
|
||||
@ -4677,8 +4793,9 @@ bool pdfioStreamPrintf (
|
||||
.fi
|
||||
.PP
|
||||
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
|
||||
value ("/Name") and "%S" to format a PDF string ("(String)") value.
|
||||
standard \fBprintf\fR format characters, you can use "%H" to format a HTML/XML
|
||||
string value, "%N" to format a PDF name value ("/Name"), and "%S" to format
|
||||
a PDF string ("(String)") value.
|
||||
.SS pdfioStreamPutChar
|
||||
Write a single character to a stream.
|
||||
.PP
|
||||
|
184
doc/pdfio.html
184
doc/pdfio.html
@ -1,13 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<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 name="generator" content="codedoc v3.8">
|
||||
<meta name="author" content="Michael R Sweet">
|
||||
<meta name="language" content="en-US">
|
||||
<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"><!--
|
||||
body {
|
||||
background: white;
|
||||
@ -251,7 +251,7 @@ span.string {
|
||||
<body>
|
||||
<div class="header">
|
||||
<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>Copyright © 2021-2025 by Michael R Sweet</p>
|
||||
</div>
|
||||
@ -395,10 +395,12 @@ span.string {
|
||||
<li><a href="#pdfioDictSetRect">pdfioDictSetRect</a></li>
|
||||
<li><a href="#pdfioDictSetString">pdfioDictSetString</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="#pdfioFileCreate">pdfioFileCreate</a></li>
|
||||
<li><a href="#pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</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="#pdfioFileCreateICCObjFromData">pdfioFileCreateICCObjFromData</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="#pdfioFileGetID">pdfioFileGetID</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="#pdfioFileGetName">pdfioFileGetName</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="#pdfioFileSetCreator">pdfioFileSetCreator</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="#pdfioFileSetPermissions">pdfioFileSetPermissions</a></li>
|
||||
<li><a href="#pdfioFileSetSubject">pdfioFileSetSubject</a></li>
|
||||
@ -2594,7 +2598,7 @@ dd->y = row_y - row->height;
|
||||
<tr><th>pdf</th>
|
||||
<td class="description">PDF file</td></tr>
|
||||
<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>
|
||||
<td class="description">Color space enumeration</td></tr>
|
||||
</tbody></table>
|
||||
@ -2602,7 +2606,8 @@ dd->y = row_y - row->height;
|
||||
<p class="description">Color array</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">This function creates a color array for a standard <code>PDFIO_CS_</code> enumerated color space.
|
||||
The "num_colors" argument must be <code>1</code> for grayscale and <code>3</code> for RGB color.</p>
|
||||
The "num_colors" 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>
|
||||
<p class="description">Get an array value from an array.</p>
|
||||
<p class="code">
|
||||
@ -2746,7 +2751,7 @@ size_t pdfioArrayGetSize(<a href="#pdfio_array_t">pdfio_array_t</a> *a);</p>
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Value type</p>
|
||||
<h3 class="function"><a id="pdfioArrayRemove">pdfioArrayRemove</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.4 </span><a id="pdfioArrayRemove">pdfioArrayRemove</a></h3>
|
||||
<p class="description">Remove an array entry.</p>
|
||||
<p class="code">
|
||||
<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>
|
||||
<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="pdfioContentPathEnd">pdfioContentPathEnd</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.1 </span><a id="pdfioContentPathEnd">pdfioContentPathEnd</a></h3>
|
||||
<p class="description">Clear the current path.</p>
|
||||
<p class="code">
|
||||
<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>
|
||||
<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="pdfioContentTextMeasure">pdfioContentTextMeasure</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioContentTextMeasure">pdfioContentTextMeasure</a></h3>
|
||||
<p class="description">Measure a text string and return its width.</p>
|
||||
<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>
|
||||
@ -3459,7 +3464,9 @@ are 0, a solid line is drawn.</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<p class="discussion">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
|
||||
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>
|
||||
<p class="description">Move to the next line and offset.</p>
|
||||
<p class="code">
|
||||
@ -3490,7 +3497,7 @@ any control characters (such as newlines) are ignored.</p>
|
||||
</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="pdfioContentTextNewLine">pdfioContentTextNewLine</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioContentTextNewLine">pdfioContentTextNewLine</a></h3>
|
||||
<p class="description">Move to the next line.</p>
|
||||
<p class="code">
|
||||
<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>
|
||||
<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="pdfioContentTextNewLineShow">pdfioContentTextNewLineShow</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioContentTextNewLineShow">pdfioContentTextNewLineShow</a></h3>
|
||||
<p class="description">Move to the next line and show text.</p>
|
||||
<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>
|
||||
@ -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
|
||||
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 a UTF-8 encoded string.</p>
|
||||
<h3 class="function"><a id="pdfioContentTextNewLineShowf">pdfioContentTextNewLineShowf</a></h3>
|
||||
specifies a UTF-8 encoded string.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioContentTextNewLineShowf">pdfioContentTextNewLineShowf</a></h3>
|
||||
<p class="description">Show formatted text.</p>
|
||||
<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>
|
||||
@ -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
|
||||
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 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>
|
||||
<p class="description">Show text.</p>
|
||||
<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
|
||||
"unicode" argument specifies that the current font maps to full Unicode.
|
||||
The "format" 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"> PDFio v1.4 </span><a id="pdfioDictClear">pdfioDictClear</a></h3>
|
||||
<p class="description">Remove a key/value pair from a dictionary.</p>
|
||||
<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>
|
||||
@ -3717,7 +3728,7 @@ time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span cl
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Value</p>
|
||||
<h3 class="function"><a id="pdfioDictGetKey">pdfioDictGetKey</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.4 </span><a id="pdfioDictGetKey">pdfioDictGetKey</a></h3>
|
||||
<p class="description">Get the key for the specified pair.</p>
|
||||
<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>
|
||||
@ -3743,7 +3754,7 @@ time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span cl
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Value</p>
|
||||
<h3 class="function"><a id="pdfioDictGetNumPairs">pdfioDictGetNumPairs</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.4 </span><a id="pdfioDictGetNumPairs">pdfioDictGetNumPairs</a></h3>
|
||||
<p class="description">Get the number of key/value pairs in a dictionary.</p>
|
||||
<p class="code">
|
||||
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>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Value type</p>
|
||||
<h3 class="function"><a id="pdfioDictIterateKeys">pdfioDictIterateKeys</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.1 </span><a id="pdfioDictIterateKeys">pdfioDictIterateKeys</a></h3>
|
||||
<p class="description">Iterate the keys in a dictionary.</p>
|
||||
<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>
|
||||
@ -3848,7 +3859,9 @@ my_dict_cb(pdfio_dict_t *dict, const char *key, void *cb_data)
|
||||
</pre>
|
||||
|
||||
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>
|
||||
<p class="description">Set a key array in a dictionary.</p>
|
||||
<p class="code">
|
||||
@ -4031,6 +4044,46 @@ have been iterated.</p>
|
||||
</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"><span class="info"> PDFio 1.6 </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 "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 <code>NULL</code> defaults the subtype to "GTS_PDFA1".<br>
|
||||
<br>
|
||||
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 <code>NULL</code> to omit this information.<br>
|
||||
<br>
|
||||
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.<br>
|
||||
<br>
|
||||
The "profile" 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 "cond_id" value.
|
||||
|
||||
</p>
|
||||
<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="code">
|
||||
@ -4143,8 +4196,33 @@ specifies the font nane:
|
||||
<p class="discussion">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
|
||||
Unicode.</p>
|
||||
<h3 class="function"><span class="info"> PDFio v1.6 </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
|
||||
"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.
|
||||
|
||||
</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 file to a PDF file.</p>
|
||||
<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>
|
||||
<h4 class="parameters">Parameters</h4>
|
||||
@ -4159,7 +4237,7 @@ Unicode.</p>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Font object</p>
|
||||
<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
|
||||
"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
|
||||
@ -4260,7 +4338,7 @@ image on the page.<br>
|
||||
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="pdfioFileCreateNameObj">pdfioFileCreateNameObj</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.4 </span><a id="pdfioFileCreateNameObj">pdfioFileCreateNameObj</a></h3>
|
||||
<p class="description">Create a new object in a PDF file containing a name.</p>
|
||||
<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>
|
||||
@ -4275,8 +4353,10 @@ is supported.</blockquote>
|
||||
<p class="description">New object</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<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>
|
||||
<h3 class="function"><a id="pdfioFileCreateNumberObj">pdfioFileCreateNumberObj</a></h3>
|
||||
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioFileCreateNumberObj">pdfioFileCreateNumberObj</a></h3>
|
||||
<p class="description">Create a new object in a PDF file containing a number.</p>
|
||||
<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>
|
||||
@ -4291,7 +4371,9 @@ You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write t
|
||||
<p class="description">New object</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<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>
|
||||
<p class="description">Create a new object in a PDF file.</p>
|
||||
<p class="code">
|
||||
@ -4372,7 +4454,7 @@ stored as indirect object references.</blockquote>
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Contents stream</p>
|
||||
<h3 class="function"><a id="pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></h3>
|
||||
<h3 class="function"><span class="info"> PDFio v1.2 </span><a id="pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></h3>
|
||||
<p class="description">Create a new object in a PDF file containing a string.</p>
|
||||
<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>
|
||||
@ -4387,7 +4469,9 @@ stored as indirect object references.</blockquote>
|
||||
<p class="description">New object</p>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<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>
|
||||
<p class="description"></p>
|
||||
<p class="code">
|
||||
@ -4510,6 +4594,24 @@ time_t pdfioFileGetCreationDate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);<
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Keywords string or <code>NULL</code> for none</p>
|
||||
<h3 class="function"><span class="info"> PDFio 1.6 </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
|
||||
"lang-REGION". For example, the string "en-CA" specifies Canadian English
|
||||
and the string "fr-CA" specifies Canadian French.
|
||||
|
||||
</p>
|
||||
<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="code">
|
||||
@ -4716,6 +4818,24 @@ writes error messages to <code>stderr</code>.</p>
|
||||
<tr><th>value</th>
|
||||
<td class="description">Value</td></tr>
|
||||
</tbody></table>
|
||||
<h3 class="function"><span class="info"> PDFio 1.6 </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 "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.
|
||||
|
||||
</p>
|
||||
<h3 class="function"><a id="pdfioFileSetModificationDate">pdfioFileSetModificationDate</a></h3>
|
||||
<p class="description">Set the modification date for a PDF file.</p>
|
||||
<p class="code">
|
||||
@ -4892,7 +5012,7 @@ size_t pdfioObjGetLength(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<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"> PDFio v1.4 </span><a id="pdfioObjGetName">pdfioObjGetName</a></h3>
|
||||
<p class="description">Get the name value associated with an object.</p>
|
||||
<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>
|
||||
@ -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>
|
||||
<h4 class="discussion">Discussion</h4>
|
||||
<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 "%N" to format a PDF name
|
||||
value ("/Name") and "%S" to format a PDF string ("(String)") value.</p>
|
||||
standard <code>printf</code> format characters, you can use "%H" to format a HTML/XML
|
||||
string value, "%N" to format a PDF name value ("/Name"), and "%S" to format
|
||||
a PDF string ("(String)") value.</p>
|
||||
<h3 class="function"><a id="pdfioStreamPutChar">pdfioStreamPutChar</a></h3>
|
||||
<p class="description">Write a single character to a stream.</p>
|
||||
<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>
|
||||
<table class="list"><tbody>
|
||||
<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_SRGB </th><td class="description">sRGB</td></tr>
|
||||
</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_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_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>
|
||||
<h3 class="enumeration"><a id="pdfio_filter_e">pdfio_filter_e</a></h3>
|
||||
<p class="description">Compression/decompression filters for streams</p>
|
||||
|
@ -640,6 +640,8 @@ _pdfioArrayRead(pdfio_file_t *pdf, // I - PDF file
|
||||
//
|
||||
// 'pdfioArrayRemove()' - Remove an array entry.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` otherwise
|
||||
pdfioArrayRemove(pdfio_array_t *a, // I - Array
|
||||
|
@ -643,6 +643,8 @@ pdfioContentPathCurve23(
|
||||
//
|
||||
// 'pdfioContentPathEnd()' - Clear the current path.
|
||||
//
|
||||
// @since PDFio v1.1@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` on failure
|
||||
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
|
||||
// any control characters (such as newlines) are ignored.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
double // O - Width
|
||||
pdfioContentTextMeasure(
|
||||
@ -1278,6 +1282,8 @@ pdfioContentTextMoveTo(
|
||||
//
|
||||
// 'pdfioContentTextNewLine()' - Move to the next line.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` on failure
|
||||
pdfioContentTextNewLine(
|
||||
@ -1309,6 +1315,8 @@ pdfioContentTextNextLine(
|
||||
// specifies that the current font maps to full Unicode. The "s" argument
|
||||
// specifies a UTF-8 encoded string.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` on failure
|
||||
pdfioContentTextNewLineShow(
|
||||
@ -1357,6 +1365,8 @@ pdfioContentTextNewLineShow(
|
||||
// argument specifies that the current font maps to full Unicode. The "format"
|
||||
// argument specifies a UTF-8 encoded `printf`-style format string.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
bool // O - `true` on success, `false` on failure
|
||||
pdfioContentTextNewLineShowf(
|
||||
@ -1537,7 +1547,7 @@ pdfioFileAddOutputIntent(
|
||||
}
|
||||
|
||||
// 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...
|
||||
size_t i, // Looping var
|
||||
@ -1561,7 +1571,7 @@ pdfioFileAddOutputIntent(
|
||||
if ((output_intents = pdfioArrayCreate(pdf)) == NULL)
|
||||
return;
|
||||
|
||||
pdfioDictSetArray(pdfioObjGetDict(pdf->info_obj), "OutputIntents", output_intents);
|
||||
pdfioDictSetArray(pdfioFileGetCatalog(pdf), "OutputIntents", output_intents);
|
||||
}
|
||||
|
||||
// Create an intent dictionary...
|
||||
@ -1652,6 +1662,8 @@ pdfioFileCreateFontObjFromBase(
|
||||
// or to only support the Windows CP1252 (ISO-8859-1 with additional
|
||||
// characters such as the Euro symbol) subset of Unicode.
|
||||
//
|
||||
// @since PDFio v1.6@
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - Font object
|
||||
pdfioFileCreateFontObjFromData(
|
||||
|
@ -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.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
bool // O - `true` if cleared, `false` otherwise
|
||||
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.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
const char * // O - Key for specified pair
|
||||
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.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
size_t // O - Number of pairs
|
||||
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
|
||||
// have been iterated.
|
||||
//
|
||||
// @since PDFio v1.1@
|
||||
//
|
||||
|
||||
void
|
||||
pdfioDictIterateKeys(
|
||||
|
159
pdfio-file.c
159
pdfio-file.c
@ -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 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 char *get_iso_date(time_t t, char *buffer, size_t bufsize);
|
||||
static struct lconv *get_lconv(void);
|
||||
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_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 write_metadata(pdfio_file_t *pdf);
|
||||
static bool write_pages(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;
|
||||
|
||||
// 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...
|
||||
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);
|
||||
}
|
||||
|
||||
@ -265,6 +267,8 @@ pdfioFileCreateArrayObj(
|
||||
// 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.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - New object
|
||||
pdfioFileCreateNameObj(
|
||||
@ -294,6 +298,8 @@ pdfioFileCreateNameObj(
|
||||
// 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.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - New object
|
||||
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.
|
||||
// You must call @link pdfioObjClose@ to write the object to the file.
|
||||
//
|
||||
// @since PDFio v1.2@
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - New object
|
||||
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.
|
||||
//
|
||||
@ -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.
|
||||
//
|
||||
@ -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.
|
||||
//
|
||||
@ -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.
|
||||
//
|
||||
|
@ -330,6 +330,8 @@ pdfioObjGetLength(pdfio_obj_t *obj) // I - Object
|
||||
//
|
||||
// 'pdfioObjGetName()' - Get the name value associated with an object.
|
||||
//
|
||||
// @since PDFio v1.4@
|
||||
//
|
||||
|
||||
const char * // O - Dictionary or `NULL` on error
|
||||
pdfioObjGetName(pdfio_obj_t *obj) // I - Object
|
||||
|
@ -690,8 +690,9 @@ pdfioStreamPeek(pdfio_stream_t *st, // I - Stream
|
||||
// 'pdfioStreamPrintf()' - Write a formatted string to a stream.
|
||||
//
|
||||
// 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
|
||||
// value ("/Name") and "%S" to format a PDF string ("(String)") value.
|
||||
// standard `printf` format characters, you can use "%H" to format a HTML/XML
|
||||
// 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
|
||||
|
@ -486,6 +486,59 @@ _pdfio_vsnprintf(pdfio_file_t *pdf, // I - PDF file
|
||||
}
|
||||
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 == '&')
|
||||
{
|
||||
// &
|
||||
if (bufptr < bufend)
|
||||
{
|
||||
_pdfio_strlcpy(bufptr, "&", (size_t)(bufend - bufptr + 1));
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
|
||||
bytes += 5;
|
||||
}
|
||||
else if (*s == '<')
|
||||
{
|
||||
// <
|
||||
if (bufptr < bufend)
|
||||
{
|
||||
_pdfio_strlcpy(bufptr, "<", (size_t)(bufend - bufptr + 1));
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
|
||||
bytes += 4;
|
||||
}
|
||||
else if (*s == '>')
|
||||
{
|
||||
// >
|
||||
if (bufptr < bufend)
|
||||
{
|
||||
_pdfio_strlcpy(bufptr, ">", (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
|
||||
if ((s = va_arg(ap, char *)) == NULL)
|
||||
s = "(null)";
|
||||
|
2
pdfio.h
2
pdfio.h
@ -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 pdfio_array_t *pdfioFileGetID(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 const char *pdfioFileGetName(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 pdfioFileSetCreator(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 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;
|
||||
|
64
pdfio1.def
64
pdfio1.def
@ -1,20 +1,78 @@
|
||||
LIBRARY pdfio1
|
||||
VERSION 1.5
|
||||
VERSION 1.6
|
||||
EXPORTS
|
||||
_pdfioArrayDebug
|
||||
_pdfioArrayDecrypt
|
||||
_pdfioArrayDelete
|
||||
_pdfioArrayGetValue
|
||||
_pdfioArrayRead
|
||||
_pdfioArrayWrite
|
||||
_pdfioCryptoAESDecrypt
|
||||
_pdfioCryptoAESEncrypt
|
||||
_pdfioCryptoAESInit
|
||||
_pdfioCryptoLock
|
||||
_pdfioCryptoMD5Append
|
||||
_pdfioCryptoMD5Finish
|
||||
_pdfioCryptoMD5Init
|
||||
_pdfioCryptoMakeRandom
|
||||
_pdfioCryptoMakeReader
|
||||
_pdfioCryptoMakeWriter
|
||||
_pdfioCryptoRC4Crypt
|
||||
_pdfioCryptoRC4Init
|
||||
_pdfioCryptoSHA256Append
|
||||
_pdfioCryptoSHA256Finish
|
||||
_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
|
||||
_pdfioTokenPush
|
||||
_pdfioTokenRead
|
||||
_pdfioValueCopy
|
||||
_pdfioValueDebug
|
||||
_pdfioValueDecrypt
|
||||
_pdfioValueDelete
|
||||
_pdfioValueRead
|
||||
_pdfioValueWrite
|
||||
_pdfio_strlcpy
|
||||
_pdfio_strtod
|
||||
_pdfio_utf16cpy
|
||||
_pdfio_vsnprintf
|
||||
pdfioArrayAppendArray
|
||||
pdfioArrayAppendBinary
|
||||
pdfioArrayAppendBoolean
|
||||
@ -129,10 +187,12 @@ pdfioDictSetObj
|
||||
pdfioDictSetRect
|
||||
pdfioDictSetString
|
||||
pdfioDictSetStringf
|
||||
pdfioFileAddOutputIntent
|
||||
pdfioFileClose
|
||||
pdfioFileCreate
|
||||
pdfioFileCreateArrayObj
|
||||
pdfioFileCreateFontObjFromBase
|
||||
pdfioFileCreateFontObjFromData
|
||||
pdfioFileCreateFontObjFromFile
|
||||
pdfioFileCreateICCObjFromData
|
||||
pdfioFileCreateICCObjFromFile
|
||||
@ -152,6 +212,7 @@ pdfioFileGetCreationDate
|
||||
pdfioFileGetCreator
|
||||
pdfioFileGetID
|
||||
pdfioFileGetKeywords
|
||||
pdfioFileGetLanguage
|
||||
pdfioFileGetModificationDate
|
||||
pdfioFileGetName
|
||||
pdfioFileGetNumObjs
|
||||
@ -168,6 +229,7 @@ pdfioFileSetAuthor
|
||||
pdfioFileSetCreationDate
|
||||
pdfioFileSetCreator
|
||||
pdfioFileSetKeywords
|
||||
pdfioFileSetLanguage
|
||||
pdfioFileSetModificationDate
|
||||
pdfioFileSetPermissions
|
||||
pdfioFileSetSubject
|
||||
|
24
testpdfio.c
24
testpdfio.c
@ -1399,18 +1399,18 @@ read_unit_file(const char *filename, // I - File to read
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
else if (s)
|
||||
{
|
||||
printf("FAIL (got '%s', expected 'en')\n", s);
|
||||
printf("FAIL (got '%s', expected 'en-CA')\n", s);
|
||||
return (1);
|
||||
}
|
||||
else
|
||||
{
|
||||
puts("FAIL (got NULL, expected 'en')");
|
||||
puts("FAIL (got NULL, expected 'en-CA')");
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -3555,7 +3555,6 @@ write_unit_file(
|
||||
// Set some catalog values...
|
||||
pdfioDictSetName(catalog, "PageLayout", "SinglePage");
|
||||
pdfioDictSetName(catalog, "PageMode", "UseThumbs");
|
||||
pdfioDictSetString(catalog, "Lang", "en");
|
||||
|
||||
// Set info values...
|
||||
fputs("pdfioFileGet/SetAuthor: ", stdout);
|
||||
@ -3609,6 +3608,23 @@ write_unit_file(
|
||||
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);
|
||||
pdfioFileSetSubject(outpdf, "Unit test document");
|
||||
if ((s = pdfioFileGetSubject(outpdf)) != NULL && !strcmp(s, "Unit test document"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user