org.pdfbox.pdmodel
Class PDDocument

java.lang.Object
  extended byorg.pdfbox.pdmodel.PDDocument
All Implemented Interfaces:
Pageable

public class PDDocument
extends Object
implements Pageable

This is the in-memory representation of the PDF document. You need to call close() on this object when you are done using it!!

Version:
$Revision: 1.47 $
Author:
Ben Litchfield

Field Summary
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
PDDocument()
          Constructor, creates a new PDF Document with no pages.
PDDocument(COSDocument doc)
          Constructor that uses an existing document.
 
Method Summary
 void addPage(PDPage page)
          This will add a page to the document.
 void clearWillEncryptWhenSaving()
          Deprecated. Do not rely on this method anymore. It is the responsability of COSWriter to hold this state.
 void close()
          This will close the underlying COSDocument object.
 void decrypt(String password)
          This will decrypt a document.
 void encrypt(String ownerPassword, String userPassword)
          This will mark a document to be encrypted.
 AccessPermission getCurrentAccessPermission()
          Returns the access permissions granted when the document was decrypted.
 COSDocument getDocument()
          This will get the low level document.
 PDDocumentCatalog getDocumentCatalog()
          This will get the document CATALOG.
 PDDocumentInformation getDocumentInformation()
          This will get the document info dictionary.
 PDEncryptionDictionary getEncryptionDictionary()
          This will get the encryption dictionary for this document.
 int getNumberOfPages()
          
 String getOwnerPasswordForEncryption()
          Deprecated. Do not rely on this method anymore.
 int getPageCount()
          Deprecated. Use the getNumberOfPages method instead!
 PageFormat getPageFormat(int pageIndex)
          
 Printable getPrintable(int pageIndex)
          
 SecurityHandler getSecurityHandler()
          Get the security handler that is used for document encryption.
 String getUserPasswordForEncryption()
          Deprecated. Do not rely on this method anymore.
 PDPage importPage(PDPage page)
          This will import and copy the contents from another location.
 boolean isEncrypted()
          This will tell if this document is encrypted or not.
 boolean isOwnerPassword(String password)
          Deprecated.  
 boolean isUserPassword(String password)
          Deprecated.  
static PDDocument load(File file)
          This will load a document from a file.
static PDDocument load(File file, RandomAccess scratchFile)
          This will load a document from a file.
static PDDocument load(InputStream input)
          This will load a document from an input stream.
static PDDocument load(InputStream input, RandomAccess scratchFile)
          This will load a document from an input stream.
static PDDocument load(String filename)
          This will load a document from a file.
static PDDocument load(String filename, RandomAccess scratchFile)
          This will load a document from a file.
static PDDocument load(URL url)
          This will load a document from a url.
static PDDocument load(URL url, RandomAccess scratchFile)
          This will load a document from a url.
 void openProtection(DecryptionMaterial pm)
          Tries to decrypt the document in memory using the provided decryption material.
 void print()
          This will send the PDF document to a printer.
 void print(PrinterJob printJob)
           
 void protect(ProtectionPolicy pp)
          Protects the document with the protection policy pp.
 boolean removePage(int pageNumber)
          Remove the page from the document.
 boolean <