• 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-Merger API - Constants

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_M_BOOKMARK_FORMAT_ITALIC (integer) = 0x01

Display a bookmark in italic style.

SETAPDF_M_BOOKMARK_FORMAT_BOLD (integer) = 0x02

Display a bookmark in bold style.

SETAPDF_M_COPY_BOOKMARKS_AS_CHILD (integer) = 0x01

Defines that existing bookmarks should be copied as a tree under the entry for the desired page range/document.

SETAPDF_M_COPY_BOOKMARKS_TO_SAME_LEVEL (integer) = 0x02

Defines that the bookmarks will be imported without a parent entry node in the current level (defined by the parent-key in the given $bookmark-array).

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-Merger API starts at 500 and ends at 599.

E_SETAPDF_M_PARSER_NO_KIDS (integer) = 500

Cannot find /Kids in current /Page-Dictionary

E_SETAPDF_M_WRONG_ZOOM_MODE (integer) = 501

Incorrect zoom display mode: XXXXX

E_SETAPDF_M_WRONG_DISPLAY_MODE (integer) = 502

Incorrect layout display mode: XXXXXX

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.