📄 pdfreader.java
字号:
// $Id: PDFReader.java,v 1.4 2003/11/04 17:16:01 mike Exp $package org.faceless.pdf;import java.io.*;/** * <p> * The <tt>PDFReader</tt> class adds the ability to load an existing PDF to the * library. <b>Note that this class is part of the "Extended Edition" of the * library</b> - although it's supplied with the package an "extended edition" * license must be purchased to activate this class. * </p><p> * There are almost no public methods in this class - the only use for a * <tt>PDFReader</tt> object is as a parameter the appropriate {@link PDF} * constructor. * </p><p> * The one exception to this is the {link #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 * </p><p> * 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. * </p><p> * 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. * </p><p> * It's important to remember that changes can be made a document <i>after</i> * 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. When validating a signed document this needs to be taken * into account * </p><p> * 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 {@link PDF#PDF(PDFReader,int)} * constructor - the PDF will be created as it was at the specified revision. * </p><p> * Finally, although a PDF document containing multiple revisions can be read, * when it's written out it will be "flattened" into a single revision. * </p> * @version $Revision: 1.4 $ */public class PDFReader extends PeeredObject{ final org.faceless.pdf2.PDFReader reader; Object getPeer() { return reader; } /** * Parse a PDF from the specified <tt>InputStream</tt> * @param pdfstream the InputStream containing the PDF file to parse */ public PDFReader(InputStream pdfstream) throws IOException { reader = new org.faceless.pdf2.PDFReader(pdfstream); } /** * Parse a PDF from the specified <tt>InputStream</tt> * @param pdfstream the InputStream containing the PDF file to parse * @param password the password required to open this document */ public PDFReader(InputStream pdfstream, String password) throws IOException { reader = new org.faceless.pdf2.PDFReader(pdfstream, password); } /** * Parse a PDF from the specified file. This method reads the * PDF directly from the disk, which is slower but uses less memory. * @param file the PDF file to parse */ public PDFReader(File file) throws IOException { reader = new org.faceless.pdf2.PDFReader(file); } /** * Parse a PDF from the specified file. This method reads the * PDF directly from the disk, which is slower but uses less memory. * @param file the PDF file to parse * @param password the password required to open this document */ public PDFReader(File file, String password) throws IOException { reader = new org.faceless.pdf2.PDFReader(file, password); } /** * Returns 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 between * greater than or equal to zero and less than this value to the appropriate * {@link PDF} constructor. * @since 1.2.1 */ public int getNumberOfRevisions() { return reader.getNumberOfRevisions(); } public void finalize() { reader.finalize(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -