fpdi_pdf_parser Class fpdi_pdf_parser

File: /FPDI v1/fpdi_pdf_parser.php

Class hierarchy

Summary

Static Properties

$searchForStartxrefLength

static public int fpdi_pdf_parser::$searchForStartxrefLength = 5500

Define the amount of byte in which the initial keyword of a PDF document should be searched.


Properties

$_c

protected pdf_context fpdi_pdf_parser::$_c

PDF Context

$_currentObj

protected array fpdi_pdf_parser::$_currentObj

The current read object

$_f

protected resource fpdi_pdf_parser::$_f

File resource

$_pageCount

protected integer fpdi_pdf_parser::$_pageCount

Page count

$_pages

protected array fpdi_pdf_parser::$_pages

Pages

Index begins at 0

$_pdfVersion

public string fpdi_pdf_parser::$_pdfVersion

PDF version of imported document

$_readPlain

protected boolean fpdi_pdf_parser::$_readPlain = true

For reading encrypted documents and xref/object streams are in use

$_root

protected array fpdi_pdf_parser::$_root

Data of the Root object

$_xref

protected array fpdi_pdf_parser::$_xref

xref-Data

$availableBoxes

public array fpdi_pdf_parser::$availableBoxes = array(...)

Available BoxTypes

$filename

public string fpdi_pdf_parser::$filename

Filename

$pageNo

public integer fpdi_pdf_parser::$pageNo

Current page number


Methods

__construct()

public fpdi_pdf_parser::__construct (
string $filename
)

The constructor.

Parameters
$filename : string

The source filename

Exceptions

Throws InvalidArgumentException

__destruct()

public pdf_parser::__destruct (
void
): void

Destructor

_findXref()

protected pdf_parser::_findXref (
void
): integer

Find the xref table

Exceptions

Throws Exception

_getPageBox()

protected fpdi_pdf_parser::_getPageBox (
array $page, string $boxIndex, float $k
): array|boolean

Get a boundary box from a page

Array format is same as used by FPDF_TPL.

Parameters
$page : array

a /Page dictionary

$boxIndex : string

Type of box {see $availableBoxes)

$k : float

factor from user space units to points

_getPageBoxes()

protected fpdi_pdf_parser::_getPageBoxes (
array $page, float $k
): array

Get all boxes from /Page dictionary

Parameters
$page : array

A /Page dictionary

$k : float

Scale factor from user space units to points

_getPageContent()

protected fpdi_pdf_parser::_getPageContent (
array $contentRef
): array

Resolve all content objects.

Parameters
$contentRef : array
 

_getPageResources()

protected fpdi_pdf_parser::_getPageResources (
array $obj
): array|boolean

Get page-resources from a /Page dictionary.

Parameters
$obj : array

Array of pdf-data

_getPageRotation()

protected fpdi_pdf_parser::_getPageRotation (
array $obj
): array|bool

Get the rotation value of a page

Parameters
$obj : array

A /Page dictionary

_readPages()

protected fpdi_pdf_parser::_readPages (
array &$pages, array &$result
): void

Read all pages

Parameters
$pages : array

/Pages dictionary

$result : array

The result array

Exceptions

Throws Exception

_readRoot()

protected pdf_parser::_readRoot (
void
): void

Read the /Root dictionary

_readToken()

protected pdf_parser::_readToken (): mixed

Reads a token from the context

Parameters
$c : pdf_context
 

_readValue()

protected pdf_parser::_readValue (
pdf_context &$c [, string $token = null ]
): mixed

Reads a PDF value

Parameters
$c : pdf_context
 
$token : string

A token

Exceptions

Throws Exception

_readXref()

protected pdf_parser::_readXref (
array &$result, integer $offset
): boolean

Read the xref table

Parameters
$result : array

Array of xref table entries

$offset : integer

of xref table

Exceptions

Throws Exception

_unFilterStream()

protected pdf_parser::_unFilterStream (
array $obj
): string

Un-filter a stream object

Parameters
$obj : array
 
Exceptions

Throws Exception

closeFile()

public pdf_parser::closeFile (
void
): void

Close the opened file

getContent()

public fpdi_pdf_parser::getContent (
void
): string

Get content of current page.

If /Contents is an array, the streams are concatenated

getEncryption()

public pdf_parser::getEncryption (
void
): void

Check Trailer for Encryption

Exceptions

Throws Exception

getPageBoxes()

public fpdi_pdf_parser::getPageBoxes (
int $pageNo, float $k
): array

Get all page boundary boxes by page number

Parameters
$pageNo : int

The page number

$k : float

Scale factor from user space units to points

Exceptions

Throws InvalidArgumentException

getPageCount()

public fpdi_pdf_parser::getPageCount (
void
): int

Get page count from source file.

getPageResources()

public fpdi_pdf_parser::getPageResources (
void
): array|boolean

Get page-resources from current page

getPageRotation()

public fpdi_pdf_parser::getPageRotation (
integer $pageNo
): array

Get the page rotation by page number

Parameters
$pageNo : integer
 
Exceptions

Throws InvalidArgumentException

getPdfVersion()

public pdf_parser::getPdfVersion (
void
): string

Get PDF-Version

resolveObject()

public pdf_parser::resolveObject (
array $objSpec
): array|boolean

Resolve an object

Parameters
$objSpec : array

The object-data

Exceptions

Throws Exception

setPageNo()

public fpdi_pdf_parser::setPageNo (
int $pageNo
): void

Set the page number.

Parameters
$pageNo : int

Page number to use

Exceptions

Throws InvalidArgumentException