Abstract base class for Image file parsers.
Provides a library of methods to quickly navigate and extract various data types (signed and unsigned integers, floating- and fixed-point numbers, strings, etc.) from the file.
File access is managed via a Zend_Pdf_FileParserDataSource object. This allows the same parser code to work with many different data sources: in-memory objects, filesystem files, etc.
package | Zend_Pdf |
---|---|
subpackage | FileParser |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
inherited_from | \Zend_Pdf_FileParser_Image |
__construct(\Zend_Pdf_FileParserDataSource $dataSource)
Verifies that the data source has been properly initialized.
\Zend_Pdf_FileParserDataSource
\Zend_Pdf_Exception |
---|
__destruct()
Discards the data source object.
getBitDepth()
getColorSpace()
getCompressionStrategy()
getDataSource() : \Zend_Pdf_FileParserDataSource
\Zend_Pdf_FileParserDataSource
getHeight()
getInterlacingMode()
getOffset()
getPaethFilter()
getRawImageData()
getRawPaletteData()
getRawTransparencyData()
getSize()
getWidth()
isBitSet(integer $bit, integer $bitField) : boolean
integer
Bit number to test (i.e. - 0-31)
integer
boolean
isParsed() : boolean
boolean
isScreened() : boolean
boolean
moveToOffset(integer $offset)
integer
Destination byte offset.
\Zend_Pdf_Exception |
---|
parse()
\Zend_Pdf_Exception |
---|
parse()
Must set $this->_isParsed to true if successful.
\Zend_Pdf_Exception |
---|
readBytes(integer $byteCount) : string
integer
Number of bytes to read.
\Zend_Pdf_Exception |
---|
string
readFixed(integer $mantissaBits, integer $fractionBits, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : float
Common fixed-point sizes are 2.14 and 16.16.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Number of bits in the mantissa
integer
Number of bits in the fraction
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
float
readInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : integer
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Size of integer in bytes: 1-4
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
integer
readStringMacRoman(integer $byteCount, string $characterSet = ''
) : string
You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
integer
Number of bytes (characters) to return.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
\Zend_Pdf_Exception |
---|
string
readStringPascal(string $characterSet= ''
, integer $lengthBytes= 1
) : string
The length of the Pascal string is determined by reading the length bytes which preceed the character data. You must supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
integer
(optional) Number of bytes that make up the length. Default is 1.
\Zend_Pdf_Exception |
---|
string
readStringUTF16(integer $byteCount, integer $byteOrder= \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
, string $characterSet= ''
) : string
The byte order of the UTF-16 string must be specified. You must also supply the desired resulting character set.
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
todo | Consider changing $byteCount to a character count. They are not always equivalent (in the case of surrogates). |
---|---|
todo | Make $byteOrder optional if there is a byte-order mark (BOM) in the string being extracted. |
integer
Number of bytes (characters * 2) to return.
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
string
(optional) Desired resulting character set. You may use any character set supported by {@link iconv()}. If omitted, uses 'current locale'.
\Zend_Pdf_Exception |
---|
string
readUInt(integer $size, integer $byteOrder = \Zend_Pdf_FileParser::BYTE_ORDER_BIG_ENDIAN
) : integer
Advances the offset by the number of bytes read. Throws an exception if an error occurs.
NOTE: If you ask for a 4-byte unsigned integer on a 32-bit machine, the resulting value WILL BE SIGNED because PHP uses signed integers internally for everything. To guarantee portability, be sure to use bitwise operators operators on large unsigned integers!
integer
Size of integer in bytes: 1-4
integer
(optional) Big- or little-endian byte order. Use the BYTEORDER constants defined in {@link Zend_Pdf_FileParser}. If omitted, uses big-endian.
\Zend_Pdf_Exception |
---|
integer
screen()
\Zend_Pdf_Exception |
---|
screen()
Must set $this->_isScreened to true if successful.
\Zend_Pdf_Exception |
---|
skipBytes(integer $byteCount)
integer
Number of bytes to skip.
\Zend_Pdf_Exception |
---|
_checkSignature()
_parseChunks()
_parseIDATChunk($chunkOffset, $chunkLength)
_parseIHDRChunk()
_parsePLTEChunk($chunkOffset, $chunkLength)
_parseSignature()
_parseTRNSChunk($chunkOffset, $chunkLength)
$_bits
$_color
$_compression
$_dataSource : \Zend_Pdf_FileParserDataSource
null
$_height
$_imageData
$_interlacing
$_isPNG
$_isParsed : boolean
false
$_isScreened : boolean
false
$_paletteData
$_preFilter
$_transparencyData
$_width
$imageType : integer
BYTE_ORDER_BIG_ENDIAN = 1
BYTE_ORDER_LITTLE_ENDIAN = 0