PJX

com.etymon.pjx
Class PdfWriter

java.lang.Object
  extended bycom.etymon.pjx.PdfWriter

public final class PdfWriter
extends java.lang.Object

Writes a PDF document. Most applications do not need to access methods in this class but should instead go through PdfManager. This class is synchronized.


Constructor Summary
PdfWriter(java.io.File pdfFile)
          Creates a writer for a PDF document to be written to a file.
PdfWriter(java.io.OutputStream outputStream)
          Creates a writer for a PDF document to be written to an OutputStream.
 
Method Summary
 void close()
          Closes the PDF document and releases any system resources associated with it.
 long writeCopy(PdfReader reader)
          Writes an entire PDF document stream to the output PDF document.
 int writeHeader()
          Writes a PDF header to the document.
 int writeObject(PdfObject obj, int number, int generation)
          Writes a PDF object to the document as an indirect object.
 int writeObjectIndirect(PdfObject obj, int number, int generation)
          Writes a PDF object to the document as an indirect object.
 int writeXrefTable(XrefTable xt, long startxref)
          Writes a cross-reference table (and associated trailer) to the document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfWriter

public PdfWriter(java.io.File pdfFile)
          throws java.io.IOException
Creates a writer for a PDF document to be written to a file. If the file exists, this constructor overwrites it.

Parameters:
pdfFile - the file to write the PDF document to.
Throws:
java.io.IOException

PdfWriter

public PdfWriter(java.io.OutputStream outputStream)
          throws java.io.IOException
Creates a writer for a PDF document to be written to an OutputStream. The calling method should ensure that the specified stream is a buffered stream, if applicable.

Parameters:
outputStream - the stream to write the PDF document to.
Throws:
java.io.IOException
Method Detail

close

public void close()
           throws java.io.IOException
Closes the PDF document and releases any system resources associated with it.

Throws:
java.io.IOException

writeCopy

public long writeCopy(PdfReader reader)
               throws java.io.IOException
Writes an entire PDF document stream to the output PDF document. This is used for incremental update.

Parameters:
reader - the source of the PDF document stream.
Returns:
the number of bytes written.
Throws:
java.io.IOException

writeHeader

public int writeHeader()
                throws java.io.IOException
Writes a PDF header to the document.

Returns:
the number of bytes written.
Throws:
java.io.IOException

writeObject

public int writeObject(PdfObject obj,
                       int number,
                       int generation)
                throws java.io.IOException
Writes a PDF object to the document as an indirect object.

Parameters:
obj - the object to write.
number - the object number.
generation - the generation number.
Returns:
the number of bytes written.
Throws:
java.io.IOException

writeObjectIndirect

public int writeObjectIndirect(PdfObject obj,
                               int number,
                               int generation)
                        throws java.io.IOException
Writes a PDF object to the document as an indirect object.

Parameters:
obj - the object to write.
number - the object number.
generation - the generation number.
Returns:
the number of bytes written.
Throws:
java.io.IOException

writeXrefTable

public int writeXrefTable(XrefTable xt,
                          long startxref)
                   throws java.io.IOException
Writes a cross-reference table (and associated trailer) to the document.

Parameters:
xt - the cross-reference table.
startxref - the file offset of the beginning of the cross-reference table.
Returns:
the number of bytes written.
Throws:
java.io.IOException

Copyright © 1998-2004 Etymon Systems, Inc.

The PDF data structures, operators, and specification are
Copyright © 1985-2004 Adobe Systems Incorporated.