|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.icepdf.core.pobjects.Dictionary
org.icepdf.core.pobjects.PTrailer
public class PTrailer
The trailer of a PDF file enables an application reading the file to quickly find the cross-reference table and certain special objects. Applications should read a PDF file from its end. The last line of the file contains only the end-of-file marker, %%EOF.
A document can have more then one trailer reference. It is important to use the addTrailer() method if a subsequent trailer is found, or the addPreviousTrailer() method if a previous trailer is found, depending on if the PDF file is being read linearly, or via random access seeking.
If the Prev key entry is present then the document has more then one cross-reference section. There is a numerical value, which is typically associated with the trailer, that comes after startxref, and before %%EOF. It is byte offset from the beginning of the file to the beginning of the last cross-reference section.
In a regular PDF, it's the address of the current xref table. In a linearized PDF, it's the address of the xref table at the file beginning, or zero. In an updated PDF, it's the address of the current xref table. In all cases, the LastCrossReferenceSection field, at the end of the PDF file, points to the byte offset from the beginning of the file, of the "last" xref section, which means the xref section with the highest precedence. For each xref section, its following trailer section has a Prev field, which points to the byte offset from the beginning of the file, of the xref section with one less degree of precedence.
| Field Summary |
|---|
| Fields inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
entries, inited, isDeleted, isNew, library, SUBTYPE_KEY, TYPE_KEY |
| Constructor Summary | |
|---|---|
PTrailer(Library library,
java.util.Hashtable dictionary,
CrossReference xrefTable,
CrossReference xrefStream)
Create a new PTrailer object |
|
| Method Summary | |
|---|---|
protected void |
addNextTrailer(PTrailer nextTrailer)
Add the trailer dictionary to the current trailer object's dictionary. |
protected void |
addPreviousTrailer(PTrailer previousTrailer)
|
protected CrossReference |
getCrossReferenceStream()
Gets the cross reference stream. |
protected CrossReference |
getCrossReferenceTable()
Gets the cross reference table. |
java.util.Hashtable |
getDictionary()
Get the trailer object's dictionary. |
java.util.Hashtable |
getEncrypt()
The document's encryption dictionary Required : if document is encrypted; PDF 1.1 |
java.util.Vector |
getID()
A vector of two strings constituting a file identifier Optional : PDF 1.1. |
PInfo |
getInfo()
The document's information dictionary Optional : must be an indirect reference. |
int |
getNumberOfObjects()
Gets the total number of entries in the file's cross-reference table, as defined by the combination of the original section and all updated sections. |
long |
getPosition()
|
long |
getPrev()
Gets the byte offset from the beginning of the file to the beginning of the previous cross-reference section. |
protected CrossReference |
getPrimaryCrossReference()
Depending on if the PDF file is version 1.4 or before, or 1.5 or after, it may have a cross reference table, or cross reference stream, or both. |
Catalog |
getRootCatalog()
Gets the Catalog entry for this PDF document. |
Reference |
getRootCatalogReference()
Gets the catalog reference for the PDF document contained in the file. |
protected void |
loadXRefStmIfApplicable()
|
protected void |
onDemandLoadAndSetupPreviousTrailer()
|
void |
setPosition(long pos)
After this PTrailer is parsed, we store it's location within the PDF here, for future use. |
java.lang.String |
toString()
Returns a summary of the PTrailer dictionary values. |
| Methods inherited from class org.icepdf.core.pobjects.Dictionary |
|---|
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getObject, getPObjectReference, init, isDeleted, isNew, setDeleted, setNew, setPObjectReference |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PTrailer(Library library,
java.util.Hashtable dictionary,
CrossReference xrefTable,
CrossReference xrefStream)
dictionary - dictionary associated with the trailer| Method Detail |
|---|
public int getNumberOfObjects()
public long getPrev()
protected CrossReference getPrimaryCrossReference()
protected CrossReference getCrossReferenceTable()
protected CrossReference getCrossReferenceStream()
public Reference getRootCatalogReference()
public Catalog getRootCatalog()
public java.util.Hashtable getEncrypt()
public PInfo getInfo()
public java.util.Vector getID()
public long getPosition()
public void setPosition(long pos)
protected void addNextTrailer(PTrailer nextTrailer)
nextTrailer - document trailer objectprotected void addPreviousTrailer(PTrailer previousTrailer)
protected void onDemandLoadAndSetupPreviousTrailer()
protected void loadXRefStmIfApplicable()
public java.util.Hashtable getDictionary()
public java.lang.String toString()
toString in class Dictionary
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||