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.

3.11 REALbasic Binding<br />

Installing the <strong>TET</strong> edition for REALbasic. <strong>TET</strong> for REALbasic (<strong>TET</strong>.rbx) must be copied to a<br />

folder called Plugins in the same folder where the REALbasic application lives. <strong>TET</strong> for<br />

REALbasic is delivered in a single package and contains the following variants:<br />

> OS X Carbon (PowerPC and Intel)<br />

> Windows<br />

> Linux<br />

This means that you can use the OS X or Windows version to build applications for all<br />

supported platforms. When a stand-alone application is generated, REALbasic selects<br />

the appropriate parts of <strong>TET</strong> and includes only the platform-specific portion(s) in the<br />

generated application.<br />

Additional REALbasic classes. <strong>TET</strong> adds two new classes to REALbasic’s object hierarchy:<br />

> The <strong>TET</strong> class contains all <strong>TET</strong> API methods.<br />

> The <strong>TET</strong>Exception class, which is derived from RuntimeException, can be used to deal<br />

with exceptions thrown by <strong>TET</strong> (see below).<br />

<strong>TET</strong> can be used to create GUI applications as well as console applications. Since <strong>TET</strong> is<br />

not a control it does not install a new icon in REALbasic’s control palette. However,<br />

when <strong>TET</strong> is available, REALbasic will be aware of the <strong>TET</strong> class and its associated methods.<br />

For example, statement completion and parameter checking fully work for <strong>TET</strong> API<br />

methods.<br />

Error handling in REALbasic. In case of an exception <strong>TET</strong> will throw a native REALbasic<br />

exception of the class <strong>TET</strong>Exception. <strong>TET</strong> Exceptions can be handled with standard REALbasic<br />

techniques: either use a try/catch block (this is recommended, but requires REALbasic<br />

5.5 or above), or handle them in an Exception block. The latter is demonstrated in<br />

the following code fragment:<br />

Exception err As <strong>TET</strong>Exception<br />

MsgBox("<strong>TET</strong> exception occurred in extractor sample: [" + _<br />

Str(err.get_errnum()) + "] " + err.get_apiname() + ": " + err.get_errmsg())<br />

As shown in this example, REALbasic developers can access detailed error information<br />

by using the <strong>TET</strong>Exception methods for retrieving error number, error message, and the<br />

name of the API function which raised the exception.

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

Saved successfully!

Ooh no, something went wrong!