com.pdflib
Class plop

java.lang.Object
  extended by com.pdflib.plop
All Implemented Interfaces:
IpCOS

public final class plop
extends java.lang.Object
implements IpCOS

PDFlib PLOP (PDF Linearization, Optimization, Protection) Note that this is only a syntax summary. For complete information please refer to the PLOP API reference manual which is available in the PDF file PLOP-manual.pdf in the PLOP distribution.

Version:
5.3p1
Author:
Rainer Schaaf

Constructor Summary
plop()
          Create a new PLOP context.
 
Method Summary
 int add_recipient(java.lang.String optlist)
          Add recipient for encryption with certificate security.
 void close_document(int doc, java.lang.String optlist)
          Close the input and output documents.
 java.lang.String convert_to_unicode(java.lang.String inputformat, byte[] inputstring, java.lang.String optlist)
          Convert an arbitrary encoded string to a Unicode string in several formats.
 int create_document(java.lang.String filename, java.lang.String optlist)
          Create a PDF output document (which may be protected) in memory or on disk file.
 void create_pvf(java.lang.String filename, byte[] data, java.lang.String optlist)
          Create a named virtual read-only file from data provided in memory.
 int delete_pvf(java.lang.String filename)
          Delete a named virtual file and free its data structures (but not the contents).
 void delete()
          Delete a PLOP context and release all its internal resources.
 java.lang.String get_apiname()
          Get the name of the API function which threw the last exception or failed.
 byte[] get_buffer()
          Fetch full or partial buffer contents of the output document from memory.
 java.lang.String get_errmsg()
          Get the descriptive text of the last thrown exception, or the reason of a failed function call.
 int get_errnum()
          Get the number of the last thrown exception, or the reason of a failed function call.
 double info_pvf(java.lang.String filename, java.lang.String keyword)
          Query properties of a virtual file or the PDFlib Virtual File system (PVF).
 int open_document(java.lang.String filename, java.lang.String optlist)
          Open a PDF document (which may be protected) for processing.
 void pcos_close_document(int doc, java.lang.String optlist)
          Close PLOP input document via the IpCOS interface.
 double pcos_get_number(int doc, java.lang.String path)
          Get the value of a pCOS path with type number or boolean.
 byte[] pcos_get_stream(int doc, java.lang.String optlist, java.lang.String path)
          Get the value of a pCOS path with type name, number, string, or boolean.
 java.lang.String pcos_get_string(int doc, java.lang.String path)
          Get the value of a pCOS path with type name, string, or boolean.
 int pcos_open_document(java.lang.String filename, java.lang.String optlist)
          Open a disk-based or virtual PDF document via the IpCOS interface.
 int prepare_signature(java.lang.String optlist)
          Prepare signature options.
 void set_option(java.lang.String optlist)
          Set one or more global options for PLOP.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

plop

public plop()
     throws PLOPException
Create a new PLOP context.

Throws:
PLOPException - May throw an exception in case of memory shortage.
Method Detail

add_recipient

public final int add_recipient(java.lang.String optlist)
                        throws PLOPException
Add recipient for encryption with certificate security.

Returns:
-1 on error, and 1 otherwise.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

close_document

public final void close_document(int doc,
                                 java.lang.String optlist)
                          throws PLOPException
Close the input and output documents.

Throws:
PLOPException - PLOP output cannot be finished after an exception.

convert_to_unicode

public final java.lang.String convert_to_unicode(java.lang.String inputformat,
                                                 byte[] inputstring,
                                                 java.lang.String optlist)
                                          throws PLOPException
Convert an arbitrary encoded string to a Unicode string in several formats.

Specified by:
convert_to_unicode in interface IpCOS
Parameters:
inputformat - Unicode text format or encoding name specifying interpretation of the input string
inputstring - String to be converted to Unicode
optlist - An option list specifying options for input interpretation and Unicode conversion
Returns:
The converted Unicode string.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

create_document

public final int create_document(java.lang.String filename,
                                 java.lang.String optlist)
                          throws PLOPException
Create a PDF output document (which may be protected) in memory or on disk file.

Returns:
-1 on error, and a document handle otherwise.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

create_pvf

public final void create_pvf(java.lang.String filename,
                             byte[] data,
                             java.lang.String optlist)
                      throws PLOPException
Create a named virtual read-only file from data provided in memory.

Specified by:
create_pvf in interface IpCOS
Parameters:
filename - The name of the virtual file
data - Data for the virtual file
optlist - An option list
Throws:
PLOPException - PLOP output cannot be finished after an exception.

delete_pvf

public final int delete_pvf(java.lang.String filename)
                     throws PLOPException
