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 class
PdfCrossReference
is an entry in the PDF Cross-Reference table. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private ByteBuffer
private int
private static final int
private long
the current byte position in the body.private int
private ByteBuffer
private final PdfWriter
private 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) PdfIndirectObject
Adds aPdfObject
to the body.(package private) PdfIndirectObject
(package private) PdfIndirectObject
(package private) PdfIndirectObject
(package private) PdfIndirectObject
add
(PdfObject object, PdfIndirectReference ref) Adds aPdfObject
to the body given an already existing PdfIndirectReference.(package private) PdfIndirectObject
add
(PdfObject object, PdfIndirectReference ref, boolean inObjStm) addToObjStm
(PdfObject obj, int nObj) private void
(package private) int
(package private) PdfIndirectReference
Gets a PdfIndirectReference for an object that will be created in the future.(package private) long
offset()
Returns the offset of the Cross-Reference table.(package private) void
setRefnum
(int refnum) (package private) int
size()
Returns the total number of objects contained in the CrossReferenceTable of thisBody
.(package private) void
writeCrossReferenceTable
(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 aPdfObject
to the body.This methods creates a
PdfIndirectObject
with a certain number, containing the givenPdfObject
. It also adds aPdfCrossReference
for this object to anArrayList
that 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 aPdfObject
to the body given an already existing PdfIndirectReference.This methods creates a
PdfIndirectObject
with the number given byref
, containing the givenPdfObject
. It also adds aPdfCrossReference
for this object to anArrayList
that will be used to build the Cross-reference Table.- Parameters:
object
- aPdfObject
ref
- 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
-