org.faceless.pdf2
Class PDFReader

java.lang.Object
  extended byorg.faceless.pdf2.PDFReader

public final class PDFReader
extends Object

The PDFReader class adds the ability to load an existing PDF to the library. Note that this class is part of the "Extended Edition" of the library - although it's supplied with the package an "extended edition" license must be purchased to activate this class.

There are almost no public methods in this class - the only use for a PDFReader object is as a parameter the appropriate PDF.PDF(PDFReader) constructor.

The one exception to this is the getNumberOfRevisions() method, added in release 1.2.1. In order to explain this method it's necessary to go into a little detail about the file structure of a PDF document.

A PDF file may sometimes contain different versions of itself in the one file. These "revisions" show how the state of the document has changed over time. For most purposes this information isn't terribly useful - prior to version 1.2.1 only the latest revision was used - but they do play an important role when using Digital Signatures.

When a signature is applied to the file, the current revision is locked and any further changes to the file result in a new revision being made. With Adobe Acrobat several signatures can be applied, each one of which will result in a new revision.

It's important to remember that changes can be made a document after it's been signed, and provided that they're made in a new revision, the signature won't be invalidated - but the signature won't cover the whole of the document either. When validating a signed document this needs to be taken into account

Another interesting feature of revisions is that with a document with multiple revisions, it's possible to "roll back" to a previous version. This is done by passing in a specific revision number to the PDF.PDF(PDFReader,int) constructor - the PDF will be created as it was at the specified revision.

Finally, although a PDF document containing multiple revisions can be read, when it's written out it will be "flattened" into a single revision.

Since:
1.1.12

Constructor Summary
PDFReader(File in)
          Read an unencrypted PDF from the specified file.
PDFReader(File in, EncryptionHandler encrypt)
          Read an encrypted PDF from the specified File.
PDFReader(File in, String password)
          Read an encrypted PDF from the specified File.
PDFReader(InputStream in)
          Read an encrypted PDF from the specified InputStream.
PDFReader(InputStream in, EncryptionHandler encrypt)
          Read an encrypted PDF from the specified InputStream.
PDFReader(InputStream in, String password)
          Read an encrypted PDF from the specified InputStream.
 
Method Summary
 void finalize()
           
 int getNumberOfRevisions()
          Return the number of revisions that have been made to this file.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFReader

public PDFReader(File in)
          throws IOException
Read an unencrypted PDF from the specified file. This constructor requires less memory than than the PDFReader(InputStream) constructor, but takes slightly longer to run.

Parameters:
in - the File to read from

PDFReader

public PDFReader(File in,
                 String password)
          throws IOException
Read an encrypted PDF from the specified File. The PDF is encrypted using the StandardEncryptionHandler and the specified password. This constructor is identical to calling new PDFReader(in, new StandardEncryptionHandler(password)), and it requires less memory than than the PDFReader(InputStream,String) constructor, but takes slightly longer to run.

Parameters:
in - the File to read from
password - the password needed to open the file

PDFReader

public PDFReader(InputStream in)
          throws IOException
Read an encrypted PDF from the specified InputStream. The InputStream is not closed by this method, but should be closed by the user

Parameters:
in - the stream to read from

PDFReader

public PDFReader(InputStream in,
                 String password)
          throws IOException
Read an encrypted PDF from the specified InputStream. The PDF is encrypted using the StandardEncryptionHandler and the specified password. This method is identical to calling new PDFReader(in, new StandardEncryptionHandler(password)). Please note the InputStream is not closed by this method, but should be closed by the user

Parameters:
in - the stream to read from
password - the password needed to open the file

PDFReader

public PDFReader(InputStream in,
                 EncryptionHandler encrypt)
          throws IOException
Read an encrypted PDF from the specified InputStream. This constructor allows for a non-standard EncryptionHandler to be used to read the document. Please note the InputStream is not closed by this method, but should be closed by the user

Parameters:
in - the stream to read from
encrypt - the EncryptioHandler to use to decrypt the document
Since:
2.0

PDFReader

public PDFReader(File in,
                 EncryptionHandler encrypt)
          throws IOException
Read an encrypted PDF from the specified File. This constructor allows for a non-standard EncryptionHandler to be used to read the document. It also uses less memory than the PDFReader(File, EncryptionHandler) constructor.

Parameters:
in - the stream to read from
encrypt - the EncryptioHandler to use to decrypt the document
Since:
2.2.5
Method Detail

getNumberOfRevisions

public int getNumberOfRevisions()
Return the number of revisions that have been made to this file. Earlier revisions of a PDF file can be loaded by passing a revision number less than this value to the appropriate PDF.PDF(PDFReader,int) constructor.

Since:
1.2.1

finalize

public void finalize()


Copyright © 2001-2004 Big Faceless Organization