org.sejda.impl.pdfbox.component
Class PDDocumentHandler

java.lang.Object
  extended by org.sejda.impl.pdfbox.component.PDDocumentHandler
All Implemented Interfaces:
Closeable
Direct Known Subclasses:
PagesExtractor, PdfAlternateMixer

public class PDDocumentHandler
extends Object
implements Closeable

Wrapper over a PDDocument.

Author:
Andrea Vacondio

Constructor Summary
PDDocumentHandler()
          Creates a new handler with an empty underlying PDDocument.
PDDocumentHandler(org.apache.pdfbox.pdmodel.PDDocument document, String password)
          Creates a new handler using the given document as underlying PDDocument.
 
Method Summary
 void close()
           
 void compressXrefStream(boolean compress)
          Set compression of the XRef table on underlying PDDocument.
 int getNumberOfPages()
           
 PDDocumentAccessPermission getPermissions()
           
 org.apache.pdfbox.pdmodel.PDDocument getUnderlyingPDDocument()
           
 org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences getViewerPreferences()
           
 void importPage(org.apache.pdfbox.pdmodel.PDPage page)
          Import an existing page to the underlying PDDocument
 void saveDecryptedPDDocument(File file)
          Saves the underlying PDDocument removing security from it.
 void savePDDocument(File file)
          Saves the underlying PDDocument to the given file.
 void setCreatorOnPDDocument()
          set the creator on the underlying PDDocument
 void setDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation info)
          Set the document information on the underlying PDDocument
 void setPageLayoutOnDocument(PdfPageLayout layout)
          Sets the given page layout on the underlying PDDocument.
 void setPageModeOnDocument(PdfPageMode mode)
          Sets the given page mode on the underlying PDDocument.
 void setVersionOnPDDocument(PdfVersion version)
          Sets the version on the underlying PDDocument.
 void setViewerPreferences(org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences preferences)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDDocumentHandler

public PDDocumentHandler(org.apache.pdfbox.pdmodel.PDDocument document,
                         String password)
                  throws TaskIOException
Creates a new handler using the given document as underlying PDDocument.

Parameters:
document -
password -
Throws:
TaskIOException

PDDocumentHandler

public PDDocumentHandler()
                  throws TaskIOException
Creates a new handler with an empty underlying PDDocument.

Throws:
TaskIOException
Method Detail

setCreatorOnPDDocument

public void setCreatorOnPDDocument()
set the creator on the underlying PDDocument


setDocumentInformation

public void setDocumentInformation(org.apache.pdfbox.pdmodel.PDDocumentInformation info)
Set the document information on the underlying PDDocument

Parameters:
info -

getPermissions

public PDDocumentAccessPermission getPermissions()
Returns:
access permissions granted to this document.

setPageLayoutOnDocument

public void setPageLayoutOnDocument(PdfPageLayout layout)
Sets the given page layout on the underlying PDDocument.

Parameters:
layout -

setPageModeOnDocument

public void setPageModeOnDocument(PdfPageMode mode)
Sets the given page mode on the underlying PDDocument.

Parameters:
mode -

setVersionOnPDDocument

public void setVersionOnPDDocument(PdfVersion version)
Sets the version on the underlying PDDocument.

Parameters:
version -

compressXrefStream

public void compressXrefStream(boolean compress)
Set compression of the XRef table on underlying PDDocument.

Parameters:
compress -

getViewerPreferences

public org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences getViewerPreferences()
Returns:
the view preferences for the underlying PDDocument.

setViewerPreferences

public void setViewerPreferences(org.apache.pdfbox.pdmodel.interactive.viewerpreferences.PDViewerPreferences preferences)

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

saveDecryptedPDDocument

public void saveDecryptedPDDocument(File file)
                             throws TaskException
Saves the underlying PDDocument removing security from it.

Parameters:
file -
Throws:
TaskException

savePDDocument

public void savePDDocument(File file)
                    throws TaskException
Saves the underlying PDDocument to the given file.

Parameters:
file -
Throws:
TaskException

getNumberOfPages

public int getNumberOfPages()

getUnderlyingPDDocument

public org.apache.pdfbox.pdmodel.PDDocument getUnderlyingPDDocument()

importPage

public void importPage(org.apache.pdfbox.pdmodel.PDPage page)
                throws TaskIOException
Import an existing page to the underlying PDDocument

Parameters:
page -
Throws:
TaskIOException


Copyright © 2012. All Rights Reserved.