com.itextpdf.text.pdf
Class PdfWriter.PdfBody

java.lang.Object
  extended by com.itextpdf.text.pdf.PdfWriter.PdfBody
Enclosing class:
PdfWriter

public static class PdfWriter.PdfBody
extends Object

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:
PdfWriter, PdfObject, PdfIndirectObject

Nested Class Summary
static class PdfWriter.PdfBody.PdfCrossReference
          PdfCrossReference is an entry in the PDF Cross-Reference table.
 
Field Summary
protected  int currentObjNum
           
protected  ByteBuffer index
           
protected  int numObj
           
protected  long position
          the current byte position in the body.
protected  int refnum
           
protected  ByteBuffer streamObjects
           
protected  PdfWriter writer
           
protected  TreeSet<PdfWriter.PdfBody.PdfCrossReference> xrefs
          array containing the cross-reference table of the normal objects.
 
Constructor Summary
protected PdfWriter.PdfBody(PdfWriter writer)
          Constructs a new PdfBody.
 
Method Summary
protected  PdfIndirectObject add(PdfObject object, int refNumber, int generation, boolean inObjStm)
           
protected  PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj, int nObj)
           
 void flushObjStm()
           
protected  int getIndirectReferenceNumber()
           
 PdfIndirectReference getPdfIndirectReference()
          Gets a PdfIndirectReference for an object that will be created in the future.
 long offset()
          Returns the offset of the Cross-Reference table.
 int size()
          Returns the total number of objects contained in the CrossReferenceTable of this Body.
protected  void write(PdfIndirectObject indirect, int refNumber)
           
protected  void write(PdfIndirectObject indirect, int refNumber, int generation)
           
 void writeCrossReferenceTable(OutputStream os, PdfIndirectReference root, PdfIndirectReference info, PdfIndirectReference encryption, PdfObject fileID, long prevxref)
          Returns the CrossReferenceTable of the Body.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xrefs

protected final TreeSet<PdfWriter.PdfBody.PdfCrossReference> xrefs
array containing the cross-reference table of the normal objects.


refnum

protected int refnum

position

protected long position
the current byte position in the body.


writer

protected final PdfWriter writer

index

protected ByteBuffer index

streamObjects

protected ByteBuffer streamObjects

currentObjNum

protected int currentObjNum

numObj

protected int numObj
Constructor Detail

PdfWriter.PdfBody

protected PdfWriter.PdfBody(PdfWriter writer)
Constructs a new PdfBody.

Parameters:
writer -
Method Detail

addToObjStm

protected PdfWriter.PdfBody.PdfCrossReference addToObjStm(PdfObject obj,
                                                          int nObj)
                                                   throws IOException
Throws:
IOException

flushObjStm

public void flushObjStm()
                 throws IOException
Throws:
IOException

getPdfIndirectReference

public PdfIndirectReference getPdfIndirectReference()
Gets a PdfIndirectReference for an object that will be created in the future.

Returns:
a PdfIndirectReference

getIndirectReferenceNumber

protected int getIndirectReferenceNumber()

add

protected PdfIndirectObject add(PdfObject object,
                                int refNumber,
                                int generation,
                                boolean inObjStm)
                         throws IOException
Throws:
IOException

write

protected void write(PdfIndirectObject indirect,
                     int refNumber)
              throws IOException
Throws:
IOException

write

protected void write(PdfIndirectObject indirect,
                     int refNumber,
                     int generation)
              throws IOException
Throws:
IOException

offset

public long offset()
Returns the offset of the Cross-Reference table.

Returns:
an offset

size

public int size()
Returns the total number of objects contained in the CrossReferenceTable of this Body.

Returns:
a number of objects

writeCrossReferenceTable

public void writeCrossReferenceTable(OutputStream os,
                                     PdfIndirectReference root,
                                     PdfIndirectReference info,
                                     PdfIndirectReference encryption,
                                     PdfObject fileID,
                                     long prevxref)
                              throws IOException
Returns the CrossReferenceTable of the Body.

Parameters:
os -
root -
info -
encryption -
fileID -
prevxref -
Throws:
IOException


Copyright © 2013. All Rights Reserved.