Pajdeg
0.2.2
Pajdeg
|
PDF XRef (cross reference) table. More...
Files | |
file | PDXTable.h |
Data Structures | |
struct | PDXTable |
Macros | |
#define | PDXTableGetTypeForID(table, id) (PDXType)((table->xrefs)[id*table->width]) |
#define | PDXTableSetTypeForID(table, id, t) *(PDXType*)&((table->xrefs)[id*table->width]) = t |
#define | PDXTableIsIDFree(xtable, id) (PDXTypeFreed == PDXTableGetTypeForID(xtable, id)) |
Typedefs | |
typedef unsigned char | PDXType |
The type representation of an XREF entry. | |
Enumerations | |
enum | PDXFormat { PDXTableFormatText = 0, PDXTableFormatBinary = 1 } |
enum | { PDXTypeFreed = 0, PDXTypeUsed = 1, PDXTypeComp = 2 } |
Functions | |
PDOffset | PDXTableGetOffsetForID (PDXTableRef table, PDInteger obid) |
void | PDXTableSetOffsetForID (PDXTableRef table, PDInteger obid, PDOffset offset) |
PDInteger | PDXTableGetGenForID (PDXTableRef table, PDInteger obid) |
void | PDXTableSetGenForID (PDXTableRef table, PDInteger obid, PDInteger gen) |
PDBool | PDXTableFetchXRefs (PDParserRef parser) |
PDBool | PDXTablePassoverXRefEntry (PDParserRef parser, pd_stack stack, PDBool includeTrailer) |
PDBool | PDXTableInsert (PDParserRef parser) |
PDArrayRef | PDXTableWEntry (PDXTableRef table) |
void | PDXTableSetSizes (PDXTableRef table, unsigned char typeSize, unsigned char offsSize, unsigned char genSize) |
void | PDXTableGrow (PDXTableRef table, PDSize cap) |
PDSize | PDXTableDetermineObjectSize (PDXTableRef table, PDInteger obid) |
Parser | |
typedef struct PDXTable * | PDXTableRef |
PDF XRef (cross reference) table.
struct PDXTable |
PDF XRef (cross reference) table
Data Fields | |
PDInteger | allocx |
PDInteger | obid |
object containing this XRef, if binary (text XRefs are not proper objects) | |
char * | xrefs |
XRef entries stored as a chunk of memory. | |
PDXFormat | format |
Original format of this entry, which can be text (PDF 1.4-) or binary (PDF 1.5+). Internally, there is no difference to how the data is maintained, but Pajdeg will use the same format used in the original in its own output. | |
PDBool | linearized |
If set, unexpected XREF entries in the PDF are silently ignored by the parser. | |
PDSize | cap |
Capacity of the table's xrefs buffer, in entries. | |
PDSize | count |
Number of objects held by the XRef. | |
PDSize | pos |
Byte-wise position in the PDF where the XRef (and subsequent trailer, if text format) begins; reaching this point means the XRef ceases to apply. | |
PDXTableRef | prev |
previous (older) table (mostly debug related) | |
PDXTableRef | next |
next (newer) table (mostly debug related) | |
PDOffset | offsCap |
threshold for offsets using current offsSize | |
PDArrayRef | w |
The W entry, if set. | |
PDInteger * | nextOb |
Array of object id's succeeding the object for the given array index. I.e. if the file has 4 0 obj ... endobj 10 0 obj ... endobj, then next[4] == 10 because object 10 is directly below object 4. This array is NULL until the first call to PDXTableDetermineObjectSize is made. | |
unsigned char | typeSize |
type size, current implementation requires this to be 1 | |
unsigned char | offsSize |
offset size | |
unsigned char | genSize |
gen ID size | |
unsigned char | typeAlign |
type align | |
unsigned char | offsAlign |
offset align | |
unsigned char | genAlign |
gen ID align | |
unsigned char | width |
width of table entry | |
#define PDXTableGetTypeForID | ( | table, | |
id | |||
) | (PDXType)((table->xrefs)[id*table->width]) |
Get the type for the given object.
xrefs | The XREF buffer |
id | The object ID. |
#define PDXTableIsIDFree | ( | xtable, | |
id | |||
) | (PDXTypeFreed == PDXTableGetTypeForID(xtable, id)) |
Get the type for the given object in the table.
xtable | The PDXTableRef instance |
id | The object ID. Set the type for the given object in the table. |
xtable | The PDXTableRef instance |
id | The object ID. |
t | The new type. Get the offset for the given object in the table. |
xtable | The PDXTableRef instance |
id | The object ID. Get the generation number or object stream index for the given object in the table. |
xtable | The PDXTableRef instance |
id | The object ID. Determine if the object with given ID is free. |
xtable | The PDXTableRef instance |
id | The object ID. |
#define PDXTableSetTypeForID | ( | table, | |
id, | |||
t | |||
) | *(PDXType*)&((table->xrefs)[id*table->width]) = t |
Set the type for the given object.
xrefs | The XREF buffer |
id | The object ID. |
t | The new type. |
typedef struct PDXTable* PDXTableRef |
anonymous enum |
An XREF entry's type, which is one of freed (unused), used, or compressed.
Compressed objects are located inside of an object stream.
Enumerator | |
---|---|
PDXTypeFreed |
Freed object ('f' for text format entries) |
PDXTypeUsed |
Used object ('n' for text format entries) |
PDXTypeComp |
Compressed object (no text format equivalent) |
enum PDXFormat |
The XREF format, which can be one of text or binary.
Text XREFs have the appearance
while binary XREFs are binary values stored in an object with /Type /XRefStm.
Enumerator | |
---|---|
PDXTableFormatText |
PDF-1.4 and below, using 20-byte leading zero space delimited entries. |
PDXTableFormatBinary |
PDX-1.5 and forward, using variable width object stream format. |
PDSize PDXTableDetermineObjectSize | ( | PDXTableRef | table, |
PDInteger | obid | ||
) |
Determine the number of bytes between the first character in "<num> <num> obj" of the given object until the first character in the "<num> <num> obj" of the succeeding object in the file.
table | PDX table |
obid | Object whose size should be determined |
PDBool PDXTableFetchXRefs | ( | PDParserRef | parser | ) |
Set the offset for the object with the given ID to the given offset in the XREF table.
xtable | The PDX table instance. |
id | The object ID. |
offs | The new offset. Read a PDFs XREF data by jumping to the end of the file, reading in the startxref value and jumping to every XREF defined via e.g. /Prev, reading the XREFs in as a series with defined domains (by byte). |
startxref
offset) defines whether the output PDF uses text or binary format, regardless of what other entries happen to be formatted as.Takes into account linearized PDFs.
parser | The parser. |
PDInteger PDXTableGetGenForID | ( | PDXTableRef | table, |
PDInteger | obid | ||
) |
Get the generation number or object stream index for the given object.
xrefs | The XREF buffer |
id | The object ID. |
PDOffset PDXTableGetOffsetForID | ( | PDXTableRef | table, |
PDInteger | obid | ||
) |
Get the offset for the object with the given ID in the XREF table.
table | The PDXTable instance. |
obid | The object ID. |
void PDXTableGrow | ( | PDXTableRef | table, |
PDSize | cap | ||
) |
Grow the xref table to accomodate the given cap.
PDBool PDXTableInsert | ( | PDParserRef | parser | ) |
Insert the one and only XREF table.
parser | The parser. |
PDBool PDXTablePassoverXRefEntry | ( | PDParserRef | parser, |
pd_stack | stack, | ||
PDBool | includeTrailer | ||
) |
Pass over an XREF entry in the input PDF.
parser | The parser. |
stack | The XREF header stack scanned in from the PDScanner. |
includeTrailer | Whether the trailer should also be consumed, or whether scanning should end after the XREF offsets. |
void PDXTableSetGenForID | ( | PDXTableRef | table, |
PDInteger | obid, | ||
PDInteger | gen | ||
) |
Debug Set the generation number / object stream index for the given object.
xrefs | The XREF buffer |
id | The object ID. |
gen | The new value. |
void PDXTableSetOffsetForID | ( | PDXTableRef | table, |
PDInteger | obid, | ||
PDOffset | offset | ||
) |
Set the offset for the object with the given ID to the given offset in the XREF table.
table | The PDXTable instance. |
obid | The object ID. |
offset | The new offset. |
void PDXTableSetSizes | ( | PDXTableRef | table, |
unsigned char | typeSize, | ||
unsigned char | offsSize, | ||
unsigned char | genSize | ||
) |
Set the type, offset, and gen sizes for the table.
PDArrayRef PDXTableWEntry | ( | PDXTableRef | table | ) |
Get the W entry for the table.