17.05.2014 Views

PDFlib Text Extraction Toolkit (TET) Manual

PDFlib Text Extraction Toolkit (TET) Manual

PDFlib Text Extraction Toolkit (TET) Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

C++ int write_image_file(int doc, int imageid, string optlist)<br />

C# Java int write_image_file(int doc, int imageid, String optlist)<br />

Perl PHP long <strong>TET</strong>_write_image_file(resource tet, long doc, long imageid, string optlist)<br />

VB Function write_image_file(doc As Long, imageid As Long, optlist As String) As Long<br />

C<br />

int <strong>TET</strong>_write_image_file(<strong>TET</strong> *tet, int doc, int imageid, const char *optlist)<br />

Write image data to disk.<br />

doc A valid document handle obtained with <strong>TET</strong>_open_document*( ).<br />

imageid The pCOS ID of the image. This ID can be retrieved from the imageid field after<br />

a successful call to <strong>TET</strong>_get_image_info( ), or by looping over all entries in the images<br />

pseudo object (there are length:images entries in this array).<br />

optlist An option list specifying page options according to Table 10.12. The following<br />

options can be used: compression, filename, format, keepxmp, typeonly.<br />

Returns<br />

Details<br />

Bindings<br />

-1 on error, or a value greater than 0 otherwise. If -1 is returned it is recommended to call<br />

<strong>TET</strong>_get_errmsg( ) to find out more details about the error. No image output will be created<br />

in case of an error. The rare case of images in an unsupported format will also be reported<br />

as an error. If the return value is different from -1 it indicates that the image can<br />

be extracted in the file format indicated by the return value:<br />

> -1: an error occurred; no image will be extracted<br />

> 10: image extracted as TIFF (.tif)<br />

> 20: image extracted as JPEG (.jpg)<br />

> 30: image extracted as JPEG 2000 (.jpx)<br />

This function will convert the pixel data for the image with the specified pCOS ID to one<br />

of several image formats, and write the result to a disk file. If the typeonly option has<br />

been supplied, only the image type will be returned, but no image file will be generated.<br />

C/C++: macros for the return values are available in tetlib.h.<br />

Table 10.12 Options for <strong>TET</strong>_write_image_file( ) and <strong>TET</strong>_get_image_data( )<br />

option<br />

compression<br />

filename 1<br />

keepxmp<br />

typeonly 1<br />

description<br />

(Keyword) The algorithm for compressing the pixel data (default: auto):<br />

auto select a suitable compression algorithm automatically<br />

none (Only relevant for TIFF images) Write the pixel data without any compression if possible.<br />

(String; required unless typeonly is also supplied) The name of the image file on disk. A suffix will be added<br />

to the filename to indicate the image file format.<br />

(Boolean) If true and the image has associated XMP metadata in the PDF, the metadata will be embedded<br />

in extracted TIFF and JPEG images. Default: true<br />

(Boolean) The image type will be determined according to the supplied options, but no image file will be<br />

written. This is useful for determining the type of image returned by <strong>TET</strong>_get_image_data( ), which does<br />

not return the image type itself. Default: false<br />

1. Only for <strong>TET</strong>_write_image_file( )<br />

10.7 Image Retrieval Functions 147

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!