mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2024-12-25 12:58:21 +01:00
Add pdfioFileCreateNumber/StringObj functions (Issue #14)
This commit is contained in:
parent
7ff051fc8b
commit
16c8b830b8
@ -5,6 +5,8 @@ Changes in PDFio
|
||||
v1.2.0 (Month DD, YYYY)
|
||||
-----------------------
|
||||
|
||||
- Added `pdfioFileCreateNumberObj` and `pdfioFileCreateStringObj` functions
|
||||
(Issue #14)
|
||||
- Added `pdfioContentTextMeasure` function (Issue #17)
|
||||
- Added `pdfioContentTextNewLineShow` and `pdfioContentTextNewLineShowf`
|
||||
functions (Issue #24)
|
||||
|
24
doc/pdfio.3
24
doc/pdfio.3
@ -2325,6 +2325,18 @@ Note: Currently PNG support is limited to grayscale, RGB, or indexed files
|
||||
without interlacing or alpha. Transparency (masking) based on color/index
|
||||
.IP 5
|
||||
is supported.
|
||||
.SS pdfioFileCreateNumberObj
|
||||
Create a new object in a PDF file containing a number.
|
||||
.PP
|
||||
.nf
|
||||
pdfio_obj_t * pdfioFileCreateNumberObj (
|
||||
pdfio_file_t *pdf,
|
||||
double number
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
This function creates a new object with a number value in a PDF file.
|
||||
You must call \fIpdfioObjClose\fR to write the object to the file.
|
||||
.SS pdfioFileCreateObj
|
||||
Create a new object in a PDF file.
|
||||
.PP
|
||||
@ -2389,6 +2401,18 @@ pdfio_stream_t * pdfioFileCreatePage (
|
||||
pdfio_dict_t *dict
|
||||
);
|
||||
.fi
|
||||
.SS pdfioFileCreateStringObj
|
||||
Create a new object in a PDF file containing a string.
|
||||
.PP
|
||||
.nf
|
||||
pdfio_obj_t * pdfioFileCreateStringObj (
|
||||
pdfio_file_t *pdf,
|
||||
const char *string
|
||||
);
|
||||
.fi
|
||||
.PP
|
||||
This function creates a new object with a string value in a PDF file.
|
||||
You must call \fIpdfioObjClose\fR to write the object to the file.
|
||||
.SS pdfioFileCreateTemporary
|
||||
|
||||
.PP
|
||||
|
@ -385,9 +385,11 @@ span.string {
|
||||
<li><a href="#pdfioFileCreateICCObjFromFile">pdfioFileCreateICCObjFromFile</a></li>
|
||||
<li><a href="#pdfioFileCreateImageObjFromData">pdfioFileCreateImageObjFromData</a></li>
|
||||
<li><a href="#pdfioFileCreateImageObjFromFile">pdfioFileCreateImageObjFromFile</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>
|
||||
@ -2771,6 +2773,22 @@ image on the page.<br>
|
||||
Note: Currently PNG support is limited to grayscale, RGB, or indexed files
|
||||
without interlacing or alpha. Transparency (masking) based on color/index
|
||||
is supported.</blockquote>
|
||||
<h3 class="function"><a id="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, double 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">
|
||||
@ -2849,6 +2867,22 @@ stored as indirect object references.</blockquote>
|
||||
</tbody></table>
|
||||
<h4 class="returnvalue">Return Value</h4>
|
||||
<p class="description">Contents stream</p>
|
||||
<h3 class="function"><a id="pdfioFileCreateStringObj">pdfioFileCreateStringObj</a></h3>
|
||||
<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, const char *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">
|
||||
|
52
pdfio-file.c
52
pdfio-file.c
@ -334,6 +334,32 @@ pdfioFileCreateArrayObj(
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioFileCreateNumberObj()' - Create a new object in a PDF file containing a number.
|
||||
//
|
||||
// This function creates a new object with a number value in a PDF file.
|
||||
// You must call @link pdfioObjClose@ to write the object to the file.
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - New object
|
||||
pdfioFileCreateNumberObj(
|
||||
pdfio_file_t *pdf, // I - PDF file
|
||||
double number) // I - Number value
|
||||
{
|
||||
_pdfio_value_t value; // Object value
|
||||
|
||||
|
||||
// Range check input...
|
||||
if (!pdf)
|
||||
return (NULL);
|
||||
|
||||
value.type = PDFIO_VALTYPE_NUMBER;
|
||||
value.value.number = number;
|
||||
|
||||
return (_pdfioFileCreateObj(pdf, NULL, &value));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioFileCreateObj()' - Create a new object in a PDF file.
|
||||
//
|
||||
@ -639,6 +665,32 @@ pdfioFileCreatePage(pdfio_file_t *pdf, // I - PDF file
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioFileCreateStringObj()' - Create a new object in a PDF file containing a string.
|
||||
//
|
||||
// This function creates a new object with a string value in a PDF file.
|
||||
// You must call @link pdfioObjClose@ to write the object to the file.
|
||||
//
|
||||
|
||||
pdfio_obj_t * // O - New object
|
||||
pdfioFileCreateStringObj(
|
||||
pdfio_file_t *pdf, // I - PDF file
|
||||
const char *string) // I - String
|
||||
{
|
||||
_pdfio_value_t value; // Object value
|
||||
|
||||
|
||||
// Range check input...
|
||||
if (!pdf)
|
||||
return (NULL);
|
||||
|
||||
value.type = PDFIO_VALTYPE_STRING;
|
||||
value.value.string = string;
|
||||
|
||||
return (_pdfioFileCreateObj(pdf, NULL, &value));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// 'pdfioFileCreateTemporary()' - Create a temporary PDF file.
|
||||
//
|
||||
|
2
pdfio.h
2
pdfio.h
@ -180,10 +180,12 @@ extern bool pdfioDictSetStringf(pdfio_dict_t *dict, const char *key, const char
|
||||
extern bool pdfioFileClose(pdfio_file_t *pdf) _PDFIO_PUBLIC;
|
||||
extern pdfio_file_t *pdfioFileCreate(const char *filename, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_data) _PDFIO_PUBLIC;
|
||||
extern pdfio_obj_t *pdfioFileCreateArrayObj(pdfio_file_t *pdf, pdfio_array_t *array) _PDFIO_PUBLIC;
|
||||
extern pdfio_obj_t *pdfioFileCreateNumberObj(pdfio_file_t *pdf, double number) _PDFIO_PUBLIC;
|
||||
extern pdfio_obj_t *pdfioFileCreateObj(pdfio_file_t *pdf, pdfio_dict_t *dict) _PDFIO_PUBLIC;
|
||||
extern pdfio_file_t *pdfioFileCreateOutput(pdfio_output_cb_t output_cb, void *output_ctx, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_data) _PDFIO_PUBLIC;
|
||||
// TODO: Add number, array, string, etc. versions of pdfioFileCreateObject?
|
||||
extern pdfio_stream_t *pdfioFileCreatePage(pdfio_file_t *pdf, pdfio_dict_t *dict) _PDFIO_PUBLIC;
|
||||
extern pdfio_obj_t *pdfioFileCreateStringObj(pdfio_file_t *pdf, const char *s) _PDFIO_PUBLIC;
|
||||
extern pdfio_file_t *pdfioFileCreateTemporary(char *buffer, size_t bufsize, const char *version, pdfio_rect_t *media_box, pdfio_rect_t *crop_box, pdfio_error_cb_t error_cb, void *error_data) _PDFIO_PUBLIC;
|
||||
extern pdfio_obj_t *pdfioFileFindObj(pdfio_file_t *pdf, size_t number) _PDFIO_PUBLIC;
|
||||
extern const char *pdfioFileGetAuthor(pdfio_file_t *pdf) _PDFIO_PUBLIC;
|
||||
|
@ -181,9 +181,11 @@ pdfioFileCreateFontObjFromFile
|
||||
pdfioFileCreateICCObjFromFile
|
||||
pdfioFileCreateImageObjFromData
|
||||
pdfioFileCreateImageObjFromFile
|
||||
pdfioFileCreateNumberObj
|
||||
pdfioFileCreateObj
|
||||
pdfioFileCreateOutput
|
||||
pdfioFileCreatePage
|
||||
pdfioFileCreateStringObj
|
||||
pdfioFileCreateTemporary
|
||||
pdfioFileFindObj
|
||||
pdfioFileGetAuthor
|
||||
|
Loading…
Reference in New Issue
Block a user