mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-11-08 14:38:27 +01:00
4289 lines
222 KiB
HTML
4289 lines
222 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en-US">
|
|
<head>
|
|
<title>PDFio Programming Manual v1.4.0</title>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
|
<meta name="generator" content="codedoc v3.7">
|
|
<meta name="author" content="Michael R Sweet">
|
|
<meta name="language" content="en-US">
|
|
<meta name="copyright" content="Copyright © 2021-2024 by Michael R Sweet">
|
|
<meta name="version" content="1.4.0">
|
|
<style type="text/css"><!--
|
|
body {
|
|
background: white;
|
|
color: black;
|
|
font-family: sans-serif;
|
|
font-size: 12pt;
|
|
}
|
|
a {
|
|
color: black;
|
|
}
|
|
a:link, a:visited {
|
|
color: #00f;
|
|
}
|
|
a:link:hover, a:visited:hover, a:active {
|
|
color: #c0c;
|
|
}
|
|
body, p, h1, h2, h3, h4, h5, h6 {
|
|
font-family: sans-serif;
|
|
line-height: 1.4;
|
|
}
|
|
h1, h2, h3, h4, h5, h6 {
|
|
font-weight: bold;
|
|
page-break-inside: avoid;
|
|
}
|
|
h1 {
|
|
font-size: 250%;
|
|
margin: 0;
|
|
}
|
|
h2 {
|
|
font-size: 250%;
|
|
margin-top: 1.5em;
|
|
}
|
|
h3 {
|
|
font-size: 200%;
|
|
margin-bottom: 0.5em;
|
|
margin-top: 1.5em;
|
|
}
|
|
h4 {
|
|
font-size: 150%;
|
|
margin-bottom: 0.5em;
|
|
margin-top: 1.5em;
|
|
}
|
|
h5 {
|
|
font-size: 125%;
|
|
margin-bottom: 0.5em;
|
|
margin-top: 1.5em;
|
|
}
|
|
h6 {
|
|
font-size: 110%;
|
|
margin-bottom: 0.5em;
|
|
margin-top: 1.5em;
|
|
}
|
|
img.title {
|
|
width: 256px;
|
|
}
|
|
div.header h1, div.header p {
|
|
text-align: center;
|
|
}
|
|
div.contents, div.body, div.footer {
|
|
page-break-before: always;
|
|
}
|
|
.class, .enumeration, .function, .struct, .typedef, .union {
|
|
border-bottom: solid 2px gray;
|
|
}
|
|
.description {
|
|
margin-top: 0.5em;
|
|
}
|
|
.function {
|
|
margin-bottom: 0;
|
|
}
|
|
blockquote {
|
|
border: solid thin gray;
|
|
box-shadow: 3px 3px 5px rgba(127,127,127,0.25);
|
|
margin: 1em 0;
|
|
padding: 10px;
|
|
page-break-inside: avoid;
|
|
}
|
|
blockquote :first-child {
|
|
margin-top: 0;
|
|
}
|
|
blockquote :first-child {
|
|
margin-bottom: 0;
|
|
}
|
|
p code, li code, p.code, pre, ul.code li {
|
|
font-family: monospace;
|
|
hyphens: manual;
|
|
-webkit-hyphens: manual;
|
|
}
|
|
p.code, pre, ul.code li {
|
|
background: rgba(127,127,127,0.25);
|
|
border: thin dotted gray;
|
|
padding: 10px;
|
|
page-break-inside: avoid;
|
|
}
|
|
pre {
|
|
white-space: pre-wrap;
|
|
}
|
|
a:link, a:visited {
|
|
text-decoration: none;
|
|
}
|
|
span.info {
|
|
background: black;
|
|
border: solid thin black;
|
|
color: white;
|
|
font-size: 80%;
|
|
font-style: italic;
|
|
font-weight: bold;
|
|
white-space: nowrap;
|
|
}
|
|
h1 span.info, h2 span.info, h3 span.info, h4 span.info {
|
|
border-top-left-radius: 10px;
|
|
border-top-right-radius: 10px;
|
|
float: right;
|
|
padding: 3px 6px;
|
|
}
|
|
ul.code, ul.contents, ul.subcontents {
|
|
list-style-type: none;
|
|
margin: 0;
|
|
padding-left: 0;
|
|
}
|
|
ul.code li {
|
|
margin: 0;
|
|
}
|
|
ul.contents > li {
|
|
margin-top: 1em;
|
|
}
|
|
ul.contents li ul.code, ul.contents li ul.subcontents {
|
|
padding-left: 2em;
|
|
}
|
|
table {
|
|
border-collapse: collapse;
|
|
border-spacing: 0;
|
|
}
|
|
td {
|
|
border: solid 1px gray;
|
|
padding: 5px 10px;
|
|
vertical-align: top;
|
|
}
|
|
td.left {
|
|
text-align: left;
|
|
}
|
|
td.center {
|
|
text-align: center;
|
|
}
|
|
td.right {
|
|
text-align: right;
|
|
}
|
|
th {
|
|
border-bottom: solid 2px gray;
|
|
padding: 1px 5px;
|
|
text-align: center;
|
|
vertical-align: bottom;
|
|
}
|
|
tr:nth-child(even) {
|
|
background: rgba(127,127,127,0.25);
|
|
}
|
|
table.list {
|
|
border-collapse: collapse;
|
|
width: 100%;
|
|
}
|
|
table.list th {
|
|
border-bottom: none;
|
|
border-right: 2px solid gray;
|
|
font-family: monospace;
|
|
font-weight: normal;
|
|
padding: 5px 10px 5px 2px;
|
|
text-align: right;
|
|
vertical-align: top;
|
|
}
|
|
table.list td {
|
|
border: none;
|
|
padding: 5px 2px 5px 10px;
|
|
text-align: left;
|
|
vertical-align: top;
|
|
}
|
|
h2.title, h3.title {
|
|
border-bottom: solid 2px gray;
|
|
}
|
|
/* Syntax highlighting */
|
|
span.comment {
|
|
color: darkgreen;
|
|
}
|
|
span.directive {
|
|
color: red;
|
|
}
|
|
span.number {
|
|
color: brown;
|
|
}
|
|
span.reserved {
|
|
color: blue;
|
|
}
|
|
span.string {
|
|
color: magenta;
|
|
}
|
|
/* Dark mode overrides */
|
|
@media (prefers-color-scheme: dark) {
|
|
body {
|
|
background: black;
|
|
color: #ccc;
|
|
}
|
|
a {
|
|
color: #ccc;
|
|
}
|
|
a:link, a:visited {
|
|
color: #66f;
|
|
}
|
|
a:link:hover, a:visited:hover, a:active {
|
|
color: #f06;
|
|
}
|
|
}
|
|
/* Show contents on left side in web browser */
|
|
@media screen and (min-width: 800px) {
|
|
div.contents {
|
|
border-right: solid thin gray;
|
|
bottom: 0px;
|
|
box-shadow: 3px 3px 5px rgba(127,127,127,0.5);
|
|
font-size: 10pt;
|
|
left: 0px;
|
|
overflow: scroll;
|
|
padding: 1%;
|
|
position: fixed;
|
|
top: 0px;
|
|
width: 18%;
|
|
}
|
|
div.contents h2.title {
|
|
margin-top: 0px;
|
|
}
|
|
div.header, div.body, div.footer {
|
|
margin-left: 20%;
|
|
padding: 1% 2%;
|
|
}
|
|
}
|
|
/* Center title page content vertically */
|
|
@media print {
|
|
div.header {
|
|
padding-top: 33%;
|
|
}
|
|
}
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<p><img class="title" src="pdfio-512.png"></p>
|
|
<h1 class="title">PDFio Programming Manual v1.4.0</h1>
|
|
<p>Michael R Sweet</p>
|
|
<p>Copyright © 2021-2024 by Michael R Sweet</p>
|
|
</div>
|
|
<div class="contents">
|
|
<h2 class="title">Contents</h2>
|
|
<ul class="contents">
|
|
<li><a href="#introduction">Introduction</a><ul class="subcontents">
|
|
<li><a href="#requirements">Requirements</a></li>
|
|
<li><a href="#installing-pdfio">Installing pdfio</a></li>
|
|
<li><a href="#visual-studio-project">Visual Studio Project</a></li>
|
|
<li><a href="#xcode-project">Xcode Project</a></li>
|
|
<li><a href="#detecting-pdfio">Detecting PDFio</a></li>
|
|
<li><a href="#header-files">Header Files</a></li>
|
|
<li><a href="#understanding-pdf-files">Understanding PDF Files</a></li>
|
|
</ul></li>
|
|
<li><a href="#api-overview">API Overview</a><ul class="subcontents">
|
|
<li><a href="#reading-pdf-files">Reading PDF Files</a></li>
|
|
<li><a href="#writing-pdf-files">Writing PDF Files</a></li>
|
|
<li><a href="#pdf-objects">PDF Objects</a></li>
|
|
<li><a href="#pdf-streams">PDF Streams</a></li>
|
|
<li><a href="#pdf-content-helper-functions">PDF Content Helper Functions</a></li>
|
|
</ul></li>
|
|
<li><a href="#examples">Examples</a><ul class="subcontents">
|
|
<li><a href="#read-pdf-metadata">Read PDF Metadata</a></li>
|
|
<li><a href="#create-pdf-file-with-text-and-image">Create PDF File With Text and Image</a></li>
|
|
</ul></li>
|
|
<li><a href="#FUNCTIONS">Functions</a><ul class="subcontents">
|
|
<li><a href="#pdfioArrayAppendArray">pdfioArrayAppendArray</a></li>
|
|
<li><a href="#pdfioArrayAppendBinary">pdfioArrayAppendBinary</a></li>
|
|
<li><a href="#pdfioArrayAppendBoolean">pdfioArrayAppendBoolean</a></li>
|
|
<li><a href="#pdfioArrayAppendDate">pdfioArrayAppendDate</a></li>
|
|
<li><a href="#pdfioArrayAppendDict">pdfioArrayAppendDict</a></li>
|
|
<li><a href="#pdfioArrayAppendName">pdfioArrayAppendName</a></li>
|
|
<li><a href="#pdfioArrayAppendNumber">pdfioArrayAppendNumber</a></li>
|
|
<li><a href="#pdfioArrayAppendObj">pdfioArrayAppendObj</a></li>
|
|
<li><a href="#pdfioArrayAppendString">pdfioArrayAppendString</a></li>
|
|
<li><a href="#pdfioArrayCopy">pdfioArrayCopy</a></li>
|
|
<li><a href="#pdfioArrayCreate">pdfioArrayCreate</a></li>
|
|
<li><a href="#pdfioArrayCreateColorFromICCObj">pdfioArrayCreateColorFromICCObj</a></li>
|
|
<li><a href="#pdfioArrayCreateColorFromMatrix">pdfioArrayCreateColorFromMatrix</a></li>
|
|
<li><a href="#pdfioArrayCreateColorFromPalette">pdfioArrayCreateColorFromPalette</a></li>
|
|
<li><a href="#pdfioArrayCreateColorFromPrimaries">pdfioArrayCreateColorFromPrimaries</a></li>
|
|
<li><a href="#pdfioArrayCreateColorFromStandard">pdfioArrayCreateColorFromStandard</a></li>
|
|
<li><a href="#pdfioArrayGetArray">pdfioArrayGetArray</a></li>
|
|
<li><a href="#pdfioArrayGetBinary">pdfioArrayGetBinary</a></li>
|
|
<li><a href="#pdfioArrayGetBoolean">pdfioArrayGetBoolean</a></li>
|
|
<li><a href="#pdfioArrayGetDate">pdfioArrayGetDate</a></li>
|
|
<li><a href="#pdfioArrayGetDict">pdfioArrayGetDict</a></li>
|
|
<li><a href="#pdfioArrayGetName">pdfioArrayGetName</a></li>
|
|
<li><a href="#pdfioArrayGetNumber">pdfioArrayGetNumber</a></li>
|
|
<li><a href="#pdfioArrayGetObj">pdfioArrayGetObj</a></li>
|
|
<li><a href="#pdfioArrayGetSize">pdfioArrayGetSize</a></li>
|
|
<li><a href="#pdfioArrayGetString">pdfioArrayGetString</a></li>
|
|
<li><a href="#pdfioArrayGetType">pdfioArrayGetType</a></li>
|
|
<li><a href="#pdfioArrayRemove">pdfioArrayRemove</a></li>
|
|
<li><a href="#pdfioContentClip">pdfioContentClip</a></li>
|
|
<li><a href="#pdfioContentDrawImage">pdfioContentDrawImage</a></li>
|
|
<li><a href="#pdfioContentFill">pdfioContentFill</a></li>
|
|
<li><a href="#pdfioContentFillAndStroke">pdfioContentFillAndStroke</a></li>
|
|
<li><a href="#pdfioContentMatrixConcat">pdfioContentMatrixConcat</a></li>
|
|
<li><a href="#pdfioContentMatrixRotate">pdfioContentMatrixRotate</a></li>
|
|
<li><a href="#pdfioContentMatrixScale">pdfioContentMatrixScale</a></li>
|
|
<li><a href="#pdfioContentMatrixTranslate">pdfioContentMatrixTranslate</a></li>
|
|
<li><a href="#pdfioContentPathClose">pdfioContentPathClose</a></li>
|
|
<li><a href="#pdfioContentPathCurve">pdfioContentPathCurve</a></li>
|
|
<li><a href="#pdfioContentPathCurve13">pdfioContentPathCurve13</a></li>
|
|
<li><a href="#pdfioContentPathCurve23">pdfioContentPathCurve23</a></li>
|
|
<li><a href="#pdfioContentPathEnd">pdfioContentPathEnd</a></li>
|
|
<li><a href="#pdfioContentPathLineTo">pdfioContentPathLineTo</a></li>
|
|
<li><a href="#pdfioContentPathMoveTo">pdfioContentPathMoveTo</a></li>
|
|
<li><a href="#pdfioContentPathRect">pdfioContentPathRect</a></li>
|
|
<li><a href="#pdfioContentRestore">pdfioContentRestore</a></li>
|
|
<li><a href="#pdfioContentSave">pdfioContentSave</a></li>
|
|
<li><a href="#pdfioContentSetDashPattern">pdfioContentSetDashPattern</a></li>
|
|
<li><a href="#pdfioContentSetFillColorDeviceCMYK">pdfioContentSetFillColorDeviceCMYK</a></li>
|
|
<li><a href="#pdfioContentSetFillColorDeviceGray">pdfioContentSetFillColorDeviceGray</a></li>
|
|
<li><a href="#pdfioContentSetFillColorDeviceRGB">pdfioContentSetFillColorDeviceRGB</a></li>
|
|
<li><a href="#pdfioContentSetFillColorGray">pdfioContentSetFillColorGray</a></li>
|
|
<li><a href="#pdfioContentSetFillColorRGB">pdfioContentSetFillColorRGB</a></li>
|
|
<li><a href="#pdfioContentSetFillColorSpace">pdfioContentSetFillColorSpace</a></li>
|
|
<li><a href="#pdfioContentSetFlatness">pdfioContentSetFlatness</a></li>
|
|
<li><a href="#pdfioContentSetLineCap">pdfioContentSetLineCap</a></li>
|
|
<li><a href="#pdfioContentSetLineJoin">pdfioContentSetLineJoin</a></li>
|
|
<li><a href="#pdfioContentSetLineWidth">pdfioContentSetLineWidth</a></li>
|
|
<li><a href="#pdfioContentSetMiterLimit">pdfioContentSetMiterLimit</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorDeviceCMYK">pdfioContentSetStrokeColorDeviceCMYK</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorDeviceGray">pdfioContentSetStrokeColorDeviceGray</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorDeviceRGB">pdfioContentSetStrokeColorDeviceRGB</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorGray">pdfioContentSetStrokeColorGray</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorRGB">pdfioContentSetStrokeColorRGB</a></li>
|
|
<li><a href="#pdfioContentSetStrokeColorSpace">pdfioContentSetStrokeColorSpace</a></li>
|
|
<li><a href="#pdfioContentSetTextCharacterSpacing">pdfioContentSetTextCharacterSpacing</a></li>
|
|
<li><a href="#pdfioContentSetTextFont">pdfioContentSetTextFont</a></li>
|
|
<li><a href="#pdfioContentSetTextLeading">pdfioContentSetTextLeading</a></li>
|
|
<li><a href="#pdfioContentSetTextMatrix">pdfioContentSetTextMatrix</a></li>
|
|
<li><a href="#pdfioContentSetTextRenderingMode">pdfioContentSetTextRenderingMode</a></li>
|
|
<li><a href="#pdfioContentSetTextRise">pdfioContentSetTextRise</a></li>
|
|
<li><a href="#pdfioContentSetTextWordSpacing">pdfioContentSetTextWordSpacing</a></li>
|
|
<li><a href="#pdfioContentSetTextXScaling">pdfioContentSetTextXScaling</a></li>
|
|
<li><a href="#pdfioContentStroke">pdfioContentStroke</a></li>
|
|
<li><a href="#pdfioContentTextBegin">pdfioContentTextBegin</a></li>
|
|
<li><a href="#pdfioContentTextEnd">pdfioContentTextEnd</a></li>
|
|
<li><a href="#pdfioContentTextMeasure">pdfioContentTextMeasure</a></li>
|
|
<li><a href="#pdfioContentTextMoveLine">pdfioContentTextMoveLine</a></li>
|
|
<li><a href="#pdfioContentTextMoveTo">pdfioContentTextMoveTo</a></li>
|
|
<li><a href="#pdfioContentTextNewLine">pdfioContentTextNewLine</a></li>
|
|
<li><a href="#pdfioContentTextNewLineShow">pdfioContentTextNewLineShow</a></li>
|
|
<li><a href="#pdfioContentTextNewLineShowf">pdfioContentTextNewLineShowf</a></li>
|
|
<li><a href="#pdfioContentTextShow">pdfioContentTextShow</a></li>
|
|
<li><a href="#pdfioContentTextShowJustified">pdfioContentTextShowJustified</a></li>
|
|
<li><a href="#pdfioContentTextShowf">pdfioContentTextShowf</a></li>
|
|
<li><a href="#pdfioDictClear">pdfioDictClear</a></li>
|
|
<li><a href="#pdfioDictCopy">pdfioDictCopy</a></li>
|
|
<li><a href="#pdfioDictCreate">pdfioDictCreate</a></li>
|
|
<li><a href="#pdfioDictGetArray">pdfioDictGetArray</a></li>
|
|
<li><a href="#pdfioDictGetBinary">pdfioDictGetBinary</a></li>
|
|
<li><a href="#pdfioDictGetBoolean">pdfioDictGetBoolean</a></li>
|
|
<li><a href="#pdfioDictGetDate">pdfioDictGetDate</a></li>
|
|
<li><a href="#pdfioDictGetDict">pdfioDictGetDict</a></li>
|
|
<li><a href="#pdfioDictGetKey">pdfioDictGetKey</a></li>
|
|
<li><a href="#pdfioDictGetName">pdfioDictGetName</a></li>
|
|
<li><a href="#pdfioDictGetNumPairs">pdfioDictGetNumPairs</a></li>
|
|
<li><a href="#pdfioDictGetNumber">pdfioDictGetNumber</a></li>
|
|
<li><a href="#pdfioDictGetObj">pdfioDictGetObj</a></li>
|
|
<li><a href="#pdfioDictGetRect">pdfioDictGetRect</a></li>
|
|
<li><a href="#pdfioDictGetString">pdfioDictGetString</a></li>
|
|
<li><a href="#pdfioDictGetType">pdfioDictGetType</a></li>
|
|
<li><a href="#pdfioDictIterateKeys">pdfioDictIterateKeys</a></li>
|
|
<li><a href="#pdfioDictSetArray">pdfioDictSetArray</a></li>
|
|
<li><a href="#pdfioDictSetBinary">pdfioDictSetBinary</a></li>
|
|
<li><a href="#pdfioDictSetBoolean">pdfioDictSetBoolean</a></li>
|
|
<li><a href="#pdfioDictSetDate">pdfioDictSetDate</a></li>
|
|
<li><a href="#pdfioDictSetDict">pdfioDictSetDict</a></li>
|
|
<li><a href="#pdfioDictSetName">pdfioDictSetName</a></li>
|
|
<li><a href="#pdfioDictSetNull">pdfioDictSetNull</a></li>
|
|
<li><a href="#pdfioDictSetNumber">pdfioDictSetNumber</a></li>
|
|
<li><a href="#pdfioDictSetObj">pdfioDictSetObj</a></li>
|
|
<li><a href="#pdfioDictSetRect">pdfioDictSetRect</a></li>
|
|
<li><a href="#pdfioDictSetString">pdfioDictSetString</a></li>
|
|
<li><a href="#pdfioDictSetStringf">pdfioDictSetStringf</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="#pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></li>
|
|
<li><a href="#pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></li>
|
|
<li><a href="#pdfioFileCreateImageObjFromData">pdfioFileCreateImageObjFromData</a></li>
|
|
<li><a href="#pdfioFileCreateImageObjFromFile">pdfioFileCreateImageObjFromFile</a></li>
|
|
<li><a href="#pdfioFileCreateNameObj">pdfioFileCreateNameObj</a></li>
|
|
<li><a href="#pdfioFileCreateNumberObj">pdfioFileCreateNumberObj</a></li>
|
|
<li><a href="#pdfioFileCreateObj">pdfioFileCreateObj</a></li>
|
|
<li><a href="#pdfioFileCreateOutput">pdfioFileCreateOutput</a></li>
|
|
<li><a href="#pdfioFileCreatePage">pdfioFileCreatePage</a></li>
|
|
<li><a href="#pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></li>
|
|
<li><a href="#pdfioFileCreateTemporary">pdfioFileCreateTemporary</a></li>
|
|
<li><a href="#pdfioFileFindObj">pdfioFileFindObj</a></li>
|
|
<li><a href="#pdfioFileGetAuthor">pdfioFileGetAuthor</a></li>
|
|
<li><a href="#pdfioFileGetCatalog">pdfioFileGetCatalog</a></li>
|
|
<li><a href="#pdfioFileGetCreationDate">pdfioFileGetCreationDate</a></li>
|
|
<li><a href="#pdfioFileGetCreator">pdfioFileGetCreator</a></li>
|
|
<li><a href="#pdfioFileGetID">pdfioFileGetID</a></li>
|
|
<li><a href="#pdfioFileGetKeywords">pdfioFileGetKeywords</a></li>
|
|
<li><a href="#pdfioFileGetName">pdfioFileGetName</a></li>
|
|
<li><a href="#pdfioFileGetNumObjs">pdfioFileGetNumObjs</a></li>
|
|
<li><a href="#pdfioFileGetNumPages">pdfioFileGetNumPages</a></li>
|
|
<li><a href="#pdfioFileGetObj">pdfioFileGetObj</a></li>
|
|
<li><a href="#pdfioFileGetPage">pdfioFileGetPage</a></li>
|
|
<li><a href="#pdfioFileGetPermissions">pdfioFileGetPermissions</a></li>
|
|
<li><a href="#pdfioFileGetProducer">pdfioFileGetProducer</a></li>
|
|
<li><a href="#pdfioFileGetSubject">pdfioFileGetSubject</a></li>
|
|
<li><a href="#pdfioFileGetTitle">pdfioFileGetTitle</a></li>
|
|
<li><a href="#pdfioFileGetVersion">pdfioFileGetVersion</a></li>
|
|
<li><a href="#pdfioFileOpen">pdfioFileOpen</a></li>
|
|
<li><a href="#pdfioFileSetAuthor">pdfioFileSetAuthor</a></li>
|
|
<li><a href="#pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></li>
|
|
<li><a href="#pdfioFileSetCreator">pdfioFileSetCreator</a></li>
|
|
<li><a href="#pdfioFileSetKeywords">pdfioFileSetKeywords</a></li>
|
|
<li><a href="#pdfioFileSetPermissions">pdfioFileSetPermissions</a></li>
|
|
<li><a href="#pdfioFileSetSubject">pdfioFileSetSubject</a></li>
|
|
<li><a href="#pdfioFileSetTitle">pdfioFileSetTitle</a></li>
|
|
<li><a href="#pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></li>
|
|
<li><a href="#pdfioImageGetHeight">pdfioImageGetHeight</a></li>
|
|
<li><a href="#pdfioImageGetWidth">pdfioImageGetWidth</a></li>
|
|
<li><a href="#pdfioObjClose">pdfioObjClose</a></li>
|
|
<li><a href="#pdfioObjCopy">pdfioObjCopy</a></li>
|
|
<li><a href="#pdfioObjCreateStream">pdfioObjCreateStream</a></li>
|
|
<li><a href="#pdfioObjGetArray">pdfioObjGetArray</a></li>
|
|
<li><a href="#pdfioObjGetDict">pdfioObjGetDict</a></li>
|
|
<li><a href="#pdfioObjGetGeneration">pdfioObjGetGeneration</a></li>
|
|
<li><a href="#pdfioObjGetLength">pdfioObjGetLength</a></li>
|
|
<li><a href="#pdfioObjGetName">pdfioObjGetName</a></li>
|
|
<li><a href="#pdfioObjGetNumber">pdfioObjGetNumber</a></li>
|
|
<li><a href="#pdfioObjGetSubtype">pdfioObjGetSubtype</a></li>
|
|
<li><a href="#pdfioObjGetType">pdfioObjGetType</a></li>
|
|
<li><a href="#pdfioObjOpenStream">pdfioObjOpenStream</a></li>
|
|
<li><a href="#pdfioPageCopy">pdfioPageCopy</a></li>
|
|
<li><a href="#pdfioPageDictAddColorSpace">pdfioPageDictAddColorSpace</a></li>
|
|
<li><a href="#pdfioPageDictAddFont">pdfioPageDictAddFont</a></li>
|
|
<li><a href="#pdfioPageDictAddImage">pdfioPageDictAddImage</a></li>
|
|
<li><a href="#pdfioPageGetNumStreams">pdfioPageGetNumStreams</a></li>
|
|
<li><a href="#pdfioPageOpenStream">pdfioPageOpenStream</a></li>
|
|
<li><a href="#pdfioStreamClose">pdfioStreamClose</a></li>
|
|
<li><a href="#pdfioStreamConsume">pdfioStreamConsume</a></li>
|
|
<li><a href="#pdfioStreamGetToken">pdfioStreamGetToken</a></li>
|
|
<li><a href="#pdfioStreamPeek">pdfioStreamPeek</a></li>
|
|
<li><a href="#pdfioStreamPrintf">pdfioStreamPrintf</a></li>
|
|
<li><a href="#pdfioStreamPutChar">pdfioStreamPutChar</a></li>
|
|
<li><a href="#pdfioStreamPuts">pdfioStreamPuts</a></li>
|
|
<li><a href="#pdfioStreamRead">pdfioStreamRead</a></li>
|
|
<li><a href="#pdfioStreamWrite">pdfioStreamWrite</a></li>
|
|
<li><a href="#pdfioStringCreate">pdfioStringCreate</a></li>
|
|
<li><a href="#pdfioStringCreatef">pdfioStringCreatef</a></li>
|
|
</ul></li>
|
|
<li><a href="#TYPES">Data Types</a><ul class="subcontents">
|
|
<li><a href="#pdfio_array_t">pdfio_array_t</a></li>
|
|
<li><a href="#pdfio_cs_t">pdfio_cs_t</a></li>
|
|
<li><a href="#pdfio_dict_cb_t">pdfio_dict_cb_t</a></li>
|
|
<li><a href="#pdfio_dict_t">pdfio_dict_t</a></li>
|
|
<li><a href="#pdfio_encryption_t">pdfio_encryption_t</a></li>
|
|
<li><a href="#pdfio_error_cb_t">pdfio_error_cb_t</a></li>
|
|
<li><a href="#pdfio_file_t">pdfio_file_t</a></li>
|
|
<li><a href="#pdfio_filter_t">pdfio_filter_t</a></li>
|
|
<li><a href="#pdfio_linecap_t">pdfio_linecap_t</a></li>
|
|
<li><a href="#pdfio_linejoin_t">pdfio_linejoin_t</a></li>
|
|
<li><a href="#pdfio_matrix_t[3][2]">pdfio_matrix_t[3][2]</a></li>
|
|
<li><a href="#pdfio_obj_t">pdfio_obj_t</a></li>
|
|
<li><a href="#pdfio_output_cb_t">pdfio_output_cb_t</a></li>
|
|
<li><a href="#pdfio_password_cb_t">pdfio_password_cb_t</a></li>
|
|
<li><a href="#pdfio_permission_t">pdfio_permission_t</a></li>
|
|
<li><a href="#pdfio_rect_t">pdfio_rect_t</a></li>
|
|
<li><a href="#pdfio_stream_t">pdfio_stream_t</a></li>
|
|
<li><a href="#pdfio_textrendering_t">pdfio_textrendering_t</a></li>
|
|
<li><a href="#pdfio_valtype_t">pdfio_valtype_t</a></li>
|
|
</ul></li>
|
|
<li><a href="#STRUCTURES">Structures</a><ul class="subcontents">
|
|
<li><a href="#pdfio_rect_s">pdfio_rect_s</a></li>
|
|
</ul></li>
|
|
<li><a href="#ENUMERATIONS">Enumerations</a><ul class="subcontents">
|
|
<li><a href="#pdfio_cs_e">pdfio_cs_e</a></li>
|
|
<li><a href="#pdfio_encryption_e">pdfio_encryption_e</a></li>
|
|
<li><a href="#pdfio_filter_e">pdfio_filter_e</a></li>
|
|
<li><a href="#pdfio_linecap_e">pdfio_linecap_e</a></li>
|
|
<li><a href="#pdfio_linejoin_e">pdfio_linejoin_e</a></li>
|
|
<li><a href="#pdfio_permission_e">pdfio_permission_e</a></li>
|
|
<li><a href="#pdfio_textrendering_e">pdfio_textrendering_e</a></li>
|
|
<li><a href="#pdfio_valtype_e">pdfio_valtype_e</a></li>
|
|
</ul></li>
|
|
</ul>
|
|
</div>
|
|
<div class="body">
|
|
<h2 class="title" id="introduction">Introduction</h2>
|
|
<p>PDFio is a simple C library for reading and writing PDF files. The primary goals of pdfio are:</p>
|
|
<ul>
|
|
<li><p>Read and write any version of PDF file</p>
|
|
</li>
|
|
<li><p>Provide access to pages, objects, and streams within a PDF file</p>
|
|
</li>
|
|
<li><p>Support reading and writing of encrypted PDF files</p>
|
|
</li>
|
|
<li><p>Extract or embed useful metadata (author, creator, page information, etc.)</p>
|
|
</li>
|
|
<li><p>"Filter" PDF files, for example to extract a range of pages or to embed fonts that are missing from a PDF</p>
|
|
</li>
|
|
<li><p>Provide access to objects used for each page</p>
|
|
</li>
|
|
</ul>
|
|
<p>PDFio is <em>not</em> concerned with rendering or viewing a PDF file, although a PDF RIP or viewer could be written using it.</p>
|
|
<p>PDFio is Copyright © 2021-2024 by Michael R Sweet and is licensed under the Apache License Version 2.0 with an (optional) exception to allow linking against GPL2/LGPL2 software. See the files "LICENSE" and "NOTICE" for more information.</p>
|
|
<h3 class="title" id="requirements">Requirements</h3>
|
|
<p>PDFio requires the following to build the software:</p>
|
|
<ul>
|
|
<li><p>A C99 compiler such as Clang, GCC, or MS Visual C</p>
|
|
</li>
|
|
<li><p>A POSIX-compliant <code>make</code> program</p>
|
|
</li>
|
|
<li><p>A POSIX-compliant <code>sh</code> program</p>
|
|
</li>
|
|
<li><p>ZLIB (<a href="https://www.zlib.net">https://www.zlib.net</a>) 1.0 or higher</p>
|
|
</li>
|
|
</ul>
|
|
<p>IDE files for Xcode (macOS/iOS) and Visual Studio (Windows) are also provided.</p>
|
|
<h3 class="title" id="installing-pdfio">Installing pdfio</h3>
|
|
<p>PDFio comes with a configure script that creates a portable makefile that will work on any POSIX-compliant system with ZLIB installed. To make it, run:</p>
|
|
<pre><code>./configure
|
|
make
|
|
</code></pre>
|
|
<p>To test it, run:</p>
|
|
<pre><code>make test
|
|
</code></pre>
|
|
<p>To install it, run:</p>
|
|
<pre><code>sudo make install
|
|
</code></pre>
|
|
<p>If you want a shared library, run:</p>
|
|
<pre><code>./configure --enable-shared
|
|
make
|
|
sudo make install
|
|
</code></pre>
|
|
<p>The default installation location is "/usr/local". Pass the <code>--prefix</code> option to make to install it to another location:</p>
|
|
<pre><code>./configure --prefix=/some/other/directory
|
|
</code></pre>
|
|
<p>Other configure options can be found using the <code>--help</code> option:</p>
|
|
<pre><code>./configure --help
|
|
</code></pre>
|
|
<h3 class="title" id="visual-studio-project">Visual Studio Project</h3>
|
|
<p>The Visual Studio solution ("pdfio.sln") is provided for Windows developers and generates both a static library and DLL.</p>
|
|
<h3 class="title" id="xcode-project">Xcode Project</h3>
|
|
<p>There is also an Xcode project ("pdfio.xcodeproj") you can use on macOS which generates a static library that will be installed under "/usr/local" with:</p>
|
|
<pre><code>sudo xcodebuild install
|
|
</code></pre>
|
|
<h3 class="title" id="detecting-pdfio">Detecting PDFio</h3>
|
|
<p>PDFio can be detected using the <code>pkg-config</code> command, for example:</p>
|
|
<pre><code>if pkg-config --exists pdfio; then
|
|
...
|
|
fi
|
|
</code></pre>
|
|
<p>In a makefile you can add the necessary compiler and linker options with:</p>
|
|
<pre><code class="language-make">CFLAGS += `pkg-config --cflags pdfio`
|
|
LIBS += `pkg-config --libs pdfio`
|
|
</code></pre>
|
|
<p>On Windows, you need to link to the <code>PDFIO1.LIB</code> (DLL) library and include the <code>zlib_native</code> NuGet package dependency. You can also use the published <code>pdfio_native</code> NuGet package.</p>
|
|
<h3 class="title" id="header-files">Header Files</h3>
|
|
<p>PDFio provides a primary header file that is always used:</p>
|
|
<pre><code class="language-c"><span class="directive">#include <pdfio.h></span>
|
|
</code></pre>
|
|
<p>PDFio also provides <a href="#pdf-content-helper-functions">PDF content helper functions</a> for producing PDF content that are defined in a separate header file:</p>
|
|
<pre><code class="language-c"><span class="directive">#include <pdfio-content.h></span>
|
|
</code></pre>
|
|
<h3 class="title" id="understanding-pdf-files">Understanding PDF Files</h3>
|
|
<p>A PDF file provides data and commands for displaying pages of graphics and text, and is structured in a way that allows it to be displayed in the same way across multiple devices and platforms. The following is a PDF which shows "Hello, World!" on one page:</p>
|
|
<pre><code>%PDF-1.0 % Header starts here
|
|
%âãÏÓ
|
|
1 0 obj % Body starts here
|
|
<<
|
|
/Kids [2 0 R]
|
|
/Count 1
|
|
/Type /Pages
|
|
</code></pre>
|
|
<blockquote>
|
|
<p>> endobj 2 0 obj <a href="<
|
|
/Rotate 0
|
|
/Parent 1 0 R
|
|
/Resources 3 0 R
|
|
/MediaBox [0 0 612 792]
|
|
/Contents [4 0 R]/Type /Page
|
|
"><
|
|
/Rotate 0
|
|
/Parent 1 0 R
|
|
/Resources 3 0 R
|
|
/MediaBox [0 0 612 792]
|
|
/Contents [4 0 R]/Type /Page
|
|
</a> endobj 3 0 obj <a href="<
|
|
/Font
|
|
<<
|
|
/F0
|
|
<<
|
|
/BaseFont /Times-Italic
|
|
/Subtype /Type1
|
|
/Type /Font
|
|
"><
|
|
/Font
|
|
<<
|
|
/F0
|
|
<<
|
|
/BaseFont /Times-Italic
|
|
/Subtype /Type1
|
|
/Type /Font
|
|
</a> > > endobj 4 0 obj <a href="<
|
|
/Length 65
|
|
"><
|
|
/Length 65
|
|
</a> stream</p>
|
|
</blockquote>
|
|
<ol>
|
|
<li><p>0. 0. 1. 50. 700. cm BT /F0 36. Tf (Hello, World!) Tj ET endstream endobj 5 0 obj << /Pages 1 0 R /Type /Catalog</p>
|
|
</li>
|
|
</ol>
|
|
<blockquote>
|
|
<p>> endobj xref % Cross-reference table starts here 0 6 0000000000 65535 f 0000000015 00000 n 0000000074 00000 n 0000000192 00000 n 0000000291 00000 n 0000000409 00000 n trailer % Trailer starts here << /Root 5 0 R /Size 6 > startxref 459 %%EOF</p>
|
|
<pre><code></code></pre>
|
|
</blockquote>
|
|
<h4 id="header">Header</h4>
|
|
<p>The header is the first line of a PDF file that specifies the version of the PDF format that has been used, for example <code>%PDF-1.0</code>.</p>
|
|
<p>Since PDF files almost always contain binary data, they can become corrupted if line endings are changed. For example, if the file is transferred using FTP in text mode or is edited in Notepad on Windows. To allow legacy file transfer programs to determine that the file is binary, the PDF standard recommends including some bytes with character codes higher than 127 in the header, for example:</p>
|
|
<pre><code>%âãÏÓ
|
|
</code></pre>
|
|
<p>The percent sign indicates a comment line while the other few bytes are arbitrary character codes in excess of 127. So, the whole header in our example is:</p>
|
|
<pre><code>%PDF-1.0
|
|
%âãÏÓ
|
|
</code></pre>
|
|
<h4 id="body">Body</h4>
|
|
<p>The file body consists of a sequence of objects, each preceded by an object number, generation number, and the obj keyword on one line, and followed by the endobj keyword on another. For example:</p>
|
|
<pre><code>1 0 obj
|
|
<<
|
|
/Kids [2 0 R]
|
|
/Count 1
|
|
/Type /Pages
|
|
</code></pre>
|
|
<blockquote>
|
|
<p>> endobj</p>
|
|
<pre><code></code></pre>
|
|
</blockquote>
|
|
<p>In this example, the object number is 1 and the generation number is 0, meaning it is the first version of the object. The content for object 1 is between the initial <code>1 0 obj</code> and trailing <code>endobj</code> lines. In this case, the content is the dictionary <code><</Kids [2 0 R] /Count 1 /Type /Pages>></code>.</p>
|
|
<h4 id="cross-reference-table">Cross-Reference Table</h4>
|
|
<p>The cross-reference table lists the byte offset of each object in the file body. This allows random access to objects, meaning they don't have to be read in order. Objects that are not used are never read, making the process efficient. Operations like counting the number of pages in a PDF document are fast, even in large files.</p>
|
|
<p>Each object has an object number and a generation number. Generation numbers are used when a cross-reference table entry is reused. For simplicity, we will assume generation numbers to be always zero and ignore them. The cross-reference table consists of a header line that indicates the number of entries, a free entry line for object 0, and a line for each of the objects in the file body. For example:</p>
|
|
<pre><code>0 6 % Six entries in table, starting at 0
|
|
0000000000 65535 f % Free entry for object 0
|
|
0000000015 00000 n % Object 1 is at byte offset 15
|
|
0000000074 00000 n % Object 2 is at byte offset 74
|
|
0000000192 00000 n % etc...
|
|
0000000291 00000 n
|
|
0000000409 00000 n % Object 5 is at byte offset 409
|
|
</code></pre>
|
|
<h4 id="trailer">Trailer</h4>
|
|
<p>The first line of the trailer is just the <code>trailer</code> keyword. This is followed by the trailer dictionary which contains at least the <code>/Size</code> entry specifying the number of entries in the cross-reference table and the <code>/Root</code> entry which references the object for the document catalog which is the root element of the graph of objects in the body.</p>
|
|
<p>There follows a line with just the <code>startxref</code> keyword, a line with a single number specifying the byte offset of the start of the cross-reference table within the file, and then the line <code>%%EOF</code> which signals the end of the PDF file.</p>
|
|
<pre><code>trailer % Trailer keyword
|
|
<< % The trailer dictinonary
|
|
/Root 5 0 R
|
|
/Size 6
|
|
</code></pre>
|
|
<blockquote>
|
|
<p>> startxref % startxref keyword 459 % Byte offset of cross-reference table %%EOF % End-of-file marker</p>
|
|
<pre><code></code></pre>
|
|
</blockquote>
|
|
<h2 class="title" id="api-overview">API Overview</h2>
|
|
<p>PDFio exposes several types:</p>
|
|
<ul>
|
|
<li><p><code>pdfio_file_t</code>: A PDF file (for reading or writing)</p>
|
|
</li>
|
|
<li><p><code>pdfio_array_t</code>: An array of values</p>
|
|
</li>
|
|
<li><p><code>pdfio_dict_t</code>: A dictionary of key/value pairs in a PDF file, object, etc.</p>
|
|
</li>
|
|
<li><p><code>pdfio_obj_t</code>: An object in a PDF file</p>
|
|
</li>
|
|
<li><p><code>pdfio_stream_t</code>: An object stream</p>
|
|
</li>
|
|
</ul>
|
|
<h3 class="title" id="reading-pdf-files">Reading PDF Files</h3>
|
|
<p>You open an existing PDF file using the <a href="#pdfioFileOpen"><code>pdfioFileOpen</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileOpen(<span class="string">"myinputfile.pdf"</span>, password_cb, password_data,
|
|
error_cb, error_data);
|
|
</code></pre>
|
|
<p>where the five arguments to the function are the filename ("myinputfile.pdf"), an optional password callback function (<code>password_cb</code>) and data pointer value (<code>password_data</code>), and an optional error callback function (<code>error_cb</code>) and data pointer value (<code>error_data</code>). The password callback is called for encrypted PDF files that are not using the default password, for example:</p>
|
|
<pre><code class="language-c"><span class="reserved">const</span> <span class="reserved">char</span> *
|
|
password_cb(<span class="reserved">void</span> *data, <span class="reserved">const</span> <span class="reserved">char</span> *filename)
|
|
{
|
|
(<span class="reserved">void</span>)data; <span class="comment">// This callback doesn't use the data pointer</span>
|
|
(<span class="reserved">void</span>)filename; <span class="comment">// This callback doesn't use the filename</span>
|
|
|
|
<span class="comment">// Return a password string for the file...</span>
|
|
<span class="reserved">return</span> (<span class="string">"Password42"</span>);
|
|
}
|
|
</code></pre>
|
|
<p>The error callback is called for both errors and warnings and accepts the <code>pdfio_file_t</code> pointer, a message string, and the callback pointer value, for example:</p>
|
|
<pre><code class="language-c"><span class="reserved">bool</span>
|
|
error_cb(pdfio_file_t *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *message, <span class="reserved">void</span> *data)
|
|
{
|
|
(<span class="reserved">void</span>)data; <span class="comment">// This callback does not use the data pointer</span>
|
|
|
|
fprintf(stderr, <span class="string">"%s: %s\n"</span>, pdfioFileGetName(pdf), message);
|
|
|
|
<span class="comment">// Return false to treat warnings as errors</span>
|
|
<span class="reserved">return</span> (<span class="reserved">false</span>);
|
|
}
|
|
</code></pre>
|
|
<p>The default error callback (<code>NULL</code>) does the equivalent of the above.</p>
|
|
<p>Each PDF file contains one or more pages. The <a href="#pdfioFileGetNumPages"><code>pdfioFileGetNumPages</code></a> function returns the number of pages in the file while the <a href="#pdfioFileGetPage"><code>pdfioFileGetPage</code></a> function gets the specified page in the PDF file:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf; <span class="comment">// PDF file</span>
|
|
size_t i; <span class="comment">// Looping var</span>
|
|
size_t count; <span class="comment">// Number of pages</span>
|
|
pdfio_obj_t *page; <span class="comment">// Current page</span>
|
|
|
|
<span class="comment">// Iterate the pages in the PDF file</span>
|
|
<span class="reserved">for</span> (i = <span class="number">0</span>, count = pdfioFileGetNumPages(pdf); i < count; i ++)
|
|
{
|
|
page = pdfioFileGetPage(pdf, i);
|
|
<span class="comment">// do something with page</span>
|
|
}
|
|
</code></pre>
|
|
<p>Each page is represented by a "page tree" object (what <a href="#pdfioFileGetPage"><code>pdfioFileGetPage</code></a> returns) that specifies information about the page and one or more "content" objects that contain the images, fonts, text, and graphics that appear on the page. Use the <a href="#pdfioPageGetNumStreams"><code>pdfioPageGetNumStreams</code></a> and <a href="#pdfioPageOpenStream"><code>pdfioPageOpenStream</code></a> functions to access the content streams for each page, and <a href="#pdfioObjGetDict"><code>pdfioObjGetDict</code></a> to get the associated page object dictionary. For example, if you want to display the media and crop boxes for a given page:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf; <span class="comment">// PDF file</span>
|
|
size_t i; <span class="comment">// Looping var</span>
|
|
size_t count; <span class="comment">// Number of pages</span>
|
|
pdfio_obj_t *page; <span class="comment">// Current page</span>
|
|
pdfio_dict_t *dict; <span class="comment">// Current page dictionary</span>
|
|
pdfio_array_t *media_box; <span class="comment">// MediaBox array</span>
|
|
<span class="reserved">double</span> media_values[<span class="number">4</span>]; <span class="comment">// MediaBox values</span>
|
|
pdfio_array_t *crop_box; <span class="comment">// CropBox array</span>
|
|
<span class="reserved">double</span> crop_values[<span class="number">4</span>]; <span class="comment">// CropBox values</span>
|
|
|
|
<span class="comment">// Iterate the pages in the PDF file</span>
|
|
<span class="reserved">for</span> (i = <span class="number">0</span>, count = pdfioFileGetNumPages(pdf); i < count; i ++)
|
|
{
|
|
page = pdfioFileGetPage(pdf, i);
|
|
dict = pdfioObjGetDict(page);
|
|
|
|
media_box = pdfioDictGetArray(dict, <span class="string">"MediaBox"</span>);
|
|
media_values[<span class="number">0</span>] = pdfioArrayGetNumber(media_box, <span class="number">0</span>);
|
|
media_values[<span class="number">1</span>] = pdfioArrayGetNumber(media_box, <span class="number">1</span>);
|
|
media_values[<span class="number">2</span>] = pdfioArrayGetNumber(media_box, <span class="number">2</span>);
|
|
media_values[<span class="number">3</span>] = pdfioArrayGetNumber(media_box, <span class="number">3</span>);
|
|
|
|
crop_box = pdfioDictGetArray(dict, <span class="string">"CropBox"</span>);
|
|
crop_values[<span class="number">0</span>] = pdfioArrayGetNumber(crop_box, <span class="number">0</span>);
|
|
crop_values[<span class="number">1</span>] = pdfioArrayGetNumber(crop_box, <span class="number">1</span>);
|
|
crop_values[<span class="number">2</span>] = pdfioArrayGetNumber(crop_box, <span class="number">2</span>);
|
|
crop_values[<span class="number">3</span>] = pdfioArrayGetNumber(crop_box, <span class="number">3</span>);
|
|
|
|
printf(<span class="string">"Page %u: MediaBox=[%g %g %g %g], CropBox=[%g %g %g %g]\n"</span>,
|
|
(<span class="reserved">unsigned</span>)(i + <span class="number">1</span>),
|
|
media_values[<span class="number">0</span>], media_values[<span class="number">1</span>], media_values[<span class="number">2</span>], media_values[<span class="number">3</span>],
|
|
crop_values[<span class="number">0</span>], crop_values[<span class="number">1</span>], crop_values[<span class="number">2</span>], crop_values[<span class="number">3</span>]);
|
|
}
|
|
</code></pre>
|
|
<p>Page object dictionaries have several (mostly optional) key/value pairs, including:</p>
|
|
<ul>
|
|
<li><p>"Annots": An array of annotation dictionaries for the page; use <a href="#pdfioDictGetArray"><code>pdfioDictGetArray</code></a> to get the array</p>
|
|
</li>
|
|
<li><p>"CropBox": The crop box as an array of four numbers for the left, bottom, right, and top coordinates of the target media; use <a href="#pdfioDictGetArray"><code>pdfioDictGetArray</code></a> to get a pointer to the array of numbers</p>
|
|
</li>
|
|
<li><p>"Dur": The number of seconds the page should be displayed; use <a href="#pdfioDictGetNumber"><code>pdfioDictGetNumber</code></a> to get the page duration value</p>
|
|
</li>
|
|
<li><p>"Group": The dictionary of transparency group values for the page; use <a href="#pdfioDictGetDict"><code>pdfioDictGetDict</code></a> to get a pointer to the resources dictionary</p>
|
|
</li>
|
|
<li><p>"LastModified": The date and time when this page was last modified; use <a href="#pdfioDictGetDate"><code>pdfioDictGetDate</code></a> to get the Unix <code>time_t</code> value</p>
|
|
</li>
|
|
<li><p>"Parent": The parent page tree node object for this page; use <a href="#pdfioDictGetObj"><code>pdfioDictGetObj</code></a> to get a pointer to the object</p>
|
|
</li>
|
|
<li><p>"MediaBox": The media box as an array of four numbers for the left, bottom, right, and top coordinates of the target media; use <a href="#pdfioDictGetArray"><code>pdfioDictGetArray</code></a> to get a pointer to the array of numbers</p>
|
|
</li>
|
|
<li><p>"Resources": The dictionary of resources for the page; use <a href="#pdfioDictGetDict"><code>pdfioDictGetDict</code></a> to get a pointer to the resources dictionary</p>
|
|
</li>
|
|
<li><p>"Rotate": A number indicating the number of degrees of counter-clockwise rotation to apply to the page when viewing; use <a href="#pdfioDictGetNumber"><code>pdfioDictGetNumber</code></a> to get the rotation angle</p>
|
|
</li>
|
|
<li><p>"Thumb": A thumbnail image object for the page; use <a href="#pdfioDictGetObj"><code>pdfioDictGetObj</code></a> to get a pointer to the thumbnail image object</p>
|
|
</li>
|
|
<li><p>"Trans": The page transition dictionary; use <a href="#pdfioDictGetDict"><code>pdfioDictGetDict</code></a> to get a pointer to the dictionary</p>
|
|
</li>
|
|
</ul>
|
|
<p>The <a href="#pdfioFileClose"><code>pdfioFileClose</code></a> function closes a PDF file and frees all memory that was used for it:</p>
|
|
<pre><code class="language-c">pdfioFileClose(pdf);
|
|
</code></pre>
|
|
<h3 class="title" id="writing-pdf-files">Writing PDF Files</h3>
|
|
<p>You create a new PDF file using the <a href="#pdfioFileCreate"><code>pdfioFileCreate</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_rect_t media_box = { <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">612.0</span>, <span class="number">792.0</span> }; <span class="comment">// US Letter</span>
|
|
pdfio_rect_t crop_box = { <span class="number">36.0</span>, <span class="number">36.0</span>, <span class="number">576.0</span>, <span class="number">756.0</span> }; <span class="comment">// w/0.5" margins</span>
|
|
|
|
pdfio_file_t *pdf = pdfioFileCreate(<span class="string">"myoutputfile.pdf"</span>, <span class="string">"2.0"</span>, &media_box, &crop_box, error_cb, error_data);
|
|
</code></pre>
|
|
<p>where the six arguments to the function are the filename ("myoutputfile.pdf"), PDF version ("2.0"), media box (<code>media_box</code>), crop box (<code>crop_box</code>), an optional error callback function (<code>error_cb</code>), and an optional pointer value for the error callback function (<code>error_data</code>). The units for the media and crop boxes are points (1/72nd of an inch).</p>
|
|
<p>Alternately you can stream a PDF file using the <a href="#pdfioFileCreateOutput"><code>pdfioFileCreateOutput</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_rect_t media_box = { <span class="number">0.0</span>, <span class="number">0.0</span>, <span class="number">612.0</span>, <span class="number">792.0</span> }; <span class="comment">// US Letter</span>
|
|
pdfio_rect_t crop_box = { <span class="number">36.0</span>, <span class="number">36.0</span>, <span class="number">576.0</span>, <span class="number">756.0</span> }; <span class="comment">// w/0.5" margins</span>
|
|
|
|
pdfio_file_t *pdf = pdfioFileCreateOutput(output_cb, output_ctx, <span class="string">"2.0"</span>, &media_box, &crop_box, error_cb, error_data);
|
|
</code></pre>
|
|
<p>Once the file is created, use the <a href="#pdfioFileCreateObj"><code>pdfioFileCreateObj</code></a>, <a href="#pdfioFileCreatePage"><code>pdfioFileCreatePage</code></a>, and <a href="#pdfioPageCopy"><code>pdfioPageCopy</code></a> functions to create objects and pages in the file.</p>
|
|
<p>Finally, the <a href="#pdfioFileClose"><code>pdfioFileClose</code></a> function writes the PDF cross-reference and "trailer" information, closes the file, and frees all memory that was used for it.</p>
|
|
<h3 class="title" id="pdf-objects">PDF Objects</h3>
|
|
<p>PDF objects are identified using two numbers - the object number (1 to N) and the object generation (0 to 65535) that specifies a particular version of an object. An object's numbers are returned by the <a href="#pdfioObjGetNumber"><code>pdfioObjGetNumber</code></a> and <a href="#pdfioObjGetGeneration"><code>pdfioObjGetGeneration</code></a> functions. You can find a numbered object using the <a href="#pdfioFileFindObj"><code>pdfioFileFindObj</code></a> function.</p>
|
|
<p>Objects contain values (typically dictionaries) and usually an associated data stream containing images, fonts, ICC profiles, and page content. PDFio provides several accessor functions to get the value(s) associated with an object:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioObjGetArray"><code>pdfioObjGetArray</code></a> returns an object's array value, if any</p>
|
|
</li>
|
|
<li><p><a href="#pdfioObjGetDict"><code>pdfioObjGetDict</code></a> returns an object's dictionary value, if any</p>
|
|
</li>
|
|
<li><p><a href="#pdfioObjGetLength"><code>pdfioObjGetLength</code></a> returns the length of the data stream, if any</p>
|
|
</li>
|
|
<li><p><a href="#pdfioObjGetSubtype"><code>pdfioObjGetSubtype</code></a> returns the sub-type name of the object, for example "Image" for an image object.</p>
|
|
</li>
|
|
<li><p><a href="#pdfioObjGetType"><code>pdfioObjGetType</code></a> returns the type name of the object, for example "XObject" for an image object.</p>
|
|
</li>
|
|
</ul>
|
|
<h3 class="title" id="pdf-streams">PDF Streams</h3>
|
|
<p>Some PDF objects have an associated data stream, such as for pages, images, ICC color profiles, and fonts. You access the stream for an existing object using the <a href="#pdfioObjOpenStream"><code>pdfioObjOpenStream</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileOpen(...);
|
|
pdfio_obj_t *obj = pdfioFileFindObj(pdf, number);
|
|
pdfio_stream_t *st = pdfioObjOpenStream(obj, <span class="reserved">true</span>);
|
|
</code></pre>
|
|
<p>The first argument is the object pointer. The second argument is a boolean value that specifies whether you want to decode (typically decompress) the stream data or return it as-is.</p>
|
|
<p>When reading a page stream you'll use the <a href="#pdfioPageOpenStream"><code>pdfioPageOpenStream</code></a> function instead:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileOpen(...);
|
|
pdfio_obj_t *obj = pdfioFileGetPage(pdf, number);
|
|
pdfio_stream_t *st = pdfioPageOpenStream(obj, <span class="number">0</span>, <span class="reserved">true</span>);
|
|
</code></pre>
|
|
<p>Once you have the stream open, you can use one of several functions to read from it:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioStreamConsume"><code>pdfioStreamConsume</code></a> reads and discards a number of bytes in the stream</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamGetToken"><code>pdfioStreamGetToken</code></a> reads a PDF token from the stream</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamPeek"><code>pdfioStreamPeek</code></a> peeks at the next stream data without advancing or "consuming" it</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamRead"><code>pdfioStreamRead</code></a> reads a buffer of data</p>
|
|
</li>
|
|
</ul>
|
|
<p>When you are done reading from the stream, call the <a href="#pdfioStreamClose"><code>pdfioStreamClose</code></a> function:</p>
|
|
<pre><code class="language-c">pdfioStreamClose(st);
|
|
</code></pre>
|
|
<p>To create a stream for a new object, call the <a href="#pdfioObjCreateStream"><code>pdfioObjCreateStream</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_obj_t *obj = pdfioFileCreateObj(pdf, ...);
|
|
pdfio_stream_t *st = pdfioObjCreateStream(obj, PDFIO_FILTER_FLATE);
|
|
</code></pre>
|
|
<p>The first argument is the newly created object. The second argument is either <code>PDFIO_FILTER_NONE</code> to specify that any encoding is done by your program or <code>PDFIO_FILTER_FLATE</code> to specify that PDFio should Flate compress the stream.</p>
|
|
<p>To create a page content stream call the <a href="#pdfioFileCreatePage"><code>pdfioFileCreatePage</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_dict_t *dict = pdfioDictCreate(pdf);
|
|
... set page dictionary keys <span class="reserved">and</span> values ...
|
|
pdfio_stream_t *st = pdfioFileCreatePage(pdf, dict);
|
|
</code></pre>
|
|
<p>Once you have created the stream, use any of the following functions to write to the stream:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioStreamPrintf"><code>pdfioStreamPrintf</code></a> writes a formatted string to the stream</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamPutChar"><code>pdfioStreamPutChar</code></a> writes a single character to the stream</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamPuts"><code>pdfioStreamPuts</code></a> writes a C string to the stream</p>
|
|
</li>
|
|
<li><p><a href="#pdfioStreamWrite"><code>pdfioStreamWrite</code></a> writes a buffer of data to the stream</p>
|
|
</li>
|
|
</ul>
|
|
<p>The <a href="#pdf-content-helper-functions">PDF content helper functions</a> provide additional functions for writing specific PDF page stream commands.</p>
|
|
<p>When you are done writing the stream, call <a href="#pdfioStreamClose"><code>pdfioStreamClose</code></a> to close both the stream and the object.</p>
|
|
<h3 class="title" id="pdf-content-helper-functions">PDF Content Helper Functions</h3>
|
|
<p>PDFio includes many helper functions for embedding or writing specific kinds of content to a PDF file. These functions can be roughly grouped into five categories:</p>
|
|
<ul>
|
|
<li><p><a href="#color-space-functions">Color Space Functions</a></p>
|
|
</li>
|
|
<li><p><a href="#font-object-functions">Font Object Functions</a></p>
|
|
</li>
|
|
<li><p><a href="#image-object-functions">Image Object Functions</a></p>
|
|
</li>
|
|
<li><p><a href="#page-stream-functions">Page Stream Functions</a></p>
|
|
</li>
|
|
<li><p><a href="#page-dictionary-functions">Page Dictionary Functions</a></p>
|
|
</li>
|
|
</ul>
|
|
<h4 id="color-space-functions">Color Space Functions</h4>
|
|
<p>PDF color spaces are specified using well-known names like "DeviceCMYK", "DeviceGray", and "DeviceRGB" or using arrays that define so-called calibrated color spaces. PDFio provides several functions for embedding ICC profiles and creating color space arrays:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioArrayCreateColorFromICCObj"><code>pdfioArrayCreateColorFromICCObj</code></a> creates a color array for an ICC color profile object</p>
|
|
</li>
|
|
<li><p><a href="#pdfioArrayCreateColorFromMatrix"><code>pdfioArrayCreateColorFromMatrix</code></a> creates a color array using a CIE XYZ color transform matrix, a gamma value, and a CIE XYZ white point</p>
|
|
</li>
|
|
<li><p><a href="#pdfioArrayCreateColorFromPalette"><code>pdfioArrayCreateColorFromPalette</code></a> creates an indexed color array from an array of sRGB values</p>
|
|
</li>
|
|
<li><p><a href="#pdfioArrayCreateColorFromPrimaries"><code>pdfioArrayCreateColorFromPrimaries</code></a> creates a color array using CIE XYZ primaries and a gamma value</p>
|
|
</li>
|
|
<li><p><a href="#pdfioArrayCreateColorFromStandard"><code>pdfioArrayCreateColorFromStandard</code></a> creates a color array for a standard color space</p>
|
|
</li>
|
|
</ul>
|
|
<p>You can embed an ICC color profile using the <a href="#pdfioFileCreateICCObjFromFile"><code>pdfioFileCreateICCObjFromFile</code></a> function:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_obj_t *icc = pdfioFileCreateICCObjFromFile(pdf, <span class="string">"filename.icc"</span>);
|
|
</code></pre>
|
|
<p>where the first argument is the PDF file and the second argument is the filename of the ICC color profile.</p>
|
|
<p>PDFio also includes predefined constants for creating a few standard color spaces:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
|
|
<span class="comment">// Create an AdobeRGB color array</span>
|
|
pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromStandard(pdf, <span class="number">3</span>, PDFIO_CS_ADOBE);
|
|
|
|
<span class="comment">// Create an Display P3 color array</span>
|
|
pdfio_array_t *display_p3 = pdfioArrayCreateColorFromStandard(pdf, <span class="number">3</span>, PDFIO_CS_P3_D65);
|
|
|
|
<span class="comment">// Create an sRGB color array</span>
|
|
pdfio_array_t *srgb = pdfioArrayCreateColorFromStandard(pdf, <span class="number">3</span>, PDFIO_CS_SRGB);
|
|
</code></pre>
|
|
<h4 id="font-object-functions">Font Object Functions</h4>
|
|
<p>PDF supports many kinds of fonts, including PostScript Type1, PDF Type3, TrueType/OpenType, and CID. PDFio provides two functions for creating font objects. The first is <a href="#pdfioFileCreateFontObjFromBase"><code>pdfioFileCreateFontObjFromBase</code></a> which creates a font object for one of the base PDF fonts:</p>
|
|
<ul>
|
|
<li><p>"Courier"</p>
|
|
</li>
|
|
<li><p>"Courier-Bold"</p>
|
|
</li>
|
|
<li><p>"Courier-BoldItalic"</p>
|
|
</li>
|
|
<li><p>"Courier-Italic"</p>
|
|
</li>
|
|
<li><p>"Helvetica"</p>
|
|
</li>
|
|
<li><p>"Helvetica-Bold"</p>
|
|
</li>
|
|
<li><p>"Helvetica-BoldOblique"</p>
|
|
</li>
|
|
<li><p>"Helvetica-Oblique"</p>
|
|
</li>
|
|
<li><p>"Symbol"</p>
|
|
</li>
|
|
<li><p>"Times-Bold"</p>
|
|
</li>
|
|
<li><p>"Times-BoldItalic"</p>
|
|
</li>
|
|
<li><p>"Times-Italic"</p>
|
|
</li>
|
|
<li><p>"Times-Roman"</p>
|
|
</li>
|
|
<li><p>"ZapfDingbats"</p>
|
|
</li>
|
|
</ul>
|
|
<p>PDFio always uses the Windows CP1252 subset of Unicode for these fonts.</p>
|
|
<p>The second function is <a href="#pdfioFileCreateFontObjFromFile"><code>pdfioFileCreateFontObjFromFile</code></a> which creates a font object from a TrueType/OpenType font file, for example:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_obj_t *arial = pdfioFileCreateFontObjFromFile(pdf, <span class="string">"OpenSans-Regular.ttf"</span>, <span class="reserved">false</span>);
|
|
</code></pre>
|
|
<p>will embed an OpenSans Regular TrueType font using the Windows CP1252 subset of Unicode. Pass <code>true</code> for the third argument to embed it as a Unicode CID font instead, for example:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_obj_t *arial = pdfioFileCreateFontObjFromFile(pdf, <span class="string">"NotoSansJP-Regular.otf"</span>, <span class="reserved">true</span>);
|
|
</code></pre>
|
|
<p>will embed the NotoSansJP Regular OpenType font with full support for Unicode.</p>
|
|
<blockquote>
|
|
<p>Note: Not all fonts support Unicode.</p>
|
|
</blockquote>
|
|
<h4 id="image-object-functions">Image Object Functions</h4>
|
|
<p>PDF supports images with many different color spaces and bit depths with optional transparency. PDFio provides two helper functions for creating image objects that can be referenced in page streams. The first function is <a href="#pdfioFileCreateImageObjFromData"><code>pdfioFileCreateImageObjFromData</code></a> which creates an image object from data in memory, for example:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
<span class="reserved">unsigned</span> <span class="reserved">char</span> data[<span class="number">1024</span> * <span class="number">1024</span> * <span class="number">4</span>]; <span class="comment">// 1024x1024 RGBA image data</span>
|
|
pdfio_obj_t *img = pdfioFileCreateImageObjFromData(pdf, data, <span class="comment">/*width*/</span><span class="number">1024</span>, <span class="comment">/*height*/</span><span class="number">1024</span>, <span class="comment">/*num_colors*/</span><span class="number">3</span>, <span class="comment">/*color_data*/</span>NULL, <span class="comment">/*alpha*/</span><span class="reserved">true</span>, <span class="comment">/*interpolate*/</span><span class="reserved">false</span>);
|
|
</code></pre>
|
|
<p>will create an object for a 1024x1024 RGBA image in memory, using the default color space for 3 colors ("DeviceRGB"). We can use one of the <a href="#color-space-functions">color space functions</a> to use a specific color space for this image, for example:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
|
|
<span class="comment">// Create an AdobeRGB color array</span>
|
|
pdfio_array_t *adobe_rgb = pdfioArrayCreateColorFromMatrix(pdf, <span class="number">3</span>, pdfioAdobeRGBGamma, pdfioAdobeRGBMatrix, pdfioAdobeRGBWhitePoint);
|
|
|
|
<span class="comment">// Create a 1024x1024 RGBA image using AdobeRGB</span>
|
|
<span class="reserved">unsigned</span> <span class="reserved">char</span> data[<span class="number">1024</span> * <span class="number">1024</span> * <span class="number">4</span>]; <span class="comment">// 1024x1024 RGBA image data</span>
|
|
pdfio_obj_t *img = pdfioFileCreateImageObjFromData(pdf, data, <span class="comment">/*width*/</span><span class="number">1024</span>, <span class="comment">/*height*/</span><span class="number">1024</span>, <span class="comment">/*num_colors*/</span><span class="number">3</span>, <span class="comment">/*color_data*/</span>adobe_rgb, <span class="comment">/*alpha*/</span><span class="reserved">true</span>, <span class="comment">/*interpolate*/</span><span class="reserved">false</span>);
|
|
</code></pre>
|
|
<p>The "interpolate" argument specifies whether the colors in the image should be smoothed/interpolated when scaling. This is most useful for photographs but should be <code>false</code> for screenshot and barcode images.</p>
|
|
<p>If you have a JPEG or PNG file, use the <a href="#pdfioFileCreateImageObjFromFile"><code>pdfioFileCreateImageObjFromFile</code></a> function to copy the image into a PDF image object, for example:</p>
|
|
<pre><code class="language-c">pdfio_file_t *pdf = pdfioFileCreate(...);
|
|
pdfio_obj_t *img = pdfioFileCreateImageObjFromFile(pdf, <span class="string">"myphoto.jpg"</span>, <span class="comment">/*interpolate*/</span><span class="reserved">true</span>);
|
|
</code></pre>
|
|
<h4 id="page-dictionary-functions">Page Dictionary Functions</h4>
|
|
<p>PDF pages each have an associated dictionary to specify the images, fonts, and color spaces used by the page. PDFio provides functions to add these resources to the dictionary:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioPageDictAddColorSpace"><code>pdfioPageDictAddColorSpace</code></a> adds a named color space to the page dictionary</p>
|
|
</li>
|
|
<li><p><a href="#pdfioPageDictAddFont"><code>pdfioPageDictAddFont</code></a> adds a named font to the page dictionary</p>
|
|
</li>
|
|
<li><p><a href="#pdfioPageDictAddImage"><code>pdfioPageDictAddImage</code></a> adds a named image to the page dictionary</p>
|
|
</li>
|
|
</ul>
|
|
<h4 id="page-stream-functions">Page Stream Functions</h4>
|
|
<p>PDF page streams contain textual commands for drawing on the page. PDFio provides many functions for writing these commands with the correct format and escaping, as needed:</p>
|
|
<ul>
|
|
<li><p><a href="#pdfioContentClip"><code>pdfioContentClip</code></a> clips future drawing to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentDrawImage"><code>pdfioContentDrawImage</code></a> draws an image object</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentFill"><code>pdfioContentFill</code></a> fills the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentFillAndStroke"><code>pdfioContentFillAndStroke</code></a> fills and strokes the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentMatrixConcat"><code>pdfioContentMatrixConcat</code></a> concatenates a matrix with the current transform matrix</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentMatrixRotate"><code>pdfioContentMatrixRotate</code></a> concatenates a rotation matrix with the current transform matrix</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentMatrixScale"><code>pdfioContentMatrixScale</code></a> concatenates a scaling matrix with the current transform matrix</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentMatrixTranslate"><code>pdfioContentMatrixTranslate</code></a> concatenates a translation matrix with the current transform matrix</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathClose"><code>pdfioContentPathClose</code></a> closes the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathCurve"><code>pdfioContentPathCurve</code></a> appends a Bezier curve to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathCurve13"><code>pdfioContentPathCurve13</code></a> appends a Bezier curve with 2 control points to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathCurve23"><code>pdfioContentPathCurve23</code></a> appends a Bezier curve with 2 control points to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathLineTo"><code>pdfioContentPathLineTo</code></a> appends a line to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathMoveTo"><code>pdfioContentPathMoveTo</code></a> moves the current point in the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentPathRect"><code>pdfioContentPathRect</code></a> appends a rectangle to the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentRestore"><code>pdfioContentRestore</code></a> restores a previous graphics state</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSave"><code>pdfioContentSave</code></a> saves the current graphics state</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetDashPattern"><code>pdfioContentSetDashPattern</code></a> sets the line dash pattern</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorDeviceCMYK"><code>pdfioContentSetFillColorDeviceCMYK</code></a> sets the current fill color using a device CMYK color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorDeviceGray"><code>pdfioContentSetFillColorDeviceGray</code></a> sets the current fill color using a device gray color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorDeviceRGB"><code>pdfioContentSetFillColorDeviceRGB</code></a> sets the current fill color using a device RGB color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorGray"><code>pdfioContentSetFillColorGray</code></a> sets the current fill color using a calibrated gray color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorRGB"><code>pdfioContentSetFillColorRGB</code></a> sets the current fill color using a calibrated RGB color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFillColorSpace"><code>pdfioContentSetFillColorSpace</code></a> sets the current fill color space</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetFlatness"><code>pdfioContentSetFlatness</code></a> sets the flatness for curves</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetLineCap"><code>pdfioContentSetLineCap</code></a> sets how the ends of lines are stroked</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetLineJoin"><code>pdfioContentSetLineJoin</code></a> sets how connections between lines are stroked</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetLineWidth"><code>pdfioContentSetLineWidth</code></a> sets the width of stroked lines</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetMiterLimit"><code>pdfioContentSetMiterLimit</code></a> sets the miter limit for stroked lines</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorDeviceCMYK"><code>pdfioContentSetStrokeColorDeviceCMYK</code></a> sets the current stroke color using a device CMYK color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorDeviceGray"><code>pdfioContentSetStrokeColorDeviceGray</code></a> sets the current stroke color using a device gray color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorDeviceRGB"><code>pdfioContentSetStrokeColorDeviceRGB</code></a> sets the current stroke color using a device RGB color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorGray"><code>pdfioContentSetStrokeColorGray</code></a> sets the current stroke color using a calibrated gray color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorRGB"><code>pdfioContentSetStrokeColorRGB</code></a> sets the current stroke color using a calibrated RGB color</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetStrokeColorSpace"><code>pdfioContentSetStrokeColorSpace</code></a> sets the current stroke color space</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextCharacterSpacing"><code>pdfioContentSetTextCharacterSpacing</code></a> sets the spacing between characters for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextFont"><code>pdfioContentSetTextFont</code></a> sets the font and size for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextLeading"><code>pdfioContentSetTextLeading</code></a> sets the line height for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextMatrix"><code>pdfioContentSetTextMatrix</code></a> concatenates a matrix with the current text matrix</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextRenderingMode"><code>pdfioContentSetTextRenderingMode</code></a> sets the text rendering mode</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextRise"><code>pdfioContentSetTextRise</code></a> adjusts the baseline for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextWordSpacing"><code>pdfioContentSetTextWordSpacing</code></a> sets the spacing between words for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentSetTextXScaling"><code>pdfioContentSetTextXScaling</code></a> sets the horizontal scaling for text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentStroke"><code>pdfioContentStroke</code></a> strokes the current path</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextBegin"><code>pdfioContentTextBegin</code></a> begins a block of text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextEnd"><code>pdfioContentTextEnd</code></a> ends a block of text</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextMoveLine"><code>pdfioContentTextMoveLine</code></a> moves to the next line with an offset in a text block</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextMoveTo"><code>pdfioContentTextMoveTo</code></a> moves within the current line in a text block</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextNewLine"><code>pdfioContentTextNewLine</code></a> moves to the beginning of the next line in a text block</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextNewLineShow"><code>pdfioContentTextNewLineShow</code></a> moves to the beginning of the next line in a text block and shows literal text with optional word and character spacing</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextNewLineShowf"><code>pdfioContentTextNewLineShowf</code></a> moves to the beginning of the next line in a text block and shows formatted text with optional word and character spacing</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextShow"><code>pdfioContentTextShow</code></a> draws a literal string in a text block</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextShowf"><code>pdfioContentTextShowf</code></a> draws a formatted string in a text block</p>
|
|
</li>
|
|
<li><p><a href="#pdfioContentTextShowJustified"><code>pdfioContentTextShowJustified</code></a> draws an array of literal strings with offsets between them</p>
|
|
</li>
|
|
</ul>
|
|
<h2 class="title" id="examples">Examples</h2>
|
|
<h3 class="title" id="read-pdf-metadata">Read PDF Metadata</h3>
|
|
<p>The following example function will open a PDF file and print the title, author, creation date, and number of pages:</p>
|
|
<pre><code class="language-c"><span class="directive">#include <pdfio.h></span>
|
|
<span class="directive">#include <time.h></span>
|
|
|
|
|
|
<span class="reserved">void</span>
|
|
show_pdf_info(<span class="reserved">const</span> <span class="reserved">char</span> *filename)
|
|
{
|
|
pdfio_file_t *pdf;
|
|
time_t creation_date;
|
|
<span class="reserved">struct</span> tm *creation_tm;
|
|
<span class="reserved">char</span> creation_text[<span class="number">256</span>];
|
|
|
|
|
|
<span class="comment">// Open the PDF file with the default callbacks...</span>
|
|
pdf = pdfioFileOpen(filename, <span class="comment">/*password_cb*/</span>NULL, <span class="comment">/*password_cbdata*/</span>NULL, <span class="comment">/*error_cb*/</span>NULL, <span class="comment">/*error_cbdata*/</span>NULL);
|
|
<span class="reserved">if</span> (pdf == NULL)
|
|
<span class="reserved">return</span>;
|
|
|
|
<span class="comment">// Get the creation date and convert to a string...</span>
|
|
creation_date = pdfioFileGetCreationDate(pdf);
|
|
creation_tm = localtime(&creation_date);
|
|
strftime(creation_text, <span class="reserved">sizeof</span>(creation_text), <span class="string">"%c"</span>, &creation_tm);
|
|
|
|
<span class="comment">// Print file information to stdout...</span>
|
|
printf(<span class="string">"%s:\n"</span>, filename);
|
|
printf(<span class="string">" Title: %s\n"</span>, pdfioFileGetTitle(pdf));
|
|
printf(<span class="string">" Author: %s\n"</span>, pdfioFileGetAuthor(pdf));
|
|
printf(<span class="string">" Created On: %s\n"</span>, creation_text);
|
|
printf(<span class="string">" Number Pages: %u\n"</span>, (<span class="reserved">unsigned</span>)pdfioFileGetNumPages(pdf));
|
|
|
|
<span class="comment">// Close the PDF file...</span>
|
|
pdfioFileClose(pdf);
|
|
}
|
|
</code></pre>
|
|
<h3 class="title" id="create-pdf-file-with-text-and-image">Create PDF File With Text and Image</h3>
|
|
<p>The following example function will create a PDF file, embed a base font and the named JPEG or PNG image file, and then creates a page with the image centered on the page with the text centered below:</p>
|
|
<pre><code class="language-c"><span class="directive">#include <pdfio.h></span>
|
|
<span class="directive">#include <pdfio-content.h></span>
|
|
<span class="directive">#include <string.h></span>
|
|
|
|
|
|
<span class="reserved">void</span>
|
|
create_pdf_image_file(<span class="reserved">const</span> <span class="reserved">char</span> *pdfname, <span class="reserved">const</span> <span class="reserved">char</span> *imagename, <span class="reserved">const</span> <span class="reserved">char</span> *caption)
|
|
{
|
|
pdfio_file_t *pdf;
|
|
pdfio_obj_t *font;
|
|
pdfio_obj_t *image;
|
|
pdfio_dict_t *dict;
|
|
pdfio_stream_t *page;
|
|
<span class="reserved">double</span> width, height;
|
|
<span class="reserved">double</span> swidth, sheight;
|
|
<span class="reserved">double</span> tx, ty;
|
|
|
|
|
|
<span class="comment">// Create the PDF file...</span>
|
|
pdf = pdfioFileCreate(pdfname, <span class="comment">/*version*/</span>NULL, <span class="comment">/*media_box*/</span>NULL, <span class="comment">/*crop_box*/</span>NULL, <span class="comment">/*error_cb*/</span>NULL, <span class="comment">/*error_cbdata*/</span>NULL);
|
|
|
|
<span class="comment">// Create a Courier base font for the caption</span>
|
|
font = pdfioFileCreateFontObjFromBase(pdf, <span class="string">"Courier"</span>);
|
|
|
|
<span class="comment">// Create an image object from the JPEG/PNG image file...</span>
|
|
image = pdfioFileCreateImageObjFromFile(pdf, imagename, <span class="reserved">true</span>);
|
|
|
|
<span class="comment">// Create a page dictionary with the font and image...</span>
|
|
dict = pdfioDictCreate(pdf);
|
|
pdfioPageDictAddFont(dict, <span class="string">"F1"</span>, font);
|
|
pdfioPageDictAddImage(dict, <span class="string">"IM1"</span>, image);
|
|
|
|
<span class="comment">// Create the page and its content stream...</span>
|
|
page = pdfioFileCreatePage(pdf, dict);
|
|
|
|
<span class="comment">// Position and scale the image on the page...</span>
|
|
width = pdfioImageGetWidth(image);
|
|
height = pdfioImageGetHeight(image);
|
|
|
|
<span class="comment">// Default media_box is "universal" 595.28x792 points (8.27x11in or 210x279mm)</span>
|
|
<span class="comment">// Use margins of 36 points (0.5in or 12.7mm) with another 36 points for the</span>
|
|
<span class="comment">// caption underneath...</span>
|
|
swidth = <span class="number">595.28</span> - <span class="number">72.0</span>;
|
|
sheight = swidth * height / width;
|
|
<span class="reserved">if</span> (sheight > (<span class="number">792.0</span> - <span class="number">36.0</span> - <span class="number">72.0</span>))
|
|
{
|
|
sheight = <span class="number">792.0</span> - <span class="number">36.0</span> - <span class="number">72.0</span>;
|
|
swidth = sheight * width / height;
|
|
}
|
|
|
|
tx = <span class="number">0.5</span> * (<span class="number">595.28</span> - swidth);
|
|
ty = <span class="number">0.5</span> * (<span class="number">792</span> - <span class="number">36</span> - sheight);
|
|
|
|
pdfioContentDrawImage(page, <span class="string">"IM1"</span>, tx, ty + <span class="number">36.0</span>, swidth, sheight);
|
|
|
|
<span class="comment">// Draw the caption in black...</span>
|
|
pdfioContentSetFillColorDeviceGray(page, <span class="number">0.0</span>);
|
|
|
|
<span class="comment">// Compute the starting point for the text - Courier is monospaced with a</span>
|
|
<span class="comment">// nominal width of 0.6 times the text height...</span>
|
|
tx = <span class="number">0.5</span> * (<span class="number">595.28</span> - <span class="number">18.0</span> * <span class="number">0.6</span> * strlen(caption));
|
|
|
|
<span class="comment">// Position and draw the caption underneath...</span>
|
|
pdfioContentTextBegin(page);
|
|
pdfioContentSetTextFont(page, <span class="string">"F1"</span>, <span class="number">18.0</span>);
|
|
pdfioContentTextMoveTo(page, tx, ty);
|
|
pdfioContentTextShow(page, <span class="comment">/*unicode*/</span><span class="reserved">false</span>, caption);
|
|
pdfioContentTextEnd(page);
|
|
|
|
<span class="comment">// Close the page stream and the PDF file...</span>
|
|
pdfioStreamClose(page);
|
|
pdfioFileClose(pdf);
|
|
}
|
|
</code></pre>
|
|
<h2 class="title"><a id="FUNCTIONS">Functions</a></h2>
|
|
<h3 class="function"><a id="pdfioArrayAppendArray">pdfioArrayAppendArray</a></h3>
|
|
<p class="description">Add an array value to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendArray(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <a href="#pdfio_array_t">pdfio_array_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendBinary">pdfioArrayAppendBinary</a></h3>
|
|
<p class="description">Add a binary string value to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendBinary(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <span class="reserved">const</span> <span class="reserved">unsigned</span> <span class="reserved">char</span> *value, size_t valuelen);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
<tr><th>valuelen</th>
|
|
<td class="description">Length of value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendBoolean">pdfioArrayAppendBoolean</a></h3>
|
|
<p class="description">Add a boolean value to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendBoolean(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <span class="reserved">bool</span> value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendDate">pdfioArrayAppendDate</a></h3>
|
|
<p class="description">Add a date value to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendDate(<a href="#pdfio_array_t">pdfio_array_t</a> *a, time_t value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendDict">pdfioArrayAppendDict</a></h3>
|
|
<p class="description">Add a dictionary to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendDict(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <a href="#pdfio_dict_t">pdfio_dict_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendName">pdfioArrayAppendName</a></h3>
|
|
<p class="description">Add a name to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendName(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendNumber">pdfioArrayAppendNumber</a></h3>
|
|
<p class="description">Add a number to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendNumber(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <span class="reserved">double</span> value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendObj">pdfioArrayAppendObj</a></h3>
|
|
<p class="description">Add an indirect object reference to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendObj(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <a href="#pdfio_obj_t">pdfio_obj_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayAppendString">pdfioArrayAppendString</a></h3>
|
|
<p class="description">Add a string to an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayAppendString(<a href="#pdfio_array_t">pdfio_array_t</a> *a, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioArrayCopy">pdfioArrayCopy</a></h3>
|
|
<p class="description">Copy an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCopy(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_array_t">pdfio_array_t</a> *a);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>a</th>
|
|
<td class="description">Original array</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New array or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioArrayCreate">pdfioArrayCreate</a></h3>
|
|
<p class="description">Create an empty array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreate(<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">New array or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioArrayCreateColorFromICCObj">pdfioArrayCreateColorFromICCObj</a></h3>
|
|
<p class="description">Create an ICC-based color space array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromICCObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_obj_t">pdfio_obj_t</a> *icc_object);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>icc_object</th>
|
|
<td class="description">ICC profile object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Color array</p>
|
|
<h3 class="function"><a id="pdfioArrayCreateColorFromMatrix">pdfioArrayCreateColorFromMatrix</a></h3>
|
|
<p class="description">Create a calibrated color space array using a CIE XYZ transform matrix.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromMatrix(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, <span class="reserved">double</span> gamma, <span class="reserved">const</span> <span class="reserved">double</span> matrix[3][3], <span class="reserved">const</span> <span class="reserved">double</span> white_point[3]);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of colors (1 or 3)</td></tr>
|
|
<tr><th>gamma</th>
|
|
<td class="description">Gamma value</td></tr>
|
|
<tr><th>matrix[3][3]</th>
|
|
<td class="description">XYZ transform</td></tr>
|
|
<tr><th>white_point[3]</th>
|
|
<td class="description">White point</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Color space array</p>
|
|
<h3 class="function"><a id="pdfioArrayCreateColorFromPalette">pdfioArrayCreateColorFromPalette</a></h3>
|
|
<p class="description">Create an indexed color space array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromPalette(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, <span class="reserved">const</span> <span class="reserved">unsigned</span> <span class="reserved">char</span> *colors);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of colors</td></tr>
|
|
<tr><th>colors</th>
|
|
<td class="description">RGB values for colors</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Color array</p>
|
|
<h3 class="function"><a id="pdfioArrayCreateColorFromPrimaries">pdfioArrayCreateColorFromPrimaries</a></h3>
|
|
<p class="description">Create a calibrated color sapce array using CIE xy primary chromacities.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromPrimaries(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, <span class="reserved">double</span> gamma, <span class="reserved">double</span> wx, <span class="reserved">double</span> wy, <span class="reserved">double</span> rx, <span class="reserved">double</span> ry, <span class="reserved">double</span> gx, <span class="reserved">double</span> gy, <span class="reserved">double</span> bx, <span class="reserved">double</span> by);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of colors (1 or 3)</td></tr>
|
|
<tr><th>gamma</th>
|
|
<td class="description">Gama value</td></tr>
|
|
<tr><th>wx</th>
|
|
<td class="description">White point X chromacity</td></tr>
|
|
<tr><th>wy</th>
|
|
<td class="description">White point Y chromacity</td></tr>
|
|
<tr><th>rx</th>
|
|
<td class="description">Red X chromacity</td></tr>
|
|
<tr><th>ry</th>
|
|
<td class="description">Red Y chromacity</td></tr>
|
|
<tr><th>gx</th>
|
|
<td class="description">Green X chromacity</td></tr>
|
|
<tr><th>gy</th>
|
|
<td class="description">Green Y chromacity</td></tr>
|
|
<tr><th>bx</th>
|
|
<td class="description">Blue X chromacity</td></tr>
|
|
<tr><th>by</th>
|
|
<td class="description">Blue Y chromacity</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Color space array</p>
|
|
<h3 class="function"><a id="pdfioArrayCreateColorFromStandard">pdfioArrayCreateColorFromStandard</a></h3>
|
|
<p class="description">Create a color array for a standard color space.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayCreateColorFromStandard(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t num_colors, <a href="#pdfio_cs_t">pdfio_cs_t</a> cs);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of colors (1 or 3)</td></tr>
|
|
<tr><th>cs</th>
|
|
<td class="description">Color space enumeration</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<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>
|
|
<h3 class="function"><a id="pdfioArrayGetArray">pdfioArrayGetArray</a></h3>
|
|
<p class="description">Get an array value from an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioArrayGetArray(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetBinary">pdfioArrayGetBinary</a></h3>
|
|
<p class="description">Get a binary string value from an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">unsigned</span> <span class="reserved">char</span> *pdfioArrayGetBinary(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n, size_t *length);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
<tr><th>length</th>
|
|
<td class="description">Length of string</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetBoolean">pdfioArrayGetBoolean</a></h3>
|
|
<p class="description">Get a boolean value from an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioArrayGetBoolean(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetDate">pdfioArrayGetDate</a></h3>
|
|
<p class="description">Get a date value from an array.</p>
|
|
<p class="code">
|
|
time_t pdfioArrayGetDate(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetDict">pdfioArrayGetDict</a></h3>
|
|
<p class="description">Get a dictionary value from an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioArrayGetDict(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetName">pdfioArrayGetName</a></h3>
|
|
<p class="description">Get a name value from an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioArrayGetName(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetNumber">pdfioArrayGetNumber</a></h3>
|
|
<p class="description">Get a number from an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">double</span> pdfioArrayGetNumber(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetObj">pdfioArrayGetObj</a></h3>
|
|
<p class="description">Get an indirect object reference from an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioArrayGetObj(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetSize">pdfioArrayGetSize</a></h3>
|
|
<p class="description">Get the length of an array.</p>
|
|
<p class="code">
|
|
size_t pdfioArrayGetSize(<a href="#pdfio_array_t">pdfio_array_t</a> *a);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Length of array</p>
|
|
<h3 class="function"><a id="pdfioArrayGetString">pdfioArrayGetString</a></h3>
|
|
<p class="description">Get a string value from an array.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioArrayGetString(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioArrayGetType">pdfioArrayGetType</a></h3>
|
|
<p class="description">Get a value type from an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_valtype_t">pdfio_valtype_t</a> pdfioArrayGetType(<a href="#pdfio_array_t">pdfio_array_t</a> *a, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value type</p>
|
|
<h3 class="function"><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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>a</th>
|
|
<td class="description">Array</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Index</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> otherwise</p>
|
|
<h3 class="function"><a id="pdfioContentClip">pdfioContentClip</a></h3>
|
|
<p class="description">Clip output to the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentClip(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> even_odd);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>even_odd</th>
|
|
<td class="description">Even/odd fill vs. non-zero winding rule</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentDrawImage">pdfioContentDrawImage</a></h3>
|
|
<p class="description">Draw an image object.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentDrawImage(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *name, <span class="reserved">double</span> x, <span class="reserved">double</span> y, <span class="reserved">double</span> width, <span class="reserved">double</span> height);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Image name</td></tr>
|
|
<tr><th>x</th>
|
|
<td class="description">X offset of image</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Y offset of image</td></tr>
|
|
<tr><th>width</th>
|
|
<td class="description">Width of image</td></tr>
|
|
<tr><th>height</th>
|
|
<td class="description">Height of image</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">The object name must be part of the page dictionary resources, typically
|
|
using the <a href="#pdfioPageDictAddImage"><code>pdfioPageDictAddImage</code></a> function.</p>
|
|
<h3 class="function"><a id="pdfioContentFill">pdfioContentFill</a></h3>
|
|
<p class="description">Fill the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentFill(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> even_odd);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>even_odd</th>
|
|
<td class="description">Even/odd fill vs. non-zero winding rule</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentFillAndStroke">pdfioContentFillAndStroke</a></h3>
|
|
<p class="description">Fill and stroke the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentFillAndStroke(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> even_odd);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>even_odd</th>
|
|
<td class="description">Even/odd fill vs. non-zero winding</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentMatrixConcat">pdfioContentMatrixConcat</a></h3>
|
|
<p class="description">Concatenate a matrix to the current graphics
|
|
state.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentMatrixConcat(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, pdfio_matrix_t m);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>m</th>
|
|
<td class="description">Transform matrix</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentMatrixRotate">pdfioContentMatrixRotate</a></h3>
|
|
<p class="description">Rotate the current transform matrix.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentMatrixRotate(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> degrees);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>degrees</th>
|
|
<td class="description">Rotation angle in degrees counter-clockwise</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentMatrixScale">pdfioContentMatrixScale</a></h3>
|
|
<p class="description">Scale the current transform matrix.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentMatrixScale(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> sx, <span class="reserved">double</span> sy);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>sx</th>
|
|
<td class="description">X scale</td></tr>
|
|
<tr><th>sy</th>
|
|
<td class="description">Y scale</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentMatrixTranslate">pdfioContentMatrixTranslate</a></h3>
|
|
<p class="description">Translate the current transform matrix.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentMatrixTranslate(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> tx, <span class="reserved">double</span> ty);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>tx</th>
|
|
<td class="description">X offset</td></tr>
|
|
<tr><th>ty</th>
|
|
<td class="description">Y offset</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathClose">pdfioContentPathClose</a></h3>
|
|
<p class="description">Close the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathClose(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathCurve">pdfioContentPathCurve</a></h3>
|
|
<p class="description">Add a Bezier curve with two control points.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathCurve(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x1, <span class="reserved">double</span> y1, <span class="reserved">double</span> x2, <span class="reserved">double</span> y2, <span class="reserved">double</span> x3, <span class="reserved">double</span> y3);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x1</th>
|
|
<td class="description">X position 1</td></tr>
|
|
<tr><th>y1</th>
|
|
<td class="description">Y position 1</td></tr>
|
|
<tr><th>x2</th>
|
|
<td class="description">X position 2</td></tr>
|
|
<tr><th>y2</th>
|
|
<td class="description">Y position 2</td></tr>
|
|
<tr><th>x3</th>
|
|
<td class="description">X position 3</td></tr>
|
|
<tr><th>y3</th>
|
|
<td class="description">Y position 3</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathCurve13">pdfioContentPathCurve13</a></h3>
|
|
<p class="description">Add a Bezier curve with an initial control point.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathCurve13(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x1, <span class="reserved">double</span> y1, <span class="reserved">double</span> x3, <span class="reserved">double</span> y3);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x1</th>
|
|
<td class="description">X position 1</td></tr>
|
|
<tr><th>y1</th>
|
|
<td class="description">Y position 1</td></tr>
|
|
<tr><th>x3</th>
|
|
<td class="description">X position 3</td></tr>
|
|
<tr><th>y3</th>
|
|
<td class="description">Y position 3</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathCurve23">pdfioContentPathCurve23</a></h3>
|
|
<p class="description">Add a Bezier curve with a trailing control point.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathCurve23(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x2, <span class="reserved">double</span> y2, <span class="reserved">double</span> x3, <span class="reserved">double</span> y3);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x2</th>
|
|
<td class="description">X position 2</td></tr>
|
|
<tr><th>y2</th>
|
|
<td class="description">Y position 2</td></tr>
|
|
<tr><th>x3</th>
|
|
<td class="description">X position 3</td></tr>
|
|
<tr><th>y3</th>
|
|
<td class="description">Y position 3</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathLineTo">pdfioContentPathLineTo</a></h3>
|
|
<p class="description">Add a straight line to the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathLineTo(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x, <span class="reserved">double</span> y);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x</th>
|
|
<td class="description">X position</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Y position</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathMoveTo">pdfioContentPathMoveTo</a></h3>
|
|
<p class="description">Start a new subpath.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathMoveTo(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x, <span class="reserved">double</span> y);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x</th>
|
|
<td class="description">X position</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Y position</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentPathRect">pdfioContentPathRect</a></h3>
|
|
<p class="description">Add a rectangle to the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentPathRect(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> x, <span class="reserved">double</span> y, <span class="reserved">double</span> width, <span class="reserved">double</span> height);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>x</th>
|
|
<td class="description">X offset</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Y offset</td></tr>
|
|
<tr><th>width</th>
|
|
<td class="description">Width</td></tr>
|
|
<tr><th>height</th>
|
|
<td class="description">Height</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentRestore">pdfioContentRestore</a></h3>
|
|
<p class="description">Restore a previous graphics state.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentRestore(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSave">pdfioContentSave</a></h3>
|
|
<p class="description">Save the current graphics state.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSave(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetDashPattern">pdfioContentSetDashPattern</a></h3>
|
|
<p class="description">Set the stroke pattern.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetDashPattern(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> phase, <span class="reserved">double</span> on, <span class="reserved">double</span> off);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>phase</th>
|
|
<td class="description">Phase (offset within pattern)</td></tr>
|
|
<tr><th>on</th>
|
|
<td class="description">On length</td></tr>
|
|
<tr><th>off</th>
|
|
<td class="description">Off length</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function sets the stroke pattern when drawing lines. If "on" and "off"
|
|
are 0, a solid line is drawn.</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorDeviceCMYK">pdfioContentSetFillColorDeviceCMYK</a></h3>
|
|
<p class="description">Set device CMYK fill color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorDeviceCMYK(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> c, <span class="reserved">double</span> m, <span class="reserved">double</span> y, <span class="reserved">double</span> k);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>c</th>
|
|
<td class="description">Cyan value (0.0 to 1.0)</td></tr>
|
|
<tr><th>m</th>
|
|
<td class="description">Magenta value (0.0 to 1.0)</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Yellow value (0.0 to 1.0)</td></tr>
|
|
<tr><th>k</th>
|
|
<td class="description">Black value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorDeviceGray">pdfioContentSetFillColorDeviceGray</a></h3>
|
|
<p class="description">Set the device gray fill color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorDeviceGray(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> g);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Gray value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorDeviceRGB">pdfioContentSetFillColorDeviceRGB</a></h3>
|
|
<p class="description">Set the device RGB fill color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorDeviceRGB(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> r, <span class="reserved">double</span> g, <span class="reserved">double</span> b);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>r</th>
|
|
<td class="description">Red value (0.0 to 1.0)</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Green value (0.0 to 1.0)</td></tr>
|
|
<tr><th>b</th>
|
|
<td class="description">Blue value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorGray">pdfioContentSetFillColorGray</a></h3>
|
|
<p class="description">Set the calibrated gray fill color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorGray(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> g);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Gray value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorRGB">pdfioContentSetFillColorRGB</a></h3>
|
|
<p class="description">Set the calibrated RGB fill color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorRGB(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> r, <span class="reserved">double</span> g, <span class="reserved">double</span> b);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>r</th>
|
|
<td class="description">Red value (0.0 to 1.0)</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Green value (0.0 to 1.0)</td></tr>
|
|
<tr><th>b</th>
|
|
<td class="description">Blue value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFillColorSpace">pdfioContentSetFillColorSpace</a></h3>
|
|
<p class="description">Set the fill colorspace.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFillColorSpace(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Color space name</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetFlatness">pdfioContentSetFlatness</a></h3>
|
|
<p class="description">Set the flatness tolerance.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetFlatness(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> flatness);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>flatness</th>
|
|
<td class="description">Flatness value (0.0 to 100.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetLineCap">pdfioContentSetLineCap</a></h3>
|
|
<p class="description">Set the line ends style.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetLineCap(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <a href="#pdfio_linecap_t">pdfio_linecap_t</a> lc);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>lc</th>
|
|
<td class="description">Line cap value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetLineJoin">pdfioContentSetLineJoin</a></h3>
|
|
<p class="description">Set the line joining style.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetLineJoin(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <a href="#pdfio_linejoin_t">pdfio_linejoin_t</a> lj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>lj</th>
|
|
<td class="description">Line join value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetLineWidth">pdfioContentSetLineWidth</a></h3>
|
|
<p class="description">Set the line width.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetLineWidth(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> width);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>width</th>
|
|
<td class="description">Line width value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetMiterLimit">pdfioContentSetMiterLimit</a></h3>
|
|
<p class="description">Set the miter limit.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetMiterLimit(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> limit);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>limit</th>
|
|
<td class="description">Miter limit value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorDeviceCMYK">pdfioContentSetStrokeColorDeviceCMYK</a></h3>
|
|
<p class="description">Set the device CMYK stroke color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorDeviceCMYK(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> c, <span class="reserved">double</span> m, <span class="reserved">double</span> y, <span class="reserved">double</span> k);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>c</th>
|
|
<td class="description">Cyan value (0.0 to 1.0)</td></tr>
|
|
<tr><th>m</th>
|
|
<td class="description">Magenta value (0.0 to 1.0)</td></tr>
|
|
<tr><th>y</th>
|
|
<td class="description">Yellow value (0.0 to 1.0)</td></tr>
|
|
<tr><th>k</th>
|
|
<td class="description">Black value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorDeviceGray">pdfioContentSetStrokeColorDeviceGray</a></h3>
|
|
<p class="description">Set the device gray stroke color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorDeviceGray(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> g);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Gray value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorDeviceRGB">pdfioContentSetStrokeColorDeviceRGB</a></h3>
|
|
<p class="description">Set the device RGB stroke color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorDeviceRGB(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> r, <span class="reserved">double</span> g, <span class="reserved">double</span> b);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>r</th>
|
|
<td class="description">Red value (0.0 to 1.0)</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Green value (0.0 to 1.0)</td></tr>
|
|
<tr><th>b</th>
|
|
<td class="description">Blue value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorGray">pdfioContentSetStrokeColorGray</a></h3>
|
|
<p class="description">Set the calibrated gray stroke color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorGray(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> g);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Gray value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorRGB">pdfioContentSetStrokeColorRGB</a></h3>
|
|
<p class="description">Set the calibrated RGB stroke color.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorRGB(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> r, <span class="reserved">double</span> g, <span class="reserved">double</span> b);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>r</th>
|
|
<td class="description">Red value (0.0 to 1.0)</td></tr>
|
|
<tr><th>g</th>
|
|
<td class="description">Green value (0.0 to 1.0)</td></tr>
|
|
<tr><th>b</th>
|
|
<td class="description">Blue value (0.0 to 1.0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetStrokeColorSpace">pdfioContentSetStrokeColorSpace</a></h3>
|
|
<p class="description">Set the stroke color space.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetStrokeColorSpace(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Color space name</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextCharacterSpacing">pdfioContentSetTextCharacterSpacing</a></h3>
|
|
<p class="description">Set the spacing between characters.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextCharacterSpacing(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> spacing);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>spacing</th>
|
|
<td class="description">Character spacing</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextFont">pdfioContentSetTextFont</a></h3>
|
|
<p class="description">Set the text font and size.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextFont(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *name, <span class="reserved">double</span> size);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Font name</td></tr>
|
|
<tr><th>size</th>
|
|
<td class="description">Font size</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextLeading">pdfioContentSetTextLeading</a></h3>
|
|
<p class="description">Set text leading (line height) value.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextLeading(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> leading);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>leading</th>
|
|
<td class="description">Leading (line height) value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextMatrix">pdfioContentSetTextMatrix</a></h3>
|
|
<p class="description">Set the text transform matrix.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextMatrix(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, pdfio_matrix_t m);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>m</th>
|
|
<td class="description">Transform matrix</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextRenderingMode">pdfioContentSetTextRenderingMode</a></h3>
|
|
<p class="description">Set the text rendering mode.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextRenderingMode(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <a href="#pdfio_textrendering_t">pdfio_textrendering_t</a> mode);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>mode</th>
|
|
<td class="description">Text rendering mode</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextRise">pdfioContentSetTextRise</a></h3>
|
|
<p class="description">Set the text baseline offset.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextRise(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> rise);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>rise</th>
|
|
<td class="description">Y offset</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextWordSpacing">pdfioContentSetTextWordSpacing</a></h3>
|
|
<p class="description">Set the inter-word spacing.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextWordSpacing(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> spacing);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>spacing</th>
|
|
<td class="description">Spacing between words</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentSetTextXScaling">pdfioContentSetTextXScaling</a></h3>
|
|
<p class="description">Set the horizontal scaling value.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentSetTextXScaling(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> percent);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>percent</th>
|
|
<td class="description">Horizontal scaling in percent</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentStroke">pdfioContentStroke</a></h3>
|
|
<p class="description">Stroke the current path.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentStroke(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentTextBegin">pdfioContentTextBegin</a></h3>
|
|
<p class="description">Begin a text block.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextBegin(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentTextEnd">pdfioContentTextEnd</a></h3>
|
|
<p class="description">End a text block.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextEnd(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>font</th>
|
|
<td class="description">Font object created by <a href="#pdfioFileCreateFontObjFromFile"><code>pdfioFileCreateFontObjFromFile</code></a></td></tr>
|
|
<tr><th>s</th>
|
|
<td class="description">UTF-8 string</td></tr>
|
|
<tr><th>size</th>
|
|
<td class="description">Font size/height</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Width</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>
|
|
<h3 class="function"><a id="pdfioContentTextMoveLine">pdfioContentTextMoveLine</a></h3>
|
|
<p class="description">Move to the next line and offset.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextMoveLine(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> tx, <span class="reserved">double</span> ty);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>tx</th>
|
|
<td class="description">X offset</td></tr>
|
|
<tr><th>ty</th>
|
|
<td class="description">Y offset</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioContentTextMoveTo">pdfioContentTextMoveTo</a></h3>
|
|
<p class="description">Offset within the current line.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextMoveTo(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">double</span> tx, <span class="reserved">double</span> ty);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>tx</th>
|
|
<td class="description">X offset</td></tr>
|
|
<tr><th>ty</th>
|
|
<td class="description">Y offset</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>ws</th>
|
|
<td class="description">Word spacing or <code>0.0</code> for none</td></tr>
|
|
<tr><th>cs</th>
|
|
<td class="description">Character spacing or <code>0.0</code> for none</td></tr>
|
|
<tr><th>unicode</th>
|
|
<td class="description">Unicode text?</td></tr>
|
|
<tr><th>s</th>
|
|
<td class="description">String to show</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<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>
|
|
<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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>ws</th>
|
|
<td class="description">Word spacing or <code>0.0</code> for none</td></tr>
|
|
<tr><th>cs</th>
|
|
<td class="description">Character spacing or <code>0.0</code> for none</td></tr>
|
|
<tr><th>unicode</th>
|
|
<td class="description">Unicode text?</td></tr>
|
|
<tr><th>format</th>
|
|
<td class="description"><code>printf</code>-style format string</td></tr>
|
|
<tr><th>...</th>
|
|
<td class="description">Additional arguments as needed</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<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>
|
|
<h3 class="function"><a id="pdfioContentTextShow">pdfioContentTextShow</a></h3>
|
|
<p class="description">Show text.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextShow(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>unicode</th>
|
|
<td class="description">Unicode text?</td></tr>
|
|
<tr><th>s</th>
|
|
<td class="description">String to show</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function shows some text in a PDF content stream. The "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="pdfioContentTextShowJustified">pdfioContentTextShowJustified</a></h3>
|
|
<p class="description">Show justified text.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextShowJustified(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> unicode, size_t num_fragments, <span class="reserved">const</span> <span class="reserved">double</span> *offsets, <span class="reserved">const</span> <span class="reserved">char</span> *<span class="reserved">const</span> *fragments);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>unicode</th>
|
|
<td class="description">Unicode text?</td></tr>
|
|
<tr><th>num_fragments</th>
|
|
<td class="description">Number of text fragments</td></tr>
|
|
<tr><th>offsets</th>
|
|
<td class="description">Text offsets before fragments</td></tr>
|
|
<tr><th>fragments</th>
|
|
<td class="description">Text fragments</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function shows some text in a PDF content stream. The "unicode" argument
|
|
specifies that the current font maps to full Unicode. The "fragments"
|
|
argument specifies an array of UTF-8 encoded strings.</p>
|
|
<h3 class="function"><a id="pdfioContentTextShowf">pdfioContentTextShowf</a></h3>
|
|
<p class="description"></p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioContentTextShowf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">bool</span> unicode, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>unicode</th>
|
|
<td class="description">Unicode text?</td></tr>
|
|
<tr><th>format</th>
|
|
<td class="description"><code>printf</code>-style format string</td></tr>
|
|
<tr><th>...</th>
|
|
<td class="description">Additional arguments as needed</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Show formatted text.</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>
|
|
<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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> if cleared, <code>false</code> otherwise</p>
|
|
<h3 class="function"><a id="pdfioDictCopy">pdfioDictCopy</a></h3>
|
|
<p class="description">Copy a dictionary to a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioDictCopy(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>dict</th>
|
|
<td class="description">Original dictionary</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New dictionary</p>
|
|
<h3 class="function"><a id="pdfioDictCreate">pdfioDictCreate</a></h3>
|
|
<p class="description">Create a dictionary to hold key/value pairs.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioDictCreate(<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">New dictionary</p>
|
|
<h3 class="function"><a id="pdfioDictGetArray">pdfioDictGetArray</a></h3>
|
|
<p class="description">Get a key array value from a dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioDictGetArray(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetBinary">pdfioDictGetBinary</a></h3>
|
|
<p class="description">Get a key binary string value from a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">unsigned</span> <span class="reserved">char</span> *pdfioDictGetBinary(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, size_t *length);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>length</th>
|
|
<td class="description">Length of value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetBoolean">pdfioDictGetBoolean</a></h3>
|
|
<p class="description">Get a key boolean value from a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictGetBoolean(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetDate">pdfioDictGetDate</a></h3>
|
|
<p class="description">Get a date value from a dictionary.</p>
|
|
<p class="code">
|
|
time_t pdfioDictGetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetDict">pdfioDictGetDict</a></h3>
|
|
<p class="description">Get a key dictionary value from a dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioDictGetDict(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Pair index (<code>0</code>-based)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Key for specified pair</p>
|
|
<h3 class="function"><a id="pdfioDictGetName">pdfioDictGetName</a></h3>
|
|
<p class="description">Get a key name value from a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioDictGetName(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Number of pairs</p>
|
|
<h3 class="function"><a id="pdfioDictGetNumber">pdfioDictGetNumber</a></h3>
|
|
<p class="description">Get a key number value from a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">double</span> pdfioDictGetNumber(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetObj">pdfioDictGetObj</a></h3>
|
|
<p class="description">Get a key indirect object value from a dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioDictGetObj(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetRect">pdfioDictGetRect</a></h3>
|
|
<p class="description">Get a key rectangle value from a dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_rect_t">pdfio_rect_t</a> *pdfioDictGetRect(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <a href="#pdfio_rect_t">pdfio_rect_t</a> *rect);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>rect</th>
|
|
<td class="description">Rectangle</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Rectangle</p>
|
|
<h3 class="function"><a id="pdfioDictGetString">pdfioDictGetString</a></h3>
|
|
<p class="description">Get a key string value from a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioDictGetString(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value</p>
|
|
<h3 class="function"><a id="pdfioDictGetType">pdfioDictGetType</a></h3>
|
|
<p class="description">Get a key value type from a dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_valtype_t">pdfio_valtype_t</a> pdfioDictGetType(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Value type</p>
|
|
<h3 class="function"><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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>cb</th>
|
|
<td class="description">Callback function</td></tr>
|
|
<tr><th>cb_data</th>
|
|
<td class="description">Callback data</td></tr>
|
|
</tbody></table>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function iterates the keys in a dictionary, calling the supplied
|
|
function "cb":
|
|
|
|
<pre>
|
|
bool
|
|
my_dict_cb(pdfio_dict_t *dict, const char *key, void *cb_data)
|
|
{
|
|
... "key" contains the dictionary key ...
|
|
... return true to continue or false to stop ...
|
|
}
|
|
</pre>
|
|
|
|
The iteration continues as long as the callback returns <code>true</code> or all keys
|
|
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">
|
|
<span class="reserved">bool</span> pdfioDictSetArray(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <a href="#pdfio_array_t">pdfio_array_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetBinary">pdfioDictSetBinary</a></h3>
|
|
<p class="description">Set a key binary string in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetBinary(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">const</span> <span class="reserved">unsigned</span> <span class="reserved">char</span> *value, size_t valuelen);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
<tr><th>valuelen</th>
|
|
<td class="description">Length of value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetBoolean">pdfioDictSetBoolean</a></h3>
|
|
<p class="description">Set a key boolean in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetBoolean(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">bool</span> value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetDate">pdfioDictSetDate</a></h3>
|
|
<p class="description">Set a date value in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetDate(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, time_t value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetDict">pdfioDictSetDict</a></h3>
|
|
<p class="description">Set a key dictionary in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetDict(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <a href="#pdfio_dict_t">pdfio_dict_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetName">pdfioDictSetName</a></h3>
|
|
<p class="description">Set a key name in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetName(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetNull">pdfioDictSetNull</a></h3>
|
|
<p class="description">Set a key null in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetNull(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetNumber">pdfioDictSetNumber</a></h3>
|
|
<p class="description">Set a key number in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetNumber(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">double</span> value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetObj">pdfioDictSetObj</a></h3>
|
|
<p class="description">Set a key indirect object reference in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetObj(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <a href="#pdfio_obj_t">pdfio_obj_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetRect">pdfioDictSetRect</a></h3>
|
|
<p class="description">Set a key rectangle in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetRect(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <a href="#pdfio_rect_t">pdfio_rect_t</a> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetString">pdfioDictSetString</a></h3>
|
|
<p class="description">Set a key literal string in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetString(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">const</span> <span class="reserved">char</span> *value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioDictSetStringf">pdfioDictSetStringf</a></h3>
|
|
<p class="description">Set a key formatted string in a dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioDictSetStringf(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *key, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Dictionary</td></tr>
|
|
<tr><th>key</th>
|
|
<td class="description">Key</td></tr>
|
|
<tr><th>format</th>
|
|
<td class="description"><code>printf</code>-style format string</td></tr>
|
|
<tr><th>...</th>
|
|
<td class="description">Additional arguments as needed</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioFileClose">pdfioFileClose</a></h3>
|
|
<p class="description">Close a PDF file and free all memory used for it.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioFileClose(<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"><code>true</code> on success and <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioFileCreate">pdfioFileCreate</a></h3>
|
|
<p class="description">Create a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_file_t">pdfio_file_t</a> *pdfioFileCreate(<span class="reserved">const</span> <span class="reserved">char</span> *filename, <span class="reserved">const</span> <span class="reserved">char</span> *version, <a href="#pdfio_rect_t">pdfio_rect_t</a> *media_box, <a href="#pdfio_rect_t">pdfio_rect_t</a> *crop_box, <a href="#pdfio_error_cb_t">pdfio_error_cb_t</a> error_cb, <span class="reserved">void</span> *error_cbdata);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>filename</th>
|
|
<td class="description">Filename</td></tr>
|
|
<tr><th>version</th>
|
|
<td class="description">PDF version number or <code>NULL</code> for default (2.0)</td></tr>
|
|
<tr><th>media_box</th>
|
|
<td class="description">Default MediaBox for pages</td></tr>
|
|
<tr><th>crop_box</th>
|
|
<td class="description">Default CropBox for pages</td></tr>
|
|
<tr><th>error_cb</th>
|
|
<td class="description">Error callback or <code>NULL</code> for default</td></tr>
|
|
<tr><th>error_cbdata</th>
|
|
<td class="description">Error callback data, if any</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">PDF file or <code>NULL</code> on error</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new PDF file. The "filename" argument specifies the
|
|
name of the PDF file to create.<br>
|
|
<br>
|
|
The "version" argument specifies the PDF version number for the file or
|
|
<code>NULL</code> for the default ("2.0").<br>
|
|
<br>
|
|
The "media_box" and "crop_box" arguments specify the default MediaBox and
|
|
CropBox for pages in the PDF file - if <code>NULL</code> then a default "Universal" size
|
|
of 8.27x11in (the intersection of US Letter and ISO A4) is used.<br>
|
|
<br>
|
|
The "error_cb" and "error_cbdata" arguments specify an error handler callback
|
|
and its data pointer - if <code>NULL</code> the default error handler is used that
|
|
writes error messages to <code>stderr</code>.</p>
|
|
<h3 class="function"><a id="pdfioFileCreateArrayObj">pdfioFileCreateArrayObj</a></h3>
|
|
<p class="description">Create a new object in a PDF file containing an array.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateArrayObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_array_t">pdfio_array_t</a> *array);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>array</th>
|
|
<td class="description">Object array</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new object with an array value in a PDF file.
|
|
You must call <a href="#pdfioObjClose"><code>pdfioObjClose</code></a> to write the object to the file.</p>
|
|
<h3 class="function"><a id="pdfioFileCreateFontObjFromBase">pdfioFileCreateFontObjFromBase</a></h3>
|
|
<p class="description">Create one of the base 14 PDF fonts.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateFontObjFromBase(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *name);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Font name</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 creates one of the base 14 PDF fonts. The "name" parameter
|
|
specifies the font nane:
|
|
|
|
</p><ul>
|
|
<li>"Courier"
|
|
</li>
|
|
<li>"Courier-Bold"
|
|
</li>
|
|
<li>"Courier-BoldItalic"
|
|
</li>
|
|
<li>"Courier-Italic"
|
|
</li>
|
|
<li>"Helvetica"
|
|
</li>
|
|
<li>"Helvetica-Bold"
|
|
</li>
|
|
<li>"Helvetica-BoldOblique"
|
|
</li>
|
|
<li>"Helvetica-Oblique"
|
|
</li>
|
|
<li>"Symbol"
|
|
</li>
|
|
<li>"Times-Bold"
|
|
</li>
|
|
<li>"Times-BoldItalic"
|
|
</li>
|
|
<li>"Times-Italic"
|
|
</li>
|
|
<li>"Times-Roman"
|
|
</li>
|
|
<li>"ZapfDingbats"</li>
|
|
</ul>
|
|
<p class="discussion">Base fonts always use the Windows CP1252 (ISO-8859-1 with additional
|
|
characters such as the Euro symbol) subset of Unicode.</p>
|
|
<h3 class="function"><a id="pdfioFileCreateFontObjFromFile">pdfioFileCreateFontObjFromFile</a></h3>
|
|
<p class="description">Add a font object to a PDF file.</p>
|
|
<p class="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>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>filename</th>
|
|
<td class="description">Filename</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 a TrueType/OpenType font into a PDF file. The
|
|
"unicode" parameter controls whether the font is encoded for two-byte
|
|
characters (potentially full Unicode, but more typically a subset)
|
|
or to only support the Windows CP1252 (ISO-8859-1 with additional
|
|
characters such as the Euro symbol) subset of Unicode.</p>
|
|
<h3 class="function"><a id="pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></h3>
|
|
<p class="description">Add an ICC profile object to a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateICCObjFromFile(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *filename, size_t num_colors);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>filename</th>
|
|
<td class="description">Filename</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of color components (1, 3, or 4)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object</p>
|
|
<h3 class="function"><a id="pdfioFileCreateImageObjFromData">pdfioFileCreateImageObjFromData</a></h3>
|
|
<p class="description">Add image object(s) to a PDF file from memory.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateImageObjFromData(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">unsigned</span> <span class="reserved">char</span> *data, size_t width, size_t height, size_t num_colors, <a href="#pdfio_array_t">pdfio_array_t</a> *color_data, <span class="reserved">bool</span> alpha, <span class="reserved">bool</span> interpolate);</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">Pointer to image data</td></tr>
|
|
<tr><th>width</th>
|
|
<td class="description">Width of image</td></tr>
|
|
<tr><th>height</th>
|
|
<td class="description">Height of image</td></tr>
|
|
<tr><th>num_colors</th>
|
|
<td class="description">Number of colors</td></tr>
|
|
<tr><th>color_data</th>
|
|
<td class="description">Colorspace data or <code>NULL</code> for default</td></tr>
|
|
<tr><th>alpha</th>
|
|
<td class="description"><code>true</code> if data contains an alpha channel</td></tr>
|
|
<tr><th>interpolate</th>
|
|
<td class="description">Interpolate image data?</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates image object(s) in a PDF file from a data buffer in
|
|
memory. The "data" parameter points to the image data as 8-bit color values.
|
|
The "width" and "height" parameters specify the image dimensions. The
|
|
"num_colors" parameter specifies the number of color components (<code>1</code> for
|
|
grayscale, <code>3</code> for RGB, and <code>4</code> for CMYK) and the "alpha" parameter specifies
|
|
whether each color tuple is followed by an alpha value. The "color_data"
|
|
parameter specifies an optional color space array for the image - if <code>NULL</code>,
|
|
the image is encoded in the corresponding device color space. The
|
|
"interpolate" parameter specifies whether to interpolate when scaling the
|
|
image on the page.<br>
|
|
<br>
|
|
Note: When creating an image object with alpha, a second image object is
|
|
created to hold the "soft mask" data for the primary image.</p>
|
|
<h3 class="function"><a id="pdfioFileCreateImageObjFromFile">pdfioFileCreateImageObjFromFile</a></h3>
|
|
<p class="description">Add an image object to a PDF file from a file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateImageObjFromFile(<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> interpolate);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>filename</th>
|
|
<td class="description">Filename</td></tr>
|
|
<tr><th>interpolate</th>
|
|
<td class="description">Interpolate image data?</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates an image object in a PDF file from a JPEG or PNG file.
|
|
The "filename" parameter specifies the name of the JPEG or PNG file, while
|
|
the "interpolate" parameter specifies whether to interpolate when scaling the
|
|
image on the page.<br>
|
|
<br>
|
|
</p><blockquote>
|
|
Note: Currently PNG support is limited to grayscale, RGB, or indexed files
|
|
without interlacing or alpha. Transparency (masking) based on color/index
|
|
is supported.</blockquote>
|
|
<h3 class="function"><a id="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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Name value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new object with 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>
|
|
<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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>number</th>
|
|
<td class="description">Number value</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new object with 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>
|
|
<h3 class="function"><a id="pdfioFileCreateObj">pdfioFileCreateObj</a></h3>
|
|
<p class="description">Create a new object in a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileCreateObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>dict</th>
|
|
<td class="description">Object dictionary</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object</p>
|
|
<h3 class="function"><a id="pdfioFileCreateOutput">pdfioFileCreateOutput</a></h3>
|
|
<p class="description">Create a PDF file through an output callback.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_file_t">pdfio_file_t</a> *pdfioFileCreateOutput(<a href="#pdfio_output_cb_t">pdfio_output_cb_t</a> output_cb, <span class="reserved">void</span> *output_cbdata, <span class="reserved">const</span> <span class="reserved">char</span> *version, <a href="#pdfio_rect_t">pdfio_rect_t</a> *media_box, <a href="#pdfio_rect_t">pdfio_rect_t</a> *crop_box, <a href="#pdfio_error_cb_t">pdfio_error_cb_t</a> error_cb, <span class="reserved">void</span> *error_cbdata);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>output_cb</th>
|
|
<td class="description">Output callback function</td></tr>
|
|
<tr><th>output_cbdata</th>
|
|
<td class="description">Output callback data</td></tr>
|
|
<tr><th>version</th>
|
|
<td class="description">PDF version number or <code>NULL</code> for default (2.0)</td></tr>
|
|
<tr><th>media_box</th>
|
|
<td class="description">Default MediaBox for pages</td></tr>
|
|
<tr><th>crop_box</th>
|
|
<td class="description">Default CropBox for pages</td></tr>
|
|
<tr><th>error_cb</th>
|
|
<td class="description">Error callback or <code>NULL</code> for default</td></tr>
|
|
<tr><th>error_cbdata</th>
|
|
<td class="description">Error callback data, if any</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">PDF file or <code>NULL</code> on error</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new PDF file that is streamed though an output
|
|
callback. The "output_cb" and "output_cbdata" arguments specify the output
|
|
callback and its data pointer which is called whenever data needs to be
|
|
written:
|
|
|
|
<pre>
|
|
ssize_t
|
|
output_cb(void *output_cbdata, const void *buffer, size_t bytes)
|
|
{
|
|
// Write buffer to output and return the number of bytes written
|
|
}
|
|
</pre>
|
|
|
|
The "version" argument specifies the PDF version number for the file or
|
|
<code>NULL</code> for the default ("2.0").<br>
|
|
<br>
|
|
The "media_box" and "crop_box" arguments specify the default MediaBox and
|
|
CropBox for pages in the PDF file - if <code>NULL</code> then a default "Universal" size
|
|
of 8.27x11in (the intersection of US Letter and ISO A4) is used.<br>
|
|
<br>
|
|
The "error_cb" and "error_cbdata" arguments specify an error handler callback
|
|
and its data pointer - if <code>NULL</code> the default error handler is used that
|
|
writes error messages to <code>stderr</code>.<br>
|
|
<br>
|
|
</p><blockquote>
|
|
<em>Note</em>: Files created using this API are slightly larger than those
|
|
created using the <a href="#pdfioFileCreate"><code>pdfioFileCreate</code></a> function since stream lengths are
|
|
stored as indirect object references.</blockquote>
|
|
<h3 class="function"><a id="pdfioFileCreatePage">pdfioFileCreatePage</a></h3>
|
|
<p class="description">Create a page in a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_stream_t">pdfio_stream_t</a> *pdfioFileCreatePage(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_dict_t">pdfio_dict_t</a> *dict);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>dict</th>
|
|
<td class="description">Page dictionary</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Contents stream</p>
|
|
<h3 class="function"><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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>string</th>
|
|
<td class="description">String</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a new object with 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>
|
|
<h3 class="function"><a id="pdfioFileCreateTemporary">pdfioFileCreateTemporary</a></h3>
|
|
<p class="description"></p>
|
|
<p class="code">
|
|
<a href="#pdfio_file_t">pdfio_file_t</a> *pdfioFileCreateTemporary(<span class="reserved">char</span> *buffer, size_t bufsize, <span class="reserved">const</span> <span class="reserved">char</span> *version, <a href="#pdfio_rect_t">pdfio_rect_t</a> *media_box, <a href="#pdfio_rect_t">pdfio_rect_t</a> *crop_box, <a href="#pdfio_error_cb_t">pdfio_error_cb_t</a> error_cb, <span class="reserved">void</span> *error_cbdata);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>buffer</th>
|
|
<td class="description">Filename buffer</td></tr>
|
|
<tr><th>bufsize</th>
|
|
<td class="description">Size of filename buffer</td></tr>
|
|
<tr><th>version</th>
|
|
<td class="description">PDF version number or <code>NULL</code> for default (2.0)</td></tr>
|
|
<tr><th>media_box</th>
|
|
<td class="description">Default MediaBox for pages</td></tr>
|
|
<tr><th>crop_box</th>
|
|
<td class="description">Default CropBox for pages</td></tr>
|
|
<tr><th>error_cb</th>
|
|
<td class="description">Error callback or <code>NULL</code> for default</td></tr>
|
|
<tr><th>error_cbdata</th>
|
|
<td class="description">Error callback data, if any</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Create a temporary PDF file.</p>
|
|
<p class="discussion">This function creates a PDF file with a unique filename in the current
|
|
temporary directory. The temporary file is stored in the string "buffer" an
|
|
will have a ".pdf" extension. Otherwise, this function works the same as
|
|
the <a href="#pdfioFileCreate"><code>pdfioFileCreate</code></a> function.
|
|
|
|
</p>
|
|
<h3 class="function"><a id="pdfioFileFindObj">pdfioFileFindObj</a></h3>
|
|
<p class="description">Find an object using its object number.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileFindObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t number);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>number</th>
|
|
<td class="description">Object number (1 to N)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object or <code>NULL</code> if not found</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This differs from <a href="#pdfioFileGetObj"><code>pdfioFileGetObj</code></a> which takes an index into the
|
|
list of objects while this function takes the object number.</p>
|
|
<h3 class="function"><a id="pdfioFileGetAuthor">pdfioFileGetAuthor</a></h3>
|
|
<p class="description">Get the author for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetAuthor(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Author or <code>NULL</code> for none</p>
|
|
<h3 class="function"><span class="info"> PDFio 1.3 </span><a id="pdfioFileGetCatalog">pdfioFileGetCatalog</a></h3>
|
|
<p class="description">Get the document catalog dictionary.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioFileGetCatalog(<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">Catalog dictionary</p>
|
|
<h3 class="function"><a id="pdfioFileGetCreationDate">pdfioFileGetCreationDate</a></h3>
|
|
<p class="description">Get the creation date for a PDF file.</p>
|
|
<p class="code">
|
|
time_t pdfioFileGetCreationDate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Creation date or <code>0</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetCreator">pdfioFileGetCreator</a></h3>
|
|
<p class="description">Get the creator string for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetCreator(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Creator string or <code>NULL</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetID">pdfioFileGetID</a></h3>
|
|
<p class="description">Get the PDF file's ID strings.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioFileGetID(<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">Array with binary strings</p>
|
|
<h3 class="function"><a id="pdfioFileGetKeywords">pdfioFileGetKeywords</a></h3>
|
|
<p class="description">Get the keywords for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetKeywords(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Keywords string or <code>NULL</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetName">pdfioFileGetName</a></h3>
|
|
<p class="description">Get a PDF's filename.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetName(<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">Filename</p>
|
|
<h3 class="function"><a id="pdfioFileGetNumObjs">pdfioFileGetNumObjs</a></h3>
|
|
<p class="description">Get the number of objects in a PDF file.</p>
|
|
<p class="code">
|
|
size_t pdfioFileGetNumObjs(<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">Number of objects</p>
|
|
<h3 class="function"><a id="pdfioFileGetNumPages">pdfioFileGetNumPages</a></h3>
|
|
<p class="description">Get the number of pages in a PDF file.</p>
|
|
<p class="code">
|
|
size_t pdfioFileGetNumPages(<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">Number of pages</p>
|
|
<h3 class="function"><a id="pdfioFileGetObj">pdfioFileGetObj</a></h3>
|
|
<p class="description">Get an object from a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileGetObj(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Object index (starting at 0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object</p>
|
|
<h3 class="function"><a id="pdfioFileGetPage">pdfioFileGetPage</a></h3>
|
|
<p class="description">Get a page object from a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioFileGetPage(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, size_t n);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Page index (starting at 0)</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object</p>
|
|
<h3 class="function"><a id="pdfioFileGetPermissions">pdfioFileGetPermissions</a></h3>
|
|
<p class="description">Get the access permissions of a PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_permission_t">pdfio_permission_t</a> pdfioFileGetPermissions(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_encryption_t">pdfio_encryption_t</a> *encryption);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>encryption</th>
|
|
<td class="description">Type of encryption used or <code>NULL</code> to ignore</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Permission bits</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function returns the access permissions of a PDF file and (optionally)
|
|
the type of encryption that has been used.</p>
|
|
<h3 class="function"><a id="pdfioFileGetProducer">pdfioFileGetProducer</a></h3>
|
|
<p class="description">Get the producer string for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetProducer(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Producer string or <code>NULL</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetSubject">pdfioFileGetSubject</a></h3>
|
|
<p class="description">Get the subject for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetSubject(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Subject or <code>NULL</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetTitle">pdfioFileGetTitle</a></h3>
|
|
<p class="description">Get the title for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetTitle(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Title or <code>NULL</code> for none</p>
|
|
<h3 class="function"><a id="pdfioFileGetVersion">pdfioFileGetVersion</a></h3>
|
|
<p class="description">Get the PDF version number for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioFileGetVersion(<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">Version number or <code>NULL</code></p>
|
|
<h3 class="function"><a id="pdfioFileOpen">pdfioFileOpen</a></h3>
|
|
<p class="description">Open a PDF file for reading.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_file_t">pdfio_file_t</a> *pdfioFileOpen(<span class="reserved">const</span> <span class="reserved">char</span> *filename, <a href="#pdfio_password_cb_t">pdfio_password_cb_t</a> password_cb, <span class="reserved">void</span> *password_cbdata, <a href="#pdfio_error_cb_t">pdfio_error_cb_t</a> error_cb, <span class="reserved">void</span> *error_cbdata);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>filename</th>
|
|
<td class="description">Filename</td></tr>
|
|
<tr><th>password_cb</th>
|
|
<td class="description">Password callback or <code>NULL</code> for none</td></tr>
|
|
<tr><th>password_cbdata</th>
|
|
<td class="description">Password callback data, if any</td></tr>
|
|
<tr><th>error_cb</th>
|
|
<td class="description">Error callback or <code>NULL</code> for default</td></tr>
|
|
<tr><th>error_cbdata</th>
|
|
<td class="description">Error callback data, if any</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">PDF file</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function opens an existing PDF file. The "filename" argument specifies
|
|
the name of the PDF file to create.<br>
|
|
<br>
|
|
The "password_cb" and "password_cbdata" arguments specify a password callback
|
|
and its data pointer for PDF files that use one of the standard Adobe
|
|
"security" handlers. The callback returns a password string or <code>NULL</code> to
|
|
cancel the open. If <code>NULL</code> is specified for the callback function and the
|
|
PDF file requires a password, the open will always fail.<br>
|
|
<br>
|
|
The "error_cb" and "error_cbdata" arguments specify an error handler callback
|
|
and its data pointer - if <code>NULL</code> the default error handler is used that
|
|
writes error messages to <code>stderr</code>.</p>
|
|
<h3 class="function"><a id="pdfioFileSetAuthor">pdfioFileSetAuthor</a></h3>
|
|
<p class="description">Set the author for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetAuthor(<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>
|
|
<h3 class="function"><a id="pdfioFileSetCreationDate">pdfioFileSetCreationDate</a></h3>
|
|
<p class="description">Set the creation date for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetCreationDate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, time_t value);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>value</th>
|
|
<td class="description">Value</td></tr>
|
|
</tbody></table>
|
|
<h3 class="function"><a id="pdfioFileSetCreator">pdfioFileSetCreator</a></h3>
|
|
<p class="description">Set the creator string for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetCreator(<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>
|
|
<h3 class="function"><a id="pdfioFileSetKeywords">pdfioFileSetKeywords</a></h3>
|
|
<p class="description">Set the keywords string for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetKeywords(<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>
|
|
<h3 class="function"><a id="pdfioFileSetPermissions">pdfioFileSetPermissions</a></h3>
|
|
<p class="description">Set the PDF permissions, encryption mode, and passwords.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioFileSetPermissions(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_permission_t">pdfio_permission_t</a> permissions, <a href="#pdfio_encryption_t">pdfio_encryption_t</a> encryption, <span class="reserved">const</span> <span class="reserved">char</span> *owner_password, <span class="reserved">const</span> <span class="reserved">char</span> *user_password);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>permissions</th>
|
|
<td class="description">Use permissions</td></tr>
|
|
<tr><th>encryption</th>
|
|
<td class="description">Type of encryption to use</td></tr>
|
|
<tr><th>owner_password</th>
|
|
<td class="description">Owner password, if any</td></tr>
|
|
<tr><th>user_password</th>
|
|
<td class="description">User password, if any</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> otherwise</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function sets the PDF usage permissions, encryption mode, and
|
|
passwords.<br>
|
|
<br>
|
|
</p><blockquote>
|
|
<em>Note</em>: This function must be called before creating or copying any
|
|
objects. Due to fundamental limitations in the PDF format, PDF encryption
|
|
offers little protection from disclosure. Permissions are not enforced in
|
|
any meaningful way.</blockquote>
|
|
<h3 class="function"><a id="pdfioFileSetSubject">pdfioFileSetSubject</a></h3>
|
|
<p class="description">Set the subject for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetSubject(<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>
|
|
<h3 class="function"><a id="pdfioFileSetTitle">pdfioFileSetTitle</a></h3>
|
|
<p class="description">Set the title for a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">void</span> pdfioFileSetTitle(<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>
|
|
<h3 class="function"><a id="pdfioImageGetBytesPerLine">pdfioImageGetBytesPerLine</a></h3>
|
|
<p class="description">Get the number of bytes to read for each line.</p>
|
|
<p class="code">
|
|
size_t pdfioImageGetBytesPerLine(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Image object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Number of bytes per line</p>
|
|
<h3 class="function"><a id="pdfioImageGetHeight">pdfioImageGetHeight</a></h3>
|
|
<p class="description">Get the height of an image object.</p>
|
|
<p class="code">
|
|
<span class="reserved">double</span> pdfioImageGetHeight(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Image object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Height in lines</p>
|
|
<h3 class="function"><a id="pdfioImageGetWidth">pdfioImageGetWidth</a></h3>
|
|
<p class="description">Get the width of an image object.</p>
|
|
<p class="code">
|
|
<span class="reserved">double</span> pdfioImageGetWidth(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Image object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Width in columns</p>
|
|
<h3 class="function"><a id="pdfioObjClose">pdfioObjClose</a></h3>
|
|
<p class="description">Close an object, writing any data as needed to the PDF
|
|
file.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioObjClose(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioObjCopy">pdfioObjCopy</a></h3>
|
|
<p class="description">Copy an object to another PDF file.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_obj_t">pdfio_obj_t</a> *pdfioObjCopy(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_obj_t">pdfio_obj_t</a> *srcobj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>srcobj</th>
|
|
<td class="description">Object to copy</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">New object or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioObjCreateStream">pdfioObjCreateStream</a></h3>
|
|
<p class="description">Create an object (data) stream for writing.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_stream_t">pdfio_stream_t</a> *pdfioObjCreateStream(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj, <a href="#pdfio_filter_t">pdfio_filter_t</a> filter);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
<tr><th>filter</th>
|
|
<td class="description">Type of compression to apply</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Stream or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioObjGetArray">pdfioObjGetArray</a></h3>
|
|
<p class="description">Get the array associated with an object.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_array_t">pdfio_array_t</a> *pdfioObjGetArray(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Array or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioObjGetDict">pdfioObjGetDict</a></h3>
|
|
<p class="description">Get the dictionary associated with an object.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_dict_t">pdfio_dict_t</a> *pdfioObjGetDict(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Dictionary or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioObjGetGeneration">pdfioObjGetGeneration</a></h3>
|
|
<p class="description">Get the object's generation number.</p>
|
|
<p class="code">
|
|
<span class="reserved">unsigned</span> <span class="reserved">short</span> pdfioObjGetGeneration(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Generation number (0 to 65535)</p>
|
|
<h3 class="function"><a id="pdfioObjGetLength">pdfioObjGetLength</a></h3>
|
|
<p class="description">Get the length of the object's (data) stream.</p>
|
|
<p class="code">
|
|
size_t pdfioObjGetLength(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</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>
|
|
<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>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Dictionary or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioObjGetNumber">pdfioObjGetNumber</a></h3>
|
|
<p class="description">Get the object's number.</p>
|
|
<p class="code">
|
|
size_t pdfioObjGetNumber(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object number (1 to 9999999999)</p>
|
|
<h3 class="function"><a id="pdfioObjGetSubtype">pdfioObjGetSubtype</a></h3>
|
|
<p class="description">Get an object's subtype.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioObjGetSubtype(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object subtype name or <code>NULL</code> for none</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function returns an object's PDF subtype name, if any. Common subtype
|
|
names include:
|
|
|
|
</p><ul>
|
|
<li>"CIDFontType0": A CID Type0 font
|
|
</li>
|
|
<li>"CIDFontType2": A CID TrueType font
|
|
</li>
|
|
<li>"Image": An image or image mask
|
|
</li>
|
|
<li>"Form": A fillable form
|
|
</li>
|
|
<li>"OpenType": An OpenType font
|
|
</li>
|
|
<li>"Type0": A composite font
|
|
</li>
|
|
<li>"Type1": A PostScript Type1 font
|
|
</li>
|
|
<li>"Type3": A PDF Type3 font
|
|
</li>
|
|
<li>"TrueType": A TrueType font</li>
|
|
</ul>
|
|
<h3 class="function"><a id="pdfioObjGetType">pdfioObjGetType</a></h3>
|
|
<p class="description">Get an object's type.</p>
|
|
<p class="code">
|
|
<span class="reserved">const</span> <span class="reserved">char</span> *pdfioObjGetType(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Object type name or <code>NULL</code> for none</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function returns an object's PDF type name, if any. Common type names
|
|
include:
|
|
|
|
</p><ul>
|
|
<li>"CMap": A character map for composite fonts
|
|
</li>
|
|
<li>"Font": An embedded font (<a href="#pdfioObjGetSubtype"><code>pdfioObjGetSubtype</code></a> will tell you the
|
|
font format)
|
|
</li>
|
|
<li>"FontDescriptor": A font descriptor
|
|
</li>
|
|
<li>"Page": A (visible) page
|
|
</li>
|
|
<li>"Pages": A page tree node
|
|
</li>
|
|
<li>"Template": An invisible template page
|
|
</li>
|
|
<li>"XObject": An image, image mask, or form (<a href="#pdfioObjGetSubtype"><code>pdfioObjGetSubtype</code></a> will
|
|
tell you which)</li>
|
|
</ul>
|
|
<h3 class="function"><a id="pdfioObjOpenStream">pdfioObjOpenStream</a></h3>
|
|
<p class="description">Open an object's (data) stream for reading.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_stream_t">pdfio_stream_t</a> *pdfioObjOpenStream(<a href="#pdfio_obj_t">pdfio_obj_t</a> *obj, <span class="reserved">bool</span> decode);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>obj</th>
|
|
<td class="description">Object</td></tr>
|
|
<tr><th>decode</th>
|
|
<td class="description">Decode/decompress data?</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Stream or <code>NULL</code> on error</p>
|
|
<h3 class="function"><a id="pdfioPageCopy">pdfioPageCopy</a></h3>
|
|
<p class="description">Copy a page to a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioPageCopy(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <a href="#pdfio_obj_t">pdfio_obj_t</a> *srcpage);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>srcpage</th>
|
|
<td class="description">Source page</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioPageDictAddColorSpace">pdfioPageDictAddColorSpace</a></h3>
|
|
<p class="description">Add a color space to the page dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioPageDictAddColorSpace(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *name, <a href="#pdfio_array_t">pdfio_array_t</a> *data);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Page dictionary</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Color space name</td></tr>
|
|
<tr><th>data</th>
|
|
<td class="description">Color space array</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function adds a named color space to the page dictionary.<br>
|
|
<br>
|
|
The names "DefaultCMYK", "DefaultGray", and "DefaultRGB" specify the default
|
|
device color space used for the page.<br>
|
|
<br>
|
|
The "data" array contains a calibrated, indexed, or ICC-based color space
|
|
array that was created using the
|
|
<a href="#pdfioArrayCreateCalibratedColorFromMatrix"><code>pdfioArrayCreateCalibratedColorFromMatrix</code></a>,
|
|
<a href="#pdfioArrayCreateCalibratedColorFromPrimaries"><code>pdfioArrayCreateCalibratedColorFromPrimaries</code></a>,
|
|
<a href="#pdfioArrayCreateICCBasedColor"><code>pdfioArrayCreateICCBasedColor</code></a>, or
|
|
<a href="#pdfioArrayCreateIndexedColor"><code>pdfioArrayCreateIndexedColor</code></a> functions.</p>
|
|
<h3 class="function"><a id="pdfioPageDictAddFont">pdfioPageDictAddFont</a></h3>
|
|
<p class="description">Add a font object to the page dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioPageDictAddFont(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *name, <a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Page dictionary</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Font name; must not contain spaces</td></tr>
|
|
<tr><th>obj</th>
|
|
<td class="description">Font object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioPageDictAddImage">pdfioPageDictAddImage</a></h3>
|
|
<p class="description">Add an image object to the page dictionary.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioPageDictAddImage(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, <span class="reserved">const</span> <span class="reserved">char</span> *name, <a href="#pdfio_obj_t">pdfio_obj_t</a> *obj);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>dict</th>
|
|
<td class="description">Page dictionary</td></tr>
|
|
<tr><th>name</th>
|
|
<td class="description">Image name</td></tr>
|
|
<tr><th>obj</th>
|
|
<td class="description">Image object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioPageGetNumStreams">pdfioPageGetNumStreams</a></h3>
|
|
<p class="description">Get the number of content streams for a page object.</p>
|
|
<p class="code">
|
|
size_t pdfioPageGetNumStreams(<a href="#pdfio_obj_t">pdfio_obj_t</a> *page);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>page</th>
|
|
<td class="description">Page object</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Number of streams</p>
|
|
<h3 class="function"><a id="pdfioPageOpenStream">pdfioPageOpenStream</a></h3>
|
|
<p class="description">Open a content stream for a page.</p>
|
|
<p class="code">
|
|
<a href="#pdfio_stream_t">pdfio_stream_t</a> *pdfioPageOpenStream(<a href="#pdfio_obj_t">pdfio_obj_t</a> *page, size_t n, <span class="reserved">bool</span> decode);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>page</th>
|
|
<td class="description">Page object</td></tr>
|
|
<tr><th>n</th>
|
|
<td class="description">Stream index (0-based)</td></tr>
|
|
<tr><th>decode</th>
|
|
<td class="description"><code>true</code> to decode/decompress stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Stream</p>
|
|
<h3 class="function"><a id="pdfioStreamClose">pdfioStreamClose</a></h3>
|
|
<p class="description">Close a (data) stream in a PDF file.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamClose(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioStreamConsume">pdfioStreamConsume</a></h3>
|
|
<p class="description">Consume bytes from the stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamConsume(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, size_t bytes);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>bytes</th>
|
|
<td class="description">Number of bytes to consume</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on EOF</p>
|
|
<h3 class="function"><a id="pdfioStreamGetToken">pdfioStreamGetToken</a></h3>
|
|
<p class="description">Read a single PDF token from a stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamGetToken(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">char</span> *buffer, size_t bufsize);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>buffer</th>
|
|
<td class="description">String buffer</td></tr>
|
|
<tr><th>bufsize</th>
|
|
<td class="description">Size of string buffer</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on EOF</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function reads a single PDF token from a stream. Operator tokens,
|
|
boolean values, and numbers are returned as-is in the provided string buffer.
|
|
String values start with the opening parenthesis ('(') but have all escaping
|
|
resolved and the terminating parenthesis removed. Hexadecimal string values
|
|
start with the opening angle bracket ('<') and have all whitespace and the
|
|
terminating angle bracket removed.</p>
|
|
<h3 class="function"><a id="pdfioStreamPeek">pdfioStreamPeek</a></h3>
|
|
<p class="description">Peek at data in a stream.</p>
|
|
<p class="code">
|
|
ssize_t pdfioStreamPeek(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">void</span> *buffer, size_t bytes);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>buffer</th>
|
|
<td class="description">Buffer</td></tr>
|
|
<tr><th>bytes</th>
|
|
<td class="description">Size of buffer</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Bytes returned or <code>-1</code> on error</p>
|
|
<h3 class="function"><a id="pdfioStreamPrintf">pdfioStreamPrintf</a></h3>
|
|
<p class="description">Write a formatted string to a stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamPrintf(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>format</th>
|
|
<td class="description"><code>printf</code>-style format string</td></tr>
|
|
<tr><th>...</th>
|
|
<td class="description">Additional arguments as needed</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioStreamPutChar">pdfioStreamPutChar</a></h3>
|
|
<p class="description">Write a single character to a stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamPutChar(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">int</span> ch);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>ch</th>
|
|
<td class="description">Character</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioStreamPuts">pdfioStreamPuts</a></h3>
|
|
<p class="description">Write a literal string to a stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamPuts(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>s</th>
|
|
<td class="description">Literal string</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success, <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioStreamRead">pdfioStreamRead</a></h3>
|
|
<p class="description">Read data from a stream.</p>
|
|
<p class="code">
|
|
ssize_t pdfioStreamRead(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">void</span> *buffer, size_t bytes);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>buffer</th>
|
|
<td class="description">Buffer</td></tr>
|
|
<tr><th>bytes</th>
|
|
<td class="description">Bytes to read</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Number of bytes read or <code>-1</code> on error</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function reads data from a stream. When reading decoded image data
|
|
from a stream, you <em>must</em> read whole scanlines. The
|
|
<a href="#pdfioImageGetBytesPerLine"><code>pdfioImageGetBytesPerLine</code></a> function can be used to determine the
|
|
proper read length.</p>
|
|
<h3 class="function"><a id="pdfioStreamWrite">pdfioStreamWrite</a></h3>
|
|
<p class="description">Write data to a stream.</p>
|
|
<p class="code">
|
|
<span class="reserved">bool</span> pdfioStreamWrite(<a href="#pdfio_stream_t">pdfio_stream_t</a> *st, <span class="reserved">const</span> <span class="reserved">void</span> *buffer, size_t bytes);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>st</th>
|
|
<td class="description">Stream</td></tr>
|
|
<tr><th>buffer</th>
|
|
<td class="description">Data to write</td></tr>
|
|
<tr><th>bytes</th>
|
|
<td class="description">Number of bytes to write</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description"><code>true</code> on success or <code>false</code> on failure</p>
|
|
<h3 class="function"><a id="pdfioStringCreate">pdfioStringCreate</a></h3>
|
|
<p class="description">Create a durable literal string.</p>
|
|
<p class="code">
|
|
<span class="reserved">char</span> *pdfioStringCreate(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *s);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>s</th>
|
|
<td class="description">Nul-terminated string</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Durable string pointer or <code>NULL</code> on error</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a literal string associated with the PDF file
|
|
"pdf". The "s" string points to a nul-terminated C string.<br>
|
|
<br>
|
|
<code>NULL</code> is returned on error, otherwise a <code>char *</code> that is valid until
|
|
<code>pdfioFileClose</code> is called.</p>
|
|
<h3 class="function"><a id="pdfioStringCreatef">pdfioStringCreatef</a></h3>
|
|
<p class="description">Create a durable formatted string.</p>
|
|
<p class="code">
|
|
<span class="reserved">char</span> *pdfioStringCreatef(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, <span class="reserved">const</span> <span class="reserved">char</span> *format, ...);</p>
|
|
<h4 class="parameters">Parameters</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>pdf</th>
|
|
<td class="description">PDF file</td></tr>
|
|
<tr><th>format</th>
|
|
<td class="description"><code>printf</code>-style format string</td></tr>
|
|
<tr><th>...</th>
|
|
<td class="description">Additional args as needed</td></tr>
|
|
</tbody></table>
|
|
<h4 class="returnvalue">Return Value</h4>
|
|
<p class="description">Durable string pointer or <code>NULL</code> on error</p>
|
|
<h4 class="discussion">Discussion</h4>
|
|
<p class="discussion">This function creates a formatted string associated with the PDF file
|
|
"pdf". The "format" string contains <code>printf</code>-style format characters.<br>
|
|
<br>
|
|
<code>NULL</code> is returned on error, otherwise a <code>char *</code> that is valid until
|
|
<code>pdfioFileClose</code> is called.</p>
|
|
<h2 class="title"><a id="TYPES">Data Types</a></h2>
|
|
<h3 class="typedef"><a id="pdfio_array_t">pdfio_array_t</a></h3>
|
|
<p class="description">Array of PDF values</p>
|
|
<p class="code">
|
|
typedef struct _pdfio_array_s pdfio_array_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_cs_t">pdfio_cs_t</a></h3>
|
|
<p class="description">Standard color spaces</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_cs_e">pdfio_cs_e</a> pdfio_cs_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_dict_cb_t">pdfio_dict_cb_t</a></h3>
|
|
<p class="description">Dictionary iterator callback</p>
|
|
<p class="code">
|
|
typedef bool (*pdfio_dict_cb_t)(<a href="#pdfio_dict_t">pdfio_dict_t</a> *dict, const char *key, void *cb_data);
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_dict_t">pdfio_dict_t</a></h3>
|
|
<p class="description">Key/value dictionary</p>
|
|
<p class="code">
|
|
typedef struct _pdfio_dict_s pdfio_dict_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_encryption_t">pdfio_encryption_t</a></h3>
|
|
<p class="description">PDF encryption modes</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_encryption_e">pdfio_encryption_e</a> pdfio_encryption_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_error_cb_t">pdfio_error_cb_t</a></h3>
|
|
<p class="description">Error callback</p>
|
|
<p class="code">
|
|
typedef bool (*pdfio_error_cb_t)(<a href="#pdfio_file_t">pdfio_file_t</a> *pdf, const char *message, void *data);
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_file_t">pdfio_file_t</a></h3>
|
|
<p class="description">PDF file</p>
|
|
<p class="code">
|
|
typedef struct _pdfio_file_s pdfio_file_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_filter_t">pdfio_filter_t</a></h3>
|
|
<p class="description">Compression/decompression filters for streams</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_filter_e">pdfio_filter_e</a> pdfio_filter_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_linecap_t">pdfio_linecap_t</a></h3>
|
|
<p class="description">Line capping modes</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_linecap_e">pdfio_linecap_e</a> pdfio_linecap_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_linejoin_t">pdfio_linejoin_t</a></h3>
|
|
<p class="description">Line joining modes</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_linejoin_e">pdfio_linejoin_e</a> pdfio_linejoin_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_matrix_t[3][2]">pdfio_matrix_t[3][2]</a></h3>
|
|
<p class="description">Transform matrix</p>
|
|
<p class="code">
|
|
typedef double pdfio_matrix_t[3][2];
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_obj_t">pdfio_obj_t</a></h3>
|
|
<p class="description">Numbered object in PDF file</p>
|
|
<p class="code">
|
|
typedef struct _pdfio_obj_s pdfio_obj_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_output_cb_t">pdfio_output_cb_t</a></h3>
|
|
<p class="description">Output callback for pdfioFileCreateOutput</p>
|
|
<p class="code">
|
|
typedef ssize_t (*pdfio_output_cb_t)(void *ctx const void *data size_t datalen);
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_password_cb_t">pdfio_password_cb_t</a></h3>
|
|
<p class="description">Password callback for pdfioFileOpen</p>
|
|
<p class="code">
|
|
typedef const char *(*pdfio_password_cb_t)(void *data const char *filename);
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_permission_t">pdfio_permission_t</a></h3>
|
|
<p class="description">PDF permission bitfield</p>
|
|
<p class="code">
|
|
typedef int pdfio_permission_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_rect_t">pdfio_rect_t</a></h3>
|
|
<p class="description">PDF rectangle</p>
|
|
<p class="code">
|
|
typedef struct <a href="#pdfio_rect_s">pdfio_rect_s</a> pdfio_rect_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_stream_t">pdfio_stream_t</a></h3>
|
|
<p class="description">Object data stream in PDF file</p>
|
|
<p class="code">
|
|
typedef struct _pdfio_stream_s pdfio_stream_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_textrendering_t">pdfio_textrendering_t</a></h3>
|
|
<p class="description">Text rendering modes</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_textrendering_e">pdfio_textrendering_e</a> pdfio_textrendering_t;
|
|
</p>
|
|
<h3 class="typedef"><a id="pdfio_valtype_t">pdfio_valtype_t</a></h3>
|
|
<p class="description">PDF value types</p>
|
|
<p class="code">
|
|
typedef enum <a href="#pdfio_valtype_e">pdfio_valtype_e</a> pdfio_valtype_t;
|
|
</p>
|
|
<h2 class="title"><a id="STRUCTURES">Structures</a></h2>
|
|
<h3 class="struct"><a id="pdfio_rect_s">pdfio_rect_s</a></h3>
|
|
<p class="description">PDF rectangle</p>
|
|
<p class="code"><span class="reserved">struct</span> pdfio_rect_s {<br>
|
|
    <span class="reserved">double</span> x1;<br>
|
|
    <span class="reserved">double</span> x2;<br>
|
|
    <span class="reserved">double</span> y1;<br>
|
|
    <span class="reserved">double</span> y2;<br>
|
|
};</p>
|
|
<h4 class="members">Members</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>x1 </th>
|
|
<td class="description">Lower-left X coordinate</td></tr>
|
|
<tr><th>x2 </th>
|
|
<td class="description">Upper-right X coordinate</td></tr>
|
|
<tr><th>y1 </th>
|
|
<td class="description">Lower-left Y coordinate</td></tr>
|
|
<tr><th>y2 </th>
|
|
<td class="description">Upper-right Y coordinate</td></tr>
|
|
</tbody></table>
|
|
<h2 class="title"><a id="ENUMERATIONS">Constants</a></h2>
|
|
<h3 class="enumeration"><a id="pdfio_cs_e">pdfio_cs_e</a></h3>
|
|
<p class="description">Standard color spaces</p>
|
|
<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_P3_D65 </th><td class="description">Display P3</td></tr>
|
|
<tr><th>PDFIO_CS_SRGB </th><td class="description">sRGB</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_encryption_e">pdfio_encryption_e</a></h3>
|
|
<p class="description">PDF encryption modes</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<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>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_filter_e">pdfio_filter_e</a></h3>
|
|
<p class="description">Compression/decompression filters for streams</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_FILTER_ASCII85 </th><td class="description">ASCII85Decode filter (reading only)</td></tr>
|
|
<tr><th>PDFIO_FILTER_ASCIIHEX </th><td class="description">ASCIIHexDecode filter (reading only)</td></tr>
|
|
<tr><th>PDFIO_FILTER_CCITTFAX </th><td class="description">CCITTFaxDecode filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_CRYPT </th><td class="description">Encryption filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_DCT </th><td class="description">DCTDecode (JPEG) filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_FLATE </th><td class="description">FlateDecode filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_JBIG2 </th><td class="description">JBIG2Decode filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_JPX </th><td class="description">JPXDecode filter (reading only)</td></tr>
|
|
<tr><th>PDFIO_FILTER_LZW </th><td class="description">LZWDecode filter (reading only)</td></tr>
|
|
<tr><th>PDFIO_FILTER_NONE </th><td class="description">No filter</td></tr>
|
|
<tr><th>PDFIO_FILTER_RUNLENGTH </th><td class="description">RunLengthDecode filter (reading only)</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_linecap_e">pdfio_linecap_e</a></h3>
|
|
<p class="description">Line capping modes</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_LINECAP_BUTT </th><td class="description">Butt ends</td></tr>
|
|
<tr><th>PDFIO_LINECAP_ROUND </th><td class="description">Round ends</td></tr>
|
|
<tr><th>PDFIO_LINECAP_SQUARE </th><td class="description">Square ends</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_linejoin_e">pdfio_linejoin_e</a></h3>
|
|
<p class="description">Line joining modes</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_LINEJOIN_BEVEL </th><td class="description">Bevel joint</td></tr>
|
|
<tr><th>PDFIO_LINEJOIN_MITER </th><td class="description">Miter joint</td></tr>
|
|
<tr><th>PDFIO_LINEJOIN_ROUND </th><td class="description">Round joint</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_permission_e">pdfio_permission_e</a></h3>
|
|
<p class="description">PDF permission bits</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_PERMISSION_ANNOTATE </th><td class="description">PDF allows annotation</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_ASSEMBLE </th><td class="description">PDF allows assembly (insert, delete, or rotate pages, add document outlines and thumbnails)</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_COPY </th><td class="description">PDF allows copying</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_FORMS </th><td class="description">PDF allows filling in forms</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_MODIFY </th><td class="description">PDF allows modification</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_NONE </th><td class="description">No permissions</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_PRINT </th><td class="description">PDF allows printing</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_PRINT_HIGH </th><td class="description">PDF allows high quality printing</td></tr>
|
|
<tr><th>PDFIO_PERMISSION_READING </th><td class="description">PDF allows screen reading/accessibility (deprecated in PDF 2.0)</td></tr>
|
|
<tr><th>~0 </th><td class="description">All permissions</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_textrendering_e">pdfio_textrendering_e</a></h3>
|
|
<p class="description">Text rendering modes</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_TEXTRENDERING_FILL </th><td class="description">Fill text</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_FILL_AND_STROKE </th><td class="description">Fill then stroke text</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_FILL_AND_STROKE_PATH </th><td class="description">Fill then stroke text and add to path</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_FILL_PATH </th><td class="description">Fill text and add to path</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_INVISIBLE </th><td class="description">Don't fill or stroke (invisible)</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_STROKE </th><td class="description">Stroke text</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_STROKE_PATH </th><td class="description">Stroke text and add to path</td></tr>
|
|
<tr><th>PDFIO_TEXTRENDERING_TEXT_PATH </th><td class="description">Add text to path (invisible)</td></tr>
|
|
</tbody></table>
|
|
<h3 class="enumeration"><a id="pdfio_valtype_e">pdfio_valtype_e</a></h3>
|
|
<p class="description">PDF value types</p>
|
|
<h4 class="constants">Constants</h4>
|
|
<table class="list"><tbody>
|
|
<tr><th>PDFIO_VALTYPE_ARRAY </th><td class="description">Array</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_BINARY </th><td class="description">Binary data</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_BOOLEAN </th><td class="description">Boolean</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_DATE </th><td class="description">Date/time</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_DICT </th><td class="description">Dictionary</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_INDIRECT </th><td class="description">Indirect object (N G obj)</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_NAME </th><td class="description">Name</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_NONE </th><td class="description">No value, not set</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_NULL </th><td class="description">Null object</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_NUMBER </th><td class="description">Number (integer or real)</td></tr>
|
|
<tr><th>PDFIO_VALTYPE_STRING </th><td class="description">String</td></tr>
|
|
</tbody></table>
|
|
</div>
|
|
</body>
|
|
</html>
|