• Bookmark at: Del.icio.us
  • Bookmark at: Mister Wong
  • Bookmark at: Linkarena
  • Bookmark at: Digg
  • Bookmark at: Yahoo
  • Bookmark at: Google
  • Bookmark at: Icio

Manuals

 

SetaPDF-Signer API - Constants / Configuration

The API needs some constants which are hard coded into the API.

Also you can define global variables which affects the behaviour of specific tasks.

Global Configuration Variables

$GLOBALS['SETAPDF_PARSE_INVALID_FILES'] (boolean)

(DEPRECATED) If this global variable is set the pdf parser tries to read/repair invalid PDF documents. This setting could affect the processtime on huge files very much.

This variable isn't used by the parser as of version 1.3 (all current version of the SetaPDF APIs)

$GLOBALS['SETAPDF_SEARCH_FOR_XREF_OFFSET'] (integer)

With this global variable you can adjust the offset position from which the pdf parser should search for the pointer to the xref table. If not defined the default value of 1500 is used.

The pdf specification says it has to be in the last 1024 bytes of a file. But sometimes there are errorious document in the wild that have some garbage at the end so we need the possibility to do a kind of finetuning for them.

Predefined Version Constants

The following constants defines the versions of specific files of the SetaPDF core:

SETAPDF_CORE_VERSION (string) = 1.3

Version of the abstract SetaPDF class. Defined in /SetaPDF/SetaPDF.php

SETAPDF_PARSER_VERSION (string) = 1.3

Version of the SetaPDF_Parser class. Defined in /SetaPDF/SetaPDF_parser.php

SETAPDF_PDF_CONTEXT_VERSION (string) = 1.3

Version of the pdf_context class. Defined in /SetaPDF/pdf_context.php

SETAPDF_WRAPPER_FUNCTIONS_VERSION (string) = 1.2.1

Version of the wrapper functions file. Defined in /SetaPDF/wrapper_functions.php

Predefined Constants

SETAPDF_SIG_NOT_CERTIFIED (integer) = 0

Don't certify the document.

SETAPDF_SIG_CERTIFIED_NO_CHANGES_ALLOWED (integer) = 1

No changes allowed

SETAPDF_SIG_CERTIFIED_FORM_FILLING (integer) = 2

Form fill-in only allowed

SETAPDF_SIG_CERTIFIED_FORM_FILLING_AND_ANNOTATIONS (integer) = 3

Form fill-in and commenting allowed

Predefined Constants for Errorhandling

Possible errorcodes for the SetaPDF main class starts at 1 and ends at 99.

E_SETAPDF_CANNOT_OPEN_FILE (integer) = 1

cannot open XXXX !

E_SETAPDF_UNABLE_TO_POINT_TO_XREF_TABLE (integer) = 2

Unable to find pointer to xref table

E_SETAPDF_UNABLE_TO_FIND_XREF (integer) = 3

Unable to find xref table - Maybe a Problem with 'auto_detect_line_endings'

E_SETAPDF_UNEXPECTED_HEADER_IN_XREF_TABLE (integer) = 4

Unexpected header in xref table

E_SETAPDF_UNEXPECTED_DATA_IN_XREF_TABLE (integer) = 5

Unexpected data in xref table

E_SETAPDF_FILE_IS_ENCRYPTED (integer) = 6

File is encrypted!

E_SETAPDF_WRONG_TYPE (integer) = 7

Wrong Type of Element

E_SETAPDF_UNABLE_TO_FIND_OBJECT (integer) = 8

Unable to find object at expected location

E_SETAPDF_ENC_UNSUPPORTED_FILTER (integer) = 9
E_SETAPDF_ENC_UNSUPPORTED_ALGO (integer) = 10
E_SETAPDF_ENC_UNSUPPORTED_REVISION (integer) = 11
E_SETAPDF_ENC_NO_RIGHTS_FOR_SPECIFIC_ACTION (integer) = 12
E_SETAPDF_ENC_WRONG_OWNER_PW (integer) = 13
E_SETAPDF_CANNOT_COPY_FILE (integer) = 14

Cannot copy file XXXX to YYYY

E_SETAPDF_HEADER_ALREADY_SEND (integer) = 15

Some data has already been output to browser, can't send PDF file

E_SETAPDF_UNABLE_TO_FIND_TRAILER (integer) = 16

Trailer keyword not found after xref table

E_SETAPDF_UNSUPPORTED_FILTER (integer) = 17

An unsupported compression filter is required.

E_SETAPDF_ZLIB_REQUIRED (integer) = 18

To handle /FlateDecode filter, php with zlib support is needed.

E_SETAPDF_DECOMPRESSION_ERROR (integer) = 19

Error while decompressing stream.

E_SETAPDF_UNABLE_TO_CREATE_CACHE_DIR (integer) = 20

Unable to create directories in cache directory.

API Related Predefined Constants for Errorhandling

Possible errorcodes for the SetaPDF-Signer API starts at 600 and ends at 699.

E_SETAPDF_SIG_UNKNOWN_PROPERTY (integer) = 600

You tried to set an unknown signature property in SetaPDF_Signer::setSignatureProperty().

E_SETAPDF_SIG_TMPDIR_DOES_NOT_EXISTS (integer) = 601

Fallback temporary directory _tmp/ does not exists. This error occurs if you didn't set an own temporary directory in the factory method and the fallback directory doesn't exists.

E_SETAPDF_SIG_DIR_DOES_NOT_EXISTS (integer) = 602

Will be thrown if a directory doesn't exists.

E_SETAPDF_SIG_FIELD_NAME_TO_SHORT (integer) = 607

The string length of the fieldname have to be greater than zero.

E_SETAPDF_SIG_WRONG_MODULE_CLASS (integer) = 608

Passed module isn't an instance/subclass of SetaPDF_Signer_Module.

E_SETAPDF_SIG_NEEDAPPEARANCES_FLAG_FOUND (integer) = 609

The document includes a NeedAppearances-Flag (see SetaPDF_Signer::setRemoveNeedAppearancesFlag()).

E_SETAPDF_SIG_SIGNATURE_LENGTH_TO_LARGE (integer) = 611

The signature length (?? bytes) doesn't fit into the reserved space (?? bytes) and "$this->allowSignatureContentLengthChange" is set to false. (see SetaPDF_Signer::setAllowSignatureContentLengthChange())

E_SETAPDF_SIG_PARSER_NO_KIDS (integer) = 612

Cannot find /Kids in current /Page-Dictionary

E_SETAPDF_SIG_ALREADY_CERTIFIED (integer) = 613

Document is already certified. Only approval signatures are possible

E_SETAPDF_SIG_PARSER_WRONG_PAGE_NO (integer) = 614

Wrong page number given

E_SETAPDF_SIG_NO_BOX_FOUND (integer) = 615

Page box not found

E_SETAPDF_SIG_MOD_OPENSSL_NOT_AVAILABLE (integer) = 610

This module requires php compiled with openssl.

E_SETAPDF_SIG_MOD_OPENSSL_ERROR (integer) = 603

An error from OpenSSL occurs. If you've set the track_errors directive to "On" the message will include a detailed error message.

E_SETAPDF_SIG_MOD_OPENSSL_BOUNDARY_ID_NOT_FOUND (integer) = 604

Will occur if the boundary id in a created smime message is not found.

E_SETAPDF_SIG_MOD_OPENSSL_SIG_EXTRACTION (integer) = 605

An error occurs while extracting the signature of the smime message.

E_SETAPDF_SIG_MOD_OPENSSLCLI_ERROR (integer) = 606

The commandline call of OpenSSL failed.

E_SETAPDF_SIG_CURL_ERROR (integer) = 616

curl_exec() returned false. The detailed error message is included in the error object.

E_SETAPDF_SIG_CURL_RES_ERROR (integer) = 617

The time stamp server responses with another status code than 200.

E_SETAPDF_SIG_TS_ERROR (integer) = 618

Time stamp server returned status other than 0 (zero). More details see: RFC3161 (2.4.2.)

Constans for Cache Mechanism

The following constants are used to control the behaviour of the caching mechanism of the pdf parser.

SETAPDF_P_CACHE_NO (integer) = 0x00

Don't read and write cache.

SETAPDF_P_CACHE_READ_XREF (integer) = 0x01

Try to read the cached xref table.

SETAPDF_P_CACHE_WRITE_XREF (integer) = 0x02

Write the xref table to cache.

SETAPDF_P_CACHE_XREF (integer) = 0x01 | 0x02

Try to read and write the xref table.

SETAPDF_P_CACHE_READ_OBJECTS (integer) = 0x04

Try to read cached objects.

SETAPDF_P_CACHE_WRITE_OBJECTS (integer) = 0x08

Write read objects to cache.

SETAPDF_P_CACHE_OBJECTS (integer) = 0x04 | 0x08

Try to read and write objects to cache.

SETAPDF_P_CACHE_ALL (integer) = 0x01 | 0x02 | 0x04 | 0x08

Read and write objects and xref-tables.