public class PDDocumentHandler extends Object implements Closeable
PDDocument.| Modifier and Type | Field and Description |
|---|---|
static String |
SAMBOX_USE_ASYNC_WRITER |
| Constructor and Description |
|---|
PDDocumentHandler()
Creates a new handler with an empty underlying
PDDocument. |
PDDocumentHandler(org.sejda.sambox.pdmodel.PDDocument document)
Creates a new handler using the given document as underlying
PDDocument. |
| Modifier and Type | Method and Description |
|---|---|
org.sejda.sambox.pdmodel.PDPage |
addBlankPage(org.sejda.sambox.pdmodel.common.PDRectangle mediaBox) |
org.sejda.sambox.pdmodel.PDPage |
addBlankPageAfter(int pageNumber) |
org.sejda.sambox.pdmodel.PDPage |
addBlankPageBefore(int pageNumber) |
org.sejda.sambox.pdmodel.PDPage |
addBlankPageIfOdd(org.sejda.sambox.pdmodel.common.PDRectangle mediaBox)
Adds a blank page if the current total pages number is odd
|
org.sejda.sambox.pdmodel.PDPage |
addPage(org.sejda.sambox.pdmodel.PDPage page)
Adds the given page to the underlying
PDDocument |
void |
addWriteOption(org.sejda.sambox.output.WriteOption... opts)
Adds the given
WriteOptions to be used when the document is saved |
org.sejda.sambox.pdmodel.PDDocumentCatalog |
catalog() |
void |
close() |
int |
getNumberOfPages() |
org.sejda.sambox.pdmodel.PDPage |
getPage(int pageNumber) |
org.sejda.sambox.pdmodel.PDPageTree |
getPages() |
PDDocumentAccessPermission |
getPermissions() |
org.sejda.sambox.pdmodel.PDDocument |
getUnderlyingPDDocument() |
org.sejda.sambox.pdmodel.interactive.viewerpreferences.PDViewerPreferences |
getViewerPreferences() |
org.sejda.sambox.pdmodel.PDPage |
importPage(org.sejda.sambox.pdmodel.PDPage page)
Creates a copy of the given page and adds it to the underlying
PDDocument |
void |
initialiseBasedOn(org.sejda.sambox.pdmodel.PDDocument other) |
void |
movePageToDocumentEnd(int oldPageNumber)
Moves designated page to the end of the document.
|
void |
removePage(int pageNumber)
Removes the given page to the underlying
PDDocument |
void |
removeWriteOption(org.sejda.sambox.output.WriteOption... opts)
Removes the given
WriteOptions to be used when the document is saved |
BufferedImage |
renderImage(int pageNumber,
int dpi,
ImageColorType type) |
void |
savePDDocument(File file)
Saves the underlying
PDDocument to the given file. |
void |
savePDDocument(File file,
org.sejda.sambox.encryption.StandardSecurity security)
Saves the underlying
PDDocument to the given file and using the given standard security. |
void |
setCompress(boolean compress)
sets or remove compression options to be used when the resulting document is written
|
void |
setCreatorOnPDDocument()
set the creator on the underlying
PDDocument |
void |
setDocumentAcroForm(org.sejda.sambox.pdmodel.interactive.form.PDAcroForm acroForm) |
void |
setDocumentInformation(org.sejda.sambox.pdmodel.PDDocumentInformation info)
Set the document information on the underlying
PDDocument |
void |
setDocumentOutline(org.sejda.sambox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline outline) |
void |
setDocumentTitle(String title) |
void |
setPageLabelsOnDocument(Map<Integer,PdfPageLabel> labels)
Sets the page labels 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.sejda.sambox.pdmodel.interactive.viewerpreferences.PDViewerPreferences preferences) |
public static final String SAMBOX_USE_ASYNC_WRITER
public PDDocumentHandler(org.sejda.sambox.pdmodel.PDDocument document)
PDDocument.document - public PDDocumentHandler()
PDDocument.public void setCreatorOnPDDocument()
PDDocumentpublic void setDocumentInformation(org.sejda.sambox.pdmodel.PDDocumentInformation info)
PDDocumentinfo - public void setDocumentTitle(String title)
public PDDocumentAccessPermission getPermissions()
public void setPageLayoutOnDocument(PdfPageLayout layout)
PDDocument.layout - public void setPageModeOnDocument(PdfPageMode mode)
PDDocument.mode - public void setPageLabelsOnDocument(Map<Integer,PdfPageLabel> labels)
PDDocument.labels - public void setVersionOnPDDocument(PdfVersion version)
PDDocument.version - public void addWriteOption(org.sejda.sambox.output.WriteOption... opts)
WriteOptions to be used when the document is savedopts - public void removeWriteOption(org.sejda.sambox.output.WriteOption... opts)
WriteOptions to be used when the document is savedopts - public void setCompress(boolean compress)
public org.sejda.sambox.pdmodel.interactive.viewerpreferences.PDViewerPreferences getViewerPreferences()
PDDocument.public void setViewerPreferences(org.sejda.sambox.pdmodel.interactive.viewerpreferences.PDViewerPreferences preferences)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void savePDDocument(File file) throws TaskException
PDDocument to the given file.file - TaskExceptionpublic void savePDDocument(File file, org.sejda.sambox.encryption.StandardSecurity security) throws TaskException
PDDocument to the given file and using the given standard security.file - security - TaskExceptionpublic int getNumberOfPages()
public org.sejda.sambox.pdmodel.PDDocument getUnderlyingPDDocument()
public org.sejda.sambox.pdmodel.PDDocumentCatalog catalog()
public org.sejda.sambox.pdmodel.PDPage importPage(org.sejda.sambox.pdmodel.PDPage page)
PDDocumentpage - public org.sejda.sambox.pdmodel.PDPage addPage(org.sejda.sambox.pdmodel.PDPage page)
PDDocumentpage - public void removePage(int pageNumber)
PDDocumentpageNumber - public void movePageToDocumentEnd(int oldPageNumber)
oldPageNumber - 1-based page numberpublic org.sejda.sambox.pdmodel.PDPage getPage(int pageNumber)
public org.sejda.sambox.pdmodel.PDPageTree getPages()
public void initialiseBasedOn(org.sejda.sambox.pdmodel.PDDocument other)
public BufferedImage renderImage(int pageNumber, int dpi, ImageColorType type) throws TaskException
TaskExceptionpublic void setDocumentOutline(org.sejda.sambox.pdmodel.interactive.documentnavigation.outline.PDDocumentOutline outline)
public void setDocumentAcroForm(org.sejda.sambox.pdmodel.interactive.form.PDAcroForm acroForm)
public org.sejda.sambox.pdmodel.PDPage addBlankPageIfOdd(org.sejda.sambox.pdmodel.common.PDRectangle mediaBox)
mediaBox - media box size for the blank pagepublic org.sejda.sambox.pdmodel.PDPage addBlankPage(org.sejda.sambox.pdmodel.common.PDRectangle mediaBox)
public org.sejda.sambox.pdmodel.PDPage addBlankPageAfter(int pageNumber)
public org.sejda.sambox.pdmodel.PDPage addBlankPageBefore(int pageNumber)
Copyright © 2019 sejda. All rights reserved.