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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

const wstring pageoptlist = L"granularity=page";<br />

> Suitable wstring-capable methods (wcerr etc.) must be used to process <strong>TET</strong> error messages<br />

and exception strings (get_errmsg( ) method in the <strong>TET</strong> and <strong>TET</strong>::Exception classes).<br />

> The tet.cpp module is no longer required for the <strong>TET</strong> C++ binding. Although the <strong>TET</strong><br />

distribution contains a dummy implementation of this module, it should be removed<br />

from the build process for <strong>TET</strong> applications.<br />

Full source code compatibility with legacy applications. The new C++ binding has been<br />

designed with application-level source code compatibility mind, but client applications<br />

must be recompiled. The following aids are available to achieve full source code compatibility<br />

for legacy applications:<br />

> Disable the wstring-based interface as follows before including tet.hpp:<br />

#define <strong>TET</strong>CPP_<strong>TET</strong>_WSTRING 0<br />

> Disable the pdflib namespace as follows before including tet.hpp:<br />

#define <strong>TET</strong>CPP_USE_PDFLIB_NAMESPACE 0<br />

Error handling in C++. <strong>TET</strong> API functions will throw a C++ exception in case of an error.<br />

These exceptions must be caught in the client code by using C++ try/catch clauses. In order<br />

to provide extended error information the <strong>TET</strong> class provides a public <strong>TET</strong>::Exception<br />

class which exposes methods for retrieving the detailed error message, the exception<br />

number, and the name of the <strong>TET</strong> API function which threw the exception.<br />

Native C++ exceptions thrown by <strong>TET</strong> routines will behave as expected. The following<br />

code fragment will catch exceptions thrown by <strong>TET</strong>:<br />

try {<br />

...some <strong>TET</strong> instructions...<br />

} catch (<strong>TET</strong>::Exception &ex) {<br />

wcerr

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

Saved successfully!

Ooh no, something went wrong!