Delete a named virtual file and free its data structures (but not the contents).

Specified by:
delete_pvf in interface IpCOS
Parameters:
filename - The name of the virtual file.
Returns:
-1 if the virtual file exists but is locked, and 1 otherwise.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

get_apiname

public final java.lang.String get_apiname()
Get the name of the API function which threw the last exception or failed.

Specified by:
get_apiname in interface IpCOS
Returns:
The name of a PLOP API function.

get_buffer

public final byte[] get_buffer()
                        throws PLOPException
Fetch full or partial buffer contents of the output document from memory.

Returns:
A buffer containing output data.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

get_errmsg

public final java.lang.String get_errmsg()
Get the descriptive text of the last thrown exception, or the reason of a failed function call.

Specified by:
get_errmsg in interface IpCOS
Returns:
A string describing the error, or an empty string if the last API call didn't cause any error.

get_errnum

public final int get_errnum()
Get the number of the last thrown exception, or the reason of a failed function call.

Specified by:
get_errnum in interface IpCOS
Returns:
The exception's error number.

info_pvf

public final double info_pvf(java.lang.String filename,
                             java.lang.String keyword)
                      throws PLOPException
Query properties of a virtual file or the PDFlib Virtual File system (PVF).

Specified by:
info_pvf in interface IpCOS
Parameters:
filename - The name of the virtual file. The filename may be empty if keyword=filecount.
keyword - A keyword for the requested information
Returns:
The value of some file parameter as requested by keyword.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

open_document

public final int open_document(java.lang.String filename,
                               java.lang.String optlist)
                        throws PLOPException
Open a PDF document (which may be protected) for processing.

Returns:
-1 on error, and a document handle otherwise.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

pcos_get_number

public final double pcos_get_number(int doc,
                                    java.lang.String path)
                             throws PLOPException
Get the value of a pCOS path with type number or boolean.

Specified by:
pcos_get_number in interface IpCOS
Parameters:
doc - A valid document handle obtained with pcos_open_document()
path - A full pCOS path for a numerical or boolean object
Returns:
The numerical value of the object identified by the pCOS path.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

pcos_get_stream

public final byte[] pcos_get_stream(int doc,
                                    java.lang.String optlist,
                                    java.lang.String path)
                             throws PLOPException
Get the value of a pCOS path with type name, number, string, or boolean.

Specified by:
pcos_get_stream in interface IpCOS
Parameters:
doc - A valid document handle obtained with pcos_open_document()
optlist - An option list specifying stream retrieval options
path - A full pCOS path for a stream or string object
Returns:
The unencrypted data contained in the stream or string.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

pcos_get_string

public final java.lang.String pcos_get_string(int doc,
                                              java.lang.String path)
                                       throws PLOPException
Get the value of a pCOS path with type name, string, or boolean.

Specified by:
pcos_get_string in interface IpCOS
Parameters:
doc - A valid document handle obtained with pcos_open_document()
path - A full pCOS path for a string, number, name, or boolean object
Returns:
A string with the value of the object identified by the pCOS path.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

prepare_signature

public final int prepare_signature(java.lang.String optlist)
                            throws PLOPException
Prepare signature options.

Returns:
-1 on error, and 1 otherwise.
Throws:
PLOPException - PLOP output cannot be finished after an exception.

set_option

public final void set_option(java.lang.String optlist)
                      throws PLOPException
Set one or more global options for PLOP.

Specified by:
set_option in interface IpCOS
Parameters:
optlist - An option list specifying global options
Throws:
PLOPException - PLOP output cannot be finished after an exception.

delete

public final void delete()
Delete a PLOP context and release all its internal resources. This should be called for cleanup when processing is done, and after a PLOPException occurred. This method may also be called by the finalizer, but it is safe to issue multiple calls.

Specified by:
delete in interface IpCOS

pcos_open_document

public int pcos_open_document(java.lang.String filename,
                              java.lang.String optlist)
                       throws java.lang.Exception
Open a disk-based or virtual PDF document via the IpCOS interface.

Specified by:
pcos_open_document in interface IpCOS
Parameters:
filename - The full path name of the PDF file to be opened. The file will be searched by means of the SearchPath resource.
optlist - An option list specifying document options.
Returns:
A document handle.
Throws:
java.lang.Exception - see manual

pcos_close_document

public void pcos_close_document(int doc,
                                java.lang.String optlist)
                         throws java.lang.Exception
Close PLOP input document via the IpCOS interface.

Specified by:
pcos_close_document in interface IpCOS
Parameters:
doc - A valid document handle obtained with open_document().
optlist - An option list specifying document options.
Throws:
java.lang.Exception - see manual