Package com.itextpdf.kernel.pdf
Class PdfXrefTable
java.lang.Object
com.itextpdf.kernel.pdf.PdfXrefTable
A representation of a cross-referenced table of a PDF document.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates aPdfXrefTablewhich will be used to store xref structure of the pdf document.PdfXrefTable(int capacity) Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document.PdfXrefTable(int capacity, MemoryLimitsAwareHandler memoryLimitsAwareHandler) Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document.PdfXrefTable(MemoryLimitsAwareHandler memoryLimitsAwareHandler) Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document. -
Method Summary
Modifier and TypeMethodDescriptionadd(PdfIndirectReference reference) Adds indirect reference to list of indirect objects.protected PdfIndirectReferencecreateNextIndirectReference(PdfDocument document) Creates next available indirect reference.protected voidfreeReference(PdfIndirectReference reference) Set the reference to free state.get(int index) Get appropriate reference to indirect object.protected intGets the capacity of xref stream.intCalculates a number of stored references to indirect objects.protected voidsetCapacity(int capacity) Increase capacity of the array of indirect references.voidsetMemoryLimitsAwareHandler(MemoryLimitsAwareHandler memoryLimitsAwareHandler) Sets customMemoryLimitsAwareHandler.intsize()Get size of cross-reference table.protected voidwriteXrefTableAndTrailer(PdfDocument document, PdfObject fileId, PdfObject crypto) Writes cross reference table and trailer to PDF.
-
Constructor Details
-
PdfXrefTable
public PdfXrefTable()Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document. Capacity andMemoryLimitsAwareHandlerinstance would be set by default values. -
PdfXrefTable
public PdfXrefTable(int capacity) Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document.- Parameters:
-
capacity- initial capacity of xref table.
-
PdfXrefTable
Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document.- Parameters:
-
memoryLimitsAwareHandler- customMemoryLimitsAwareHandlerto set.
-
PdfXrefTable
Creates aPdfXrefTablewhich will be used to store xref structure of the pdf document.- Parameters:
-
capacity- initial capacity of xref table. -
memoryLimitsAwareHandler- memoryLimitsAwareHandler customMemoryLimitsAwareHandlerto set.
-
-
Method Details
-
setMemoryLimitsAwareHandler
Sets customMemoryLimitsAwareHandler.- Parameters:
-
memoryLimitsAwareHandler- instance to set.
-
add
Adds indirect reference to list of indirect objects.- Parameters:
-
reference- indirect reference to add. - Returns:
- reference from param
-
size
public int size()Get size of cross-reference table.- Returns:
- amount of lines including zero-object
-
getCountOfIndirectObjects
public int getCountOfIndirectObjects()Calculates a number of stored references to indirect objects.- Returns:
- number of indirect objects
-
get
Get appropriate reference to indirect object.- Parameters:
-
index- is the index of required object - Returns:
- reference to object with the provided index
-
createNextIndirectReference
Creates next available indirect reference.- Parameters:
-
document- is the currentdocument - Returns:
- created indirect reference.
-
freeReference
Set the reference to free state.- Parameters:
-
reference- is a reference to be updated.
-
getCapacity
protected int getCapacity()Gets the capacity of xref stream.- Returns:
- the capacity of xref stream.
-
setCapacity
protected void setCapacity(int capacity) Increase capacity of the array of indirect references.- Parameters:
-
capacity- is a new capacity to set
-
writeXrefTableAndTrailer
protected void writeXrefTableAndTrailer(PdfDocument document, PdfObject fileId, PdfObject crypto) throws IOException Writes cross reference table and trailer to PDF.- Parameters:
-
document- is the currentdocument -
fileId- field id -
crypto- pdf encryption - Throws:
-
IOException- if any I/O error occurs
-