The API needs some constants which are hard coded into the API or have to be defined by you. There is also a constant that requires definition prior to first use.
Also you can define global variables which affects the behaviour of specific tasks.
$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.
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
SetaPDF_STAMPER_CACHEPATH (string)
The constant SetaPDF_STAMPER_CACHEPATH has to contain a path to which the PHP process can write and read. This constant must be set as soon as the caching system is activated. Otherwise the caching system will not be used.
As of version 1.6 a new global caching function exists and the API own functionality will be removed in coming version.
SetaPDF_STAMPER_FONTPATH (string)
Defines the path where the API will find the fontdefination files.
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.
Possible errorcodes for the SetaPDF-Stamper API starts at 200 and ends at 299.
E_SETAPDF_STMP_MULTIPL_NOT_ALLOWED_IF_FILE (integer) = 200
Adding multiple files is only allowed when output is set to 'F' (File)
E_SETAPDF_STMP_FILEPARA_SHOULD_BE_ARRAY (integer) = 201
Parameter should be an array: array('in' => path, 'out' => path)
E_SETAPDF_STMP_PARA_SHOULD_BE_ARRAY (integer) = 202
Parameter should be an array
E_SETAPDF_STMP_NOSUBCLASS_OF_STAMP (integer) = 203
Only subclasses of stamp are allowed.
E_SETAPDF_STMP_ERR_POSITION_PARA (integer) = 204
Wrong position parameter
E_SETAPDF_STMP_ERR_SHOWONPAGE_PARA (integer) = 205
Wrong showOnPage parameter
E_SETAPDF_STMP_ERR_CACHEUPDATE_NOT_POSSIBLE (integer) = 206
A Cache Update is only possible if $this->usecache is true.
E_SETAPDF_STMP_ERR_NO_FILES (integer) = 214
No sourcefiles added
E_SETAPDF_STMP_PARSER_NO_KIDS (integer) = 207
Cannot find /Kids in current /Page-Dictionary
E_SETAPDF_STMP_PARSER_WRONG_PAGE_NO (integer) = 230
Wrong page number
E_SETAPDF_STMP_TXTSTMP_ERR_FONTFAMILY_PARA (integer) = 208
Wrong fontfamily or fontstyle
E_SETAPDF_STMP_TXTSTMP_ERR_FONTSTYLE_PARA (integer) = 209
Wrong fontstyle
E_SETAPDF_STMP_TXTSTMP_ERR_ALIGN_PARA (integer) = 210
Wrong align parameter
E_SETAPDF_STMP_TXTSTMP_ERR_RMODE_PARA (integer) = 211
Wrong rendering mode
E_SETAPDF_STMP_TXTSTMP_ERR_FONTMFILE (integer) = 212
Could not include font metric file
E_SETAPDF_STMP_OWTXTSTMP_ERR_FONTFILE (integer) = 224
Could not load font file
E_SETAPDF_STMP_IMGSTMP_ERR_FILE (integer) = 213
No such file
E_SETAPDF_STMP_JPGSTMP_ERR_FORMAT (integer) = 215
Not a JPEG-File
E_SETAPDF_STMP_PNGSTMP_ERR_FORMAT (integer) = 216
Not a PNG-File
E_SETAPDF_STMP_PNGSTMP_ERR_INCORRECT (integer) = 217
Incorrect PNG file
E_SETAPDF_STMP_PNGSTMP_ERR_16BIT_NOT_SUPPORTED (integer) = 218
16-bit depth not supported
E_SETAPDF_STMP_PNGSTMP_ERR_ALPHA_NOT_SUPPORTED (integer) = 219
Alpha channel not supported
E_SETAPDF_STMP_PNGSTMP_ERR_COMPRESSION (integer) = 220
Unknown compression method
E_SETAPDF_STMP_PNGSTMP_ERR_FILTER (integer) = 221
Unknown filter method
E_SETAPDF_STMP_PNGSTMP_ERR_INTERLACING (integer) = 222
Interlacing not supported
E_SETAPDF_STMP_PNGSTMP_ERR_PALETTE (integer) = 223
Missing palette
E_SETAPDF_STMP_IMGSTMP_ERR_NO_FILE (integer) = 229
No image defined.
E_SETAPDF_STMP_PDFSTMP_NO_BOX_FOUND (integer) = 231
Box not found.
E_SETAPDF_STMPPRO_PARSER_ERR_ENC_FILTER (integer) = 225
Unsupported encryption filter: ...
E_SETAPDF_STMPPRO_PARSER_ERR_ENC_ALGO (integer) = 226
Unsupported encryption algorithm: ...
E_SETAPDF_STMPPRO_PARSER_ERR_REV (integer) = 227
Unsupported revision: ...
E_SETAPDF_STMPPRO_PARSER_ERR_WRONG_OPW (integer) = 228
Wrong password. Access denied.
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.