Package pdf
Class PDFOutput
- java.lang.Object
-
- pdf.PDFOutput
-
public class PDFOutput extends java.lang.ObjectThis class is used to write a PDF document. It acts as a wrapper to a real OutputStream, but is necessary for certain internal PDF structures to be built correctly.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.ByteArrayOutputStreambaosThis is the OutputStream used to write each object to.protected PDFObjectinfoIDThis is used to track the /Info object (info)protected intoffsetThis is the current position within the streamprotected java.util.Vector<PDFXref>offsetsThis vector contains offsets of each objectprotected java.io.OutputStreamosThis is the actual OutputStream used to write to.protected PDFObjectrootIDThis is used to track the /Root object (catalog)
-
Constructor Summary
Constructors Constructor Description PDFOutput(java.io.OutputStream os)This creates a PDF OutputStream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidclose()This closes the Stream, writing the xref tableprotected voidwrite(PDFObject ob)This method writes a PDFObject to the stream.protected voidwriteblock(int firstid, java.util.Vector<PDFXref> block)Writes a block of references to the PDF file
-
-
-
Field Detail
-
os
protected java.io.OutputStream os
This is the actual OutputStream used to write to.
-
baos
protected java.io.ByteArrayOutputStream baos
This is the OutputStream used to write each object to.We use a separate stream, because we need to keep track of how many bytes have been written for each object for the xref table to work correctly.
-
offset
protected int offset
This is the current position within the stream
-
offsets
protected java.util.Vector<PDFXref> offsets
This vector contains offsets of each object
-
rootID
protected PDFObject rootID
This is used to track the /Root object (catalog)
-
infoID
protected PDFObject infoID
This is used to track the /Info object (info)
-
-
Method Detail
-
write
protected void write(PDFObject ob) throws java.io.IOException
This method writes a PDFObject to the stream.- Parameters:
ob- PDFObject Obeject to write- Throws:
java.io.IOException- on error
-
close
protected void close() throws java.io.IOExceptionThis closes the Stream, writing the xref table- Throws:
java.io.IOException
-
writeblock
protected void writeblock(int firstid, java.util.Vector<PDFXref> block) throws java.io.IOExceptionWrites a block of references to the PDF file- Parameters:
firstid- ID of the first reference in this blockblock- Vector containing the references in this block- Throws:
java.io.IOException- on write error
-
-