|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.PDFReader
public final class PDFReader
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.
Parallel Operation note: Since 2.10 this class
will use multiple threads in parallel where possible. The number of threads
defaults to the available processors
but can
be controlled by setting the Threads
property
(typically by setting the
org.faceless.pdf2.Threads
System property
)
to the number of threads required. Each thread requires only minimal heap so it's
safe to run as many as you like.
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,
EncryptionHandler[] encryptlist,
float[] progress)
Read a PDF from the specified File. |
|
PDFReader(File in,
EncryptionHandler encrypt,
float[] progress)
Read a PDF from the specified InputStream. |
|
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,
EncryptionHandler[] encryptlist,
float[] progress)
Read a PDF from the specified InputStream. |
|
PDFReader(InputStream in,
EncryptionHandler encrypt,
float[] progress)
Read a PDF from the specified InputStream. |
|
PDFReader(InputStream in,
String password)
Read an encrypted PDF from the specified InputStream. |
Method Summary | |
---|---|
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 |
---|
public PDFReader(File in) throws IOException
PDFReader(InputStream)
constructor, but takes slightly longer to run.
in
- the File to read from
IOException
public PDFReader(File in, String password) throws IOException
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.
in
- the File to read frompassword
- the password needed to open the file
IOException
public PDFReader(InputStream in) throws IOException
in
- the stream to read from
IOException
public PDFReader(InputStream in, String password) throws IOException
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
in
- the stream to read frompassword
- the password needed to open the file
IOException
public PDFReader(InputStream in, EncryptionHandler encrypt) throws IOException
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
in
- the stream to read fromencrypt
- the EncryptionHandler to use to decrypt the document, or null if no encryption handler is required
IOException
public PDFReader(File in, EncryptionHandler encrypt) throws IOException
EncryptionHandler
to be used to read the document.
It also uses less memory than the PDFReader(File, EncryptionHandler)
constructor.
in
- the stream to read fromencrypt
- the EncryptionHandler to use to decrypt the document, or null if no encryption handler is required
IOException
public PDFReader(InputStream in, EncryptionHandler encrypt, float[] progress) throws IOException
in
- the stream to read fromencrypt
- the EncryptionHandler to decrypt the PDF, or null
if the PDF is unencryptedprogress
- an optional array one item long, the first parameter of which will by updated throughout the read
IOException
public PDFReader(File in, EncryptionHandler encrypt, float[] progress) throws IOException
in
- the File to read fromencrypt
- the EncryptionHandler to decrypt the PDF, or null
if the PDF is unencryptedprogress
- an optional array one item long, the first parameter of which will by updated throughout the read
IOException
public PDFReader(InputStream in, EncryptionHandler[] encryptlist, float[] progress) throws IOException
in
- the stream to read fromencryptlist
- the list of EncryptionHandlers to use to try and decrypt the PDFprogress
- an optional array one item long, the first parameter of which will by updated throughout the read
IOException
public PDFReader(File in, EncryptionHandler[] encryptlist, float[] progress) throws IOException
in
- the File to read fromencryptlist
- the list of EncryptionHandlers to use to try and decrypt the PDFprogress
- an optional array one item long, the first parameter of which will by updated throughout the read
IOException
Method Detail |
---|
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.
This method was modified slightly in release 2.7 so that the original file now counts as a revision - in other words, this method always returns at least "1".
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |