Package com.lowagie.text.pdf
Class PdfWriter.PdfBody
java.lang.Object
com.lowagie.text.pdf.PdfWriter.PdfBody
- Enclosing class:
- PdfWriter
This class generates the structure of a PDF document.
This class covers the third section of Chapter 5 in the 'Portable Document Format Reference Manual version 1.3' (page 55-60). It contains the body of a PDF document (section 5.14) and it can also generate a Cross-reference Table (section 5.15).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPdfCrossReferenceis an entry in the PDF Cross-Reference table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate ByteBufferprivate intprivate static final intprivate longthe current byte position in the body.private intprivate ByteBufferprivate final PdfWriterprivate final TreeSet<PdfWriter.PdfBody.PdfCrossReference>array containing the cross-reference table of the normal objects. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) PdfIndirectObjectAdds aPdfObjectto the body.(package private) PdfIndirectObject(package private) PdfIndirectObject(package private) PdfIndirectObject(package private) PdfIndirectObjectadd(PdfObject object, PdfIndirectReference ref) Adds aPdfObjectto the body given an already existing PdfIndirectReference.(package private) PdfIndirectObjectadd(PdfObject object, PdfIndirectReference ref, boolean inObjStm) addToObjStm(PdfObject obj, int nObj) private void(package private) int(package private) PdfIndirectReferenceGets a PdfIndirectReference for an object that will be created in the future.(package private) longoffset()Returns the offset of the Cross-Reference table.(package private) voidsetRefnum(int refnum) (package private) intsize()Returns the total number of objects contained in the CrossReferenceTable of thisBody.(package private) voidwriteCrossReferenceTable(OutputStream os, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, int prevxref) Returns the CrossReferenceTable of theBody.
-
Field Details
-
OBJSINSTREAM
private static final int OBJSINSTREAM- See Also:
-
xrefs
array containing the cross-reference table of the normal objects. -
writer
-
refnum
private int refnum -
position
private long positionthe current byte position in the body. -
index
-
streamObjects
-
currentObjNum
private int currentObjNum -
numObj
private int numObj
-
-
Constructor Details
-
PdfBody
PdfBody(PdfWriter writer) Constructs a newPdfBody.- Parameters:
writer-
-
-
Method Details
-
setRefnum
void setRefnum(int refnum) -
addToObjStm
- Throws:
IOException
-
flushObjStm
- Throws:
IOException
-
add
Adds aPdfObjectto the body.This methods creates a
PdfIndirectObjectwith a certain number, containing the givenPdfObject. It also adds aPdfCrossReferencefor this object to anArrayListthat will be used to build the Cross-reference Table.- Parameters:
object- aPdfObject- Returns:
- a
PdfIndirectObject - Throws:
IOException
-
add
- Throws:
IOException
-
getPdfIndirectReference
PdfIndirectReference getPdfIndirectReference()Gets a PdfIndirectReference for an object that will be created in the future.- Returns:
- a PdfIndirectReference
-
getIndirectReferenceNumber
int getIndirectReferenceNumber() -
add
Adds aPdfObjectto the body given an already existing PdfIndirectReference.This methods creates a
PdfIndirectObjectwith the number given byref, containing the givenPdfObject. It also adds aPdfCrossReferencefor this object to anArrayListthat will be used to build the Cross-reference Table.- Parameters:
object- aPdfObjectref- aPdfIndirectReference- Returns:
- a
PdfIndirectObject - Throws:
IOException
-
add
PdfIndirectObject add(PdfObject object, PdfIndirectReference ref, boolean inObjStm) throws IOException - Throws:
IOException
-
add
- Throws:
IOException
-
add
- Throws:
IOException
-
offset
long offset()Returns the offset of the Cross-Reference table.- Returns:
- an offset
-
size
int size()Returns the total number of objects contained in the CrossReferenceTable of thisBody.- Returns:
- a number of objects
-
writeCrossReferenceTable
void writeCrossReferenceTable(OutputStream os, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, int prevxref) throws IOException Returns the CrossReferenceTable of theBody.- Parameters:
os-root-info-encryption-fileID-prevxref-- Throws:
IOException
-