SetaPDF_Core_Parser_CrossReferenceTable A PDF cross reference parser
File: /SetaPDF v2/Core/Parser/CrossReferenceTable.php
Class hierarchy
Implements
Summary
Methods
- __construct()
- _findStartOffset()
- _readTrailerAndXref()
- _readXref()
- cleanUp()
- deleteObject()
- getCompressedStream()
- getCompressedXrefObjects()
- getDefinedObjectIds()
- getDefiniedObjectIds()
- getGenerationNumberByObjectId()
- getOffsetFor()
- getParserOffsetFor()
- getParserOffsetOfCrossreferenceStream()
- getPointerToXref()
- getSize()
- getStartOffset()
- getTrailer()
- isCompressed()
- isOffsetUpdated()
- offsetsUpdated()
- setOffsetFor()
- updateSize()
- writeNormal()
Constants
COMPRESSED_ALL
Constant for full compression.
COMPRESSED_HYBRID
Constant for a hybrid compression.
COMPRESSED_NONE
Constant for none compression.
Static Properties
$readOnAccess
A flag indicating the way of reading the xref table.
If set to true, the xref table will only read/resolved if the access to an object is needed. This is very fast for a small amount of access (updates). If set to false, the complete xref-table will be read in at once. This is faster if the document should be completely rewritten.
Properties
$_compressedXrefObjects
An array holding all resolved indirect objects representing compressed xref tables.
$_compressedXrefObjectsOffsets
Object offsets of cross-reference streams.
We separate these offsets to allow faulty overwrites of these objects.
$_pointerToXref
The initial pointer to the xref table
$_startOffset
Offset for PDF documents with invalid data before the PDF header.
Methods
__construct()
The constructor.
Parameters
- $parser : SetaPDF_Core_Parser_Pdf
Exceptions
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception
_findStartOffset()
Counts the bytes to the initial PDF file header to get an offset which will be used along with all other byte offsets.
Exceptions
Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception
See
_readTrailerAndXref()
Read the document trailer and initiate the initial parsing of the xref table.
Parameters
- $xrefOffset : integer|boolean
Exceptions
Throws SetaPDF_Core_Exception
Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception
getCompressedStream()
Get the cross-reference as a compressed stream object.
Parameters
- $value : SetaPDF_Core_Type_Dictionary
- $newPointerToXref : integer
- $onlyUpdated : boolean
getDefinedObjectIds()
Get all defined object ids.
This method returns an array of all objects which are noticed in any cross-reference table. The appearance of an object id in this list is not an evidence of existence of the desired object.
getGenerationNumberByObjectId()
Get the generation number by an object id.
Parameters
- $objectId : integer
Exceptions
Throws SetaPDF_Core_Type_Exception
getOffsetFor()
Get an offset for an object.
Parameters
- $objectId : integer
- $generation : integer|null
getParserOffsetFor()
Returns the offset position of an object.
Parameters
- $objectId : integer
- $generation : integer
- $objectGeneration : integer
The final generation number, resolved if no generation number was given.
Exceptions
Throws SetaPDF_Core_Parser_Exception
Throws SetaPDF_Core_Type_Exception
Throws SetaPDF_Exception
getParserOffsetOfCrossreferenceStream()
Get the byte-offset of a cross-reference stream by its object id.
Parameters
- $objectId : integer
- $generation : integer
getPointerToXref()
Find the initial point to the xref table.
Exceptions
Throws SetaPDF_Core_Exception
setOffsetFor()
Set an object offset.
Parameters
- $objectId : integer
- $generation : integer
- $offset : integer|array
writeNormal()
Writes the cross-reference to a writer.
Parameters
- $writer : SetaPDF_Core_Writer_WriterInterface
- $onlyUpdated : boolean