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
ConstructorDescriptionCreates aPdfXrefTable
which will be used to store xref structure of the pdf document.PdfXrefTable
(int capacity) Creates aPdfXrefTable
which will be used to store xref structure of the pdf document.PdfXrefTable
(int capacity, MemoryLimitsAwareHandler memoryLimitsAwareHandler) Creates aPdfXrefTable
which will be used to store xref structure of the pdf document.PdfXrefTable
(MemoryLimitsAwareHandler memoryLimitsAwareHandler) Creates aPdfXrefTable
which 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 PdfIndirectReference
createNextIndirectReference
(PdfDocument document) Creates next available indirect reference.protected void
freeReference
(PdfIndirectReference reference) Set the reference to free state.get
(int index) Get appropriate reference to indirect object.protected int
Gets the capacity of xref stream.int
Calculates a number of stored references to indirect objects.protected void
setCapacity
(int capacity) Increase capacity of the array of indirect references.void
setMemoryLimitsAwareHandler
(MemoryLimitsAwareHandler memoryLimitsAwareHandler) Sets customMemoryLimitsAwareHandler
.int
size()
Get size of cross-reference table.protected static void
writeKeyInfo
(PdfDocument document) Convenience method to write the fingerprint preceding the trailer.protected void
writeXrefTableAndTrailer
(PdfDocument document, PdfObject fileId, PdfObject crypto) Writes cross reference table and trailer to PDF.
-
Constructor Details
-
PdfXrefTable
public PdfXrefTable()Creates aPdfXrefTable
which will be used to store xref structure of the pdf document. Capacity andMemoryLimitsAwareHandler
instance would be set by default values. -
PdfXrefTable
public PdfXrefTable(int capacity) Creates aPdfXrefTable
which will be used to store xref structure of the pdf document.- Parameters:
-
capacity
- initial capacity of xref table.
-
PdfXrefTable
Creates aPdfXrefTable
which will be used to store xref structure of the pdf document.- Parameters:
-
memoryLimitsAwareHandler
- customMemoryLimitsAwareHandler
to set.
-
PdfXrefTable
Creates aPdfXrefTable
which will be used to store xref structure of the pdf document.- Parameters:
-
capacity
- initial capacity of xref table. -
memoryLimitsAwareHandler
- memoryLimitsAwareHandler customMemoryLimitsAwareHandler
to 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
-
writeKeyInfo
Convenience method to write the fingerprint preceding the trailer. The fingerprint contains information on iText products used in the generation or manipulation of an outputted PDF file.- Parameters:
-
document
- pdfDocument to write the fingerprint to
-
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
-