SetaPDF_Core_Parser_CrossReferenceTable A PDF cross reference parser

File: /SetaPDF v2/Core/Parser/CrossReferenceTable.php

Class hierarchy

Implements

Summary

Constants

COMPRESSED_ALL

Constant for full compression.

COMPRESSED_HYBRID

Constant for a hybrid compression.

COMPRESSED_NONE

Constant for none compression.


Static Properties

$fileTrailerSearchLength

The byte count in which the initial xref keyword should be searched for

$readOnAccess

A flag indicating the way of reading the xref table.

If set to true, the xref table will only read/resolved if an 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

$_compressed

Cross reference uses compressed object streams, hybrid or none

$_compressedXrefObjects

An array holding all resolved indirect objects representing compressed xref tables.

$_maxObjId

The greatest used object id

$_objectOffsets

The cross reference content

$_parser

$_parserObjectOffsets

Object offsets in the parser File

$_pointerToXref

The initial pointer to the xref table

$_startOffset

Offset for PDF documents with invalid data before the PDF header.

$_updatedOffsets

Updated offsets

$_xrefSubsection

Offset positions of subsections or cross reference stream objects


Methods

__construct()

_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()

protected SetaPDF_Core_Parser_CrossReferenceTable::_readTrailerAndXref (
integer|boolean $xrefOffset
): void

Read the document trailer and initiate the initial parsing of the xref table.

Parameters
$xrefOffset : integer|boolean
 
Exceptions

Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception

_readXref()

Read the xref table at a specific position.

Exceptions

Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception

cleanUp()

Release memory/references.

deleteObject()

public SetaPDF_Core_Document_CrossReferenceTable::deleteObject (
integer $objectId
): void

Mark an object as deleted.

Parameters
$objectId : integer
 

getCompressedStream()

public SetaPDF_Core_Document_CrossReferenceTable::getCompressedStream (
SetaPDF_Core_Type_Dictionary $value, integer $newPointerToXref [, boolean $onlyUpdated = true ]
): boolean|SetaPDF_Core_Type_Stream

Get the cross reference as a compressed stream object.

Parameters
$value : SetaPDF_Core_Type_Dictionary
 
$newPointerToXref : integer
 
$onlyUpdated : boolean
 

getCompressedXrefObjects()

Get all indirect objects holding cross reference streams.

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.

getDefiniedObjectIds()

Alias for getDefinedObjectIds()

getGenerationNumberByObjectId()

public SetaPDF_Core_Parser_CrossReferenceTable::getGenerationNumberByObjectId (
integer $objectId
): integer|boolean

Get the generation number by an object id.

Parameters
$objectId : integer
 

getOffsetFor()

public SetaPDF_Core_Document_CrossReferenceTable::getOffsetFor (
integer $objectId [, integer|null $generation = 0 ]
): integer|array|boolean

Get an offset for an object.

Parameters
$objectId : integer
 
$generation : integer|null
 

getParserOffsetFor()

public SetaPDF_Core_Parser_CrossReferenceTable::getParserOffsetFor (
integer $objectId [, integer $generation = null [, integer &$objectGeneration = null ]]
): boolean|mixed

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.

getPointerToXref()

Find the initial point to the xref table.

Exceptions

Throws SetaPDF_Core_Parser_CrossReferenceTable_Exception

getSize()

Get the size of the cross reference table.

getStartOffset()

Get the start offset.

getTrailer()

isCompressed()

Check if the xref table uses compressed xref streams.

Use getCompressed

isOffsetUpdated()

public SetaPDF_Core_Document_CrossReferenceTable::isOffsetUpdated (
integer $objectId
): boolean

Checks if an objects offset is updated.

Parameters
$objectId : integer
 

setOffsetFor()

public SetaPDF_Core_Document_CrossReferenceTable::setOffsetFor (
integer $objectId, integer $generation, integer|array $offset
): void

Set an object offset.

Parameters
$objectId : integer
 
$generation : integer
 
$offset : integer|array
 

updateSize()

public SetaPDF_Core_Document_CrossReferenceTable::updateSize (
integer $objectId
): void

Updates the size value of this cross-reference table.

Parameters
$objectId : integer
 

writeNormal()

public SetaPDF_Core_Document_CrossReferenceTable::writeNormal (
SetaPDF_Core_Writer_WriterInterface $writer [, boolean $onlyUpdated = true ]
): integer

Writes the cross reference to a writer.

Parameters
$writer : SetaPDF_Core_Writer_WriterInterface
 
$onlyUpdated : boolean