Class PdfDocument
- java.lang.Object
-
- com.ironsoftware.ironpdf.PdfDocument
-
- All Implemented Interfaces:
Printable
,AutoCloseable
public class PdfDocument extends Object implements Printable, AutoCloseable
Represents a PDF document. Allows: loading, editing, manipulating, merging, signing printing and saving PDFs.
-
-
Field Summary
-
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
-
Constructor Summary
Constructors Constructor Description PdfDocument(byte[] pdfData)
Opens an existing PDF document for editing.PdfDocument(byte[] pdfData, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.PdfDocument(byte[] pdfData, String password)
Opens an existing PDF document for editing.PdfDocument(byte[] pdfData, String password, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.PdfDocument(byte[] pdfData, String password, String ownerPassword)
Opens an existing PDF document for editing.PdfDocument(byte[] pdfData, String password, String ownerPassword, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath, String password)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath, String password, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath, String password, String ownerPassword)
Opens an existing PDF document for editing.PdfDocument(Path pdfFilePath, String password, String ownerPassword, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfDocument
addBackgroundPdf(PdfDocument backgroundPdf)
Adds a background to each page of this PDF.PdfDocument
addBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex)
Adds a background to each page of this PDF.PdfDocument
addBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex, PageSelection pageSelection)
Adds a background to selected page(s) of this PDF.PdfDocument
addBackgroundPdf(PdfDocument backgroundPdf, PageSelection pageSelection)
Adds a background to selected page(s) of this PDF.PdfDocument
addForegroundPdf(PdfDocument foregroundPdf)
Adds a foreground to each page of this PDF.PdfDocument
addForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex)
Adds a foreground to each page of this PDF.PdfDocument
addForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex, PageSelection pageSelection)
Adds a foreground to selected page(s) of this PDF.PdfDocument
addForegroundPdf(PdfDocument foregroundPdf, PageSelection pageSelection)
Adds a foreground to selected page(s) of this PDF.PdfDocument
addHtmlFooter(HtmlHeaderFooter footer)
Renders HTML page footers onto an existing PDF FilePdfDocument
addHtmlFooter(HtmlHeaderFooter footer, PageSelection pageSelection)
Renders HTML page footers onto an existing PDF FilePdfDocument
addHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions)
Renders HTML page footer onto an existing PDF FilePdfDocument
addHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders HTML page footer onto an existing PDF FilePdfDocument
addHtmlHeader(HtmlHeaderFooter header)
Renders HTML page headers onto an existing PDF FilePdfDocument
addHtmlHeader(HtmlHeaderFooter header, PageSelection pageSelection)
Renders HTML page headers onto an existing PDF FilePdfDocument
addHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions)
Renders HTML page headers onto an existing PDF FilePdfDocument
addHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders HTML page headers onto an existing PDF FilePdfDocument
addTextFooter(TextHeaderFooter footer)
Renders TEXT page footers onto an existing PDF FilePdfDocument
addTextFooter(TextHeaderFooter footer, PageSelection pageSelection)
Renders TEXT page footers onto an existing PDF FilePdfDocument
addTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions)
Renders TEXT page footer onto an existing PDF FilePdfDocument
addTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders TEXT page footer onto an existing PDF FilePdfDocument
addTextHeader(TextHeaderFooter header)
Renders TEXT page headers onto an existing PDF FilePdfDocument
addTextHeader(TextHeaderFooter header, PageSelection pageSelection)
Renders TEXT page headers onto an existing PDF FilePdfDocument
addTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions)
Renders TEXT page headers onto an existing PDF FilePdfDocument
addTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders TEXT page headers onto an existing PDF FilePdfDocument
appendPdf(PdfDocument AnotherPdfFile)
Appends another PDF to the end of the currentPdfDocument
.PdfDocument
applyStamp(Stamper stamper)
Edits the PDF by applying theStamper
's rendered to every page.PdfDocument
applyStamp(Stamper stamper, PageSelection pageSelection)
Edits the PDF by applying theStamper
's rendered to only selected page(s).PdfDocument
applyWatermark(String html)
Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.PdfDocument
applyWatermark(String html, int opacity)
Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.PdfDocument
applyWatermark(String html, int opacity, VerticalAlignment verticalAlignment)
Adds a watermark to this PDF.PdfDocument
applyWatermark(String html, int opacity, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
Adds a watermark to this PDF.void
close()
void
compressImages(int quality)
Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality setting.void
compressImages(int quality, boolean scaleToVisibleSize)
Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality settings.void
compressStructTree(int quality, boolean scaleToVisibleSize)
Remove document struct tree information which describes the logical layout of the document.PdfDocument
convertToPdfA()
Convert the current document into the specified PDF-A standard formatPdfDocument
convertToPdfA(String customICCFilePath)
Convert the current document into the specified PDF-A standard formatPdfDocument
convertToPdfUA(NaturalLanguages naturalLanguages)
Convert the current document into the specified PDF/UA standard formatPdfDocument
copyPage(int PageIndex)
Creates a new PDF by copying a page from this PdfDocument into a new blank document.PdfDocument
copyPages(int StartIndex, int EndIndex)
Creates a new PDF by copying a range of pages from thisPdfDocument
into a new blank document.PdfDocument
copyPages(PageSelection pageSelection)
Creates a new PDF by copying a page from this PdfDocument into a new blank document.void
drawImage(byte[] imageBytes, DrawImageOptions option)
Draws an image onto the PDF documentvoid
drawImage(Path imagePath, DrawImageOptions option)
Draws an image onto the PDF documentList<BufferedImage>
extractAllImages()
Finds all embedded Images from within the PDF and returns them as a list ofBufferedImage
images.List<BufferedImage>
extractAllImagesFromPages(PageSelection pageSelection)
Finds all embedded Images from within the PDF and returns as a list of image bytesList<byte[]>
extractAllRawImages()
Finds all embedded Images from within the PDF and returns as a list of image bytesList<byte[]>
extractAllRawImagesFromPages(PageSelection pageSelection)
Finds all embedded Images from within the PDF and returns them as raw bytes.String
extractAllText()
Extracts the written text content from the PDF and returns it as a string.String
extractTextFromPage(PageSelection pageSelection)
Extracts the text content from one page of the PDF and returns it as a string.static PdfDocument
fromFile(Path pdfFilePath)
Opens an existing PDF document for editing.static PdfDocument
fromFile(Path pdfFilePath, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.static PdfDocument
fromFile(Path pdfFilePath, String password)
Opens an existing PDF document for editing.static PdfDocument
fromFile(Path pdfFilePath, String password, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.static PdfDocument
fromFile(Path pdfFilePath, String password, String ownerPassword)
Opens an existing PDF document for editing.static PdfDocument
fromFile(Path pdfFilePath, String password, String ownerPassword, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.static PdfDocument
fromImage(List<Path> imagesPath)
Converts a single image file to an identical PDF document of matching dimensions.static PdfDocument
fromImage(List<Path> imagesPath, ImageBehavior imageBehavior)
Converts a single image file to an identical PDF document of matching dimensions.static PdfDocument
fromImage(List<Path> imagesPath, ImageBehavior imageBehavior, ChromePdfRenderOptions renderOptions)
Converts a single image file to an identical PDF document of matching dimensions.static PdfDocument
fromImage(List<Path> imagesPath, ImageBehavior imageBehavior, PaperSize paperSize)
Converts a single image file to an identical PDF document of matching dimensions.static PdfDocument
fromImage(List<Path> imagesPath, PaperSize paperSize)
Converts a single image file to an identical PDF document of matching dimensions.AnnotationManager
getAnnotation()
Gets the annotation manager for this PDF document.AttachmentManager
getAttachment()
Gets the attachment manager for this PDF document.byte[]
getBinaryData()
Saves the PDF as byte array, including any changes.byte[]
getBinaryDataIncremental()
Saves the PDF as byte array with changes appended to the end of the file.BookmarkManager
getBookmark()
Gets the BookmarkManager for this PDF document.FormManager
getForm()
Gets the form manager for this PDF document.MetadataManager
getMetadata()
Gets the metadata manager for this PDF document.List<PageInfo>
getPagesInfo()
Gets a list of information about pages in this PDF as a List ofPageInfo
.Map<Integer,PageInfo>
getPagesInfo(PageSelection pageSelection)
Gets a Map of information a selection of pages in this PDF as a List ofPageInfo
.byte[]
getRevision(int index)
Saves the PDF as byte array at the specified revision number.SecurityManager
getSecurity()
Gets security.SignatureManager
getSignature()
Gets signature.PdfDocument
insertPdf(PdfDocument AnotherPdfFile)
Inserts another PDF into the current PdfDocument, starting at a given Page Index.PdfDocument
insertPdf(PdfDocument AnotherPdfFile, int AtIndex)
Inserts another PDF into the current PdfDocument, starting at a given Page Index.static PdfDocument
merge(PdfDocument A, PdfDocument B)
Static method that joins (concatenates) 2 PDF documents together into one PDF document.static PdfDocument
merge(List<PdfDocument> Documents)
Static method that joins (concatenates) 2 PDF documents together into one PDF document.PdfDocument
prependPdf(PdfDocument AnotherPdfFile)
Adds another PDF to the beginning of the current PdfDocument.void
print()
Prints this PDF by sending it to the computer's real world printer(s).int
print(Graphics graphics, PageFormat pageFormat, int pageIndex)
void
printWithoutDialog()
Prints this PDF by sending it to the computer's real world printer(s).PdfDocument
removePages(PageSelection pageSelection)
Removes a range of pages from the PDFstatic PdfDocument
renderHtmlAsPdf(String html)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf(String html, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, String baseUrl)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.static PdfDocument
renderRtfAsPdf(String rtfString)
Creates a PDF file from RTF string, and returns it as aPdfDocument
.static PdfDocument
renderRtfFileAsPdf(String rtfFilePath)
Creates a PDF file from RTF file, and returns it as aPdfDocument
.static PdfDocument
renderRtfFileAsPdf(Path rtfFilePath)
Creates a PDF file from RTF file, and returns it as aPdfDocument
.static PdfDocument
renderUrlAsPdf(String url)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.static PdfDocument
renderUrlAsPdf(String url, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.static PdfDocument
renderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.static PdfDocument
renderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.static PdfDocument
renderZipAsPdf(Path zipFilePath, String mainFile)
Creates a PDF file from a local Zip file, and returns it as aPdfDocument
.static PdfDocument
renderZipAsPdf(Path zipFilePath, String mainFile, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a local Zip file, and returns it as aPdfDocument
.void
replaceText(PageSelection pageSelection, String oldText, String newText)
Replace the specified old text with new text on a given page.void
resizePage(double pageWidth, double pageHeight, PageSelection pageSelection)
Resize a page to the specified dimensions (in millimeters)void
rotateAllPages(PageRotation rotation)
Rotates all pages of the PdfDocument by a specified number of degrees.void
rotatePage(PageRotation pageRotation, PageSelection pageSelection)
Rotates a selection page of the PdfDocument by a specified number of degrees.PdfDocument
saveAs(String filePath)
Saves this PdfDocument to a file.PdfDocument
saveAs(Path filePath)
Saves this PdfDocument to a file.PdfDocument
saveAsPdfA(String filePath)
Save the current document into the specified PDF-A standard formatPdfDocument
saveAsPdfA(String filePath, String customICCFilePath)
Save the current document into the specified PDF-A standard formatPdfDocument
saveAsPdfUA(String filePath, NaturalLanguages naturalLanguages)
Save the current document into the specified PDF/UA standard formatPdfDocument
saveAsRevision(String filePath)
Saves this PdfDocument to a file.PdfDocument
saveAsRevision(Path filePath)
Saves this PdfDocument to a file.List<BufferedImage>
toBufferedImages()
Rasterizes (renders) the PDF into BufferedImage objects.List<BufferedImage>
toBufferedImages(PageSelection pageSelection)
Rasterizes (renders) the PDF into BufferedImage objects.List<BufferedImage>
toBufferedImages(ToImageOptions options)
Rasterizes (renders) the PDF into BufferedImage objects.List<BufferedImage>
toBufferedImages(ToImageOptions options, PageSelection pageSelection)
Rasterizes (renders) the PDF into BufferedImage objects.List<String>
toImages(String fileNamePattern, String imageFileType)
Renders the pages of the PDF as specific image files type and saves them to disk.List<String>
toImages(String fileNamePattern, String imageFileType, PageSelection pageSelection)
Renders the pages of the PDF as specific image files type and saves them to disk.List<String>
toImages(String fileNamePattern, String imageFileType, ToImageOptions options)
Renders the pages of the PDF as specific image files type and saves them to disk.List<String>
toImages(String fileNamePattern, String imageFileType, ToImageOptions options, PageSelection pageSelection)
Renders the pages of the PDF as specific image files type and saves them to disk.List<String>
toJpegImages(String fileNamePattern)
Renders the pages of the PDF as JPEG image files and saves them to disk.List<String>
toJpegImages(String fileNamePattern, PageSelection pageSelection)
Renders the pages of the PDF as JPEG image files and saves them to disk.List<String>
toJpegImages(String fileNamePattern, ToImageOptions options)
Renders the pages of the PDF as JPEG image files and saves them to disk.List<String>
toJpegImages(String fileNamePattern, ToImageOptions options, PageSelection pageSelection)
Renders the pages of the PDF as JPEG image files and saves them to disk.String
toMultiPageTiff(Path filePath)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.String
toMultiPageTiff(Path filePath, PageSelection pageSelection)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.String
toMultiPageTiff(Path filePath, ToImageOptions options)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.String
toMultiPageTiff(Path filePath, ToImageOptions options, PageSelection pageSelection)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.List<String>
toPngImages(String fileNamePattern)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.List<String>
toPngImages(String fileNamePattern, PageSelection pageSelection)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.List<String>
toPngImages(String fileNamePattern, ToImageOptions options)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.List<String>
toPngImages(String fileNamePattern, ToImageOptions options, PageSelection pageSelection)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.
-
-
-
Constructor Detail
-
PdfDocument
public PdfDocument(Path pdfFilePath, String password) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.- Throws:
IOException
- if an I/O error occurs reading from the stream
-
PdfDocument
public PdfDocument(Path pdfFilePath, String password, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.trackChanges
- Optionally track changes to the document (for use with incremental saves)- Throws:
IOException
- if an I/O error occurs reading from the stream
-
PdfDocument
public PdfDocument(Path pdfFilePath, String password, String ownerPassword) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)- Throws:
IOException
- if an I/O error occurs reading from the stream
-
PdfDocument
public PdfDocument(Path pdfFilePath, String password, String ownerPassword, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)trackChanges
- Optionally track changes to the document (for use with incremental saves)- Throws:
IOException
- if an I/O error occurs reading from the stream
-
PdfDocument
public PdfDocument(byte[] pdfData, String password, String ownerPassword)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)
-
PdfDocument
public PdfDocument(byte[] pdfData, String password, String ownerPassword, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)trackChanges
- Optionally track changes to the document (for use with incremental saves)
-
PdfDocument
public PdfDocument(Path pdfFilePath) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.- Throws:
IOException
- the io exception
-
PdfDocument
public PdfDocument(Path pdfFilePath, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.trackChanges
- Optionally track changes to the document (for use with incremental saves)- Throws:
IOException
- the io exception
-
PdfDocument
public PdfDocument(byte[] pdfData, String password)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.password
- Optional user password if the PDF document is encrypted.
-
PdfDocument
public PdfDocument(byte[] pdfData, String password, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.password
- Optional user password if the PDF document is encrypted.trackChanges
- Optionally track changes to the document (for use with incremental saves)
-
PdfDocument
public PdfDocument(byte[] pdfData)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.
-
PdfDocument
public PdfDocument(byte[] pdfData, ChangeTrackingModes trackChanges)
Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.trackChanges
- Optionally track changes to the document (for use with incremental saves)
-
-
Method Detail
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath, String password) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath, String password, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.trackChanges
- Optionally track changes to the document (for use with incremental saves)- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath, String password, String ownerPassword) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath, String password, String ownerPassword, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.password
- Optional user password if the PDF document is encrypted.ownerPassword
- Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..)trackChanges
- Optionally track changes to the document (for use with incremental saves)- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromFile
public static PdfDocument fromFile(Path pdfFilePath, ChangeTrackingModes trackChanges) throws IOException
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.trackChanges
- Optionally track changes to the document (for use with incremental saves)- Returns:
- An IronPdf.PdfDocument object as loaded from the file path.
- Throws:
IOException
- if an I/O error occurs reading from the stream
-
fromImage
public static PdfDocument fromImage(List<Path> imagesPath)
Converts a single image file to an identical PDF document of matching dimensions.The default PaperSize is A4.
Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
- Parameters:
imagesPath
- A list of file path of the image file.- Returns:
- Returns a
PdfDocument
document which can then be edited, saved or served over the web.
-
fromImage
public static PdfDocument fromImage(List<Path> imagesPath, PaperSize paperSize)
Converts a single image file to an identical PDF document of matching dimensions.The default PaperSize is A4. You can set it via ImageToPdfConverter.PaperSize.
Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
- Parameters:
imagesPath
- A list of file path of the image file.paperSize
- A target paper size. Default is A4.- Returns:
- Returns a
PdfDocument
document which can then be edited, saved or served over the web.
-
fromImage
public static PdfDocument fromImage(List<Path> imagesPath, ImageBehavior imageBehavior)
Converts a single image file to an identical PDF document of matching dimensions.The default PaperSize is A4.
Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
- Parameters:
imagesPath
- A list of file path of the image file.imageBehavior
- Describes how image should be placed on the PDF page- Returns:
- Returns a
PdfDocument
document which can then be edited, saved or served over the web.
-
fromImage
public static PdfDocument fromImage(List<Path> imagesPath, ImageBehavior imageBehavior, PaperSize paperSize)
Converts a single image file to an identical PDF document of matching dimensions.Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
- Parameters:
imagesPath
- A list of file path of the image file.imageBehavior
- Describes how image should be placed on the PDF page.paperSize
- A target paper size. Default is A4.- Returns:
- Returns a
PdfDocument
document which can then be edited, saved or served over the web.
-
fromImage
public static PdfDocument fromImage(List<Path> imagesPath, ImageBehavior imageBehavior, ChromePdfRenderOptions renderOptions)
Converts a single image file to an identical PDF document of matching dimensions.The default PaperSize is A4. You can set it via
ChromePdfRenderOptions.setPaperSize(PaperSize)
.Note: Imaging.ImageBehavior.CropPage will set PaperSize equal to ImageSize.
- Parameters:
imagesPath
- A list of file path of the image file.imageBehavior
- Describes how image should be placed on the PDF page.renderOptions
- Rendering options.- Returns:
- Returns a
PdfDocument
document which can then be edited, saved or served over the web.
-
getBookmark
public BookmarkManager getBookmark()
Gets the BookmarkManager for this PDF document. BookmarkManager allows reading, removing and editing of bookmarks from the PDF outline. *See:
BookmarkManager
.- Returns:
- the BookmarkManager
-
getMetadata
public MetadataManager getMetadata()
Gets the metadata manager for this PDF document. MetadataManager allows metadata such as Author etc. to be read and set.See:
MetadataManager
.- Returns:
- the MetadataManager
-
getAnnotation
public AnnotationManager getAnnotation()
Gets the annotation manager for this PDF document. AnnotationManager allows annotation objects to be edited.See:
AnnotationManager
.- Returns:
- the AnnotationManager
-
getForm
public FormManager getForm()
Gets the form manager for this PDF document. FormManager allows AcroForm fields to be read and set.See:
FormManager
.- Returns:
- the FormManager
-
getAttachment
public AttachmentManager getAttachment()
Gets the attachment manager for this PDF document. AttachmentManager allows attachment objects to be edited.See:
AttachmentManager
.- Returns:
- the AttachmentManager
-
getSecurity
public SecurityManager getSecurity()
Gets security.- Returns:
- the SecurityManager
-
getSignature
public SignatureManager getSignature()
Gets signature.- Returns:
- the SignatureManager
-
merge
public static PdfDocument merge(PdfDocument A, PdfDocument B)
Static method that joins (concatenates) 2 PDF documents together into one PDF document.If the second PDF contains form fields, the resulting PDF's form fields will be appended with an origin index number. e.g. 'Name' from the first PDF will become 'Name_0'
- Parameters:
A
- A PDFB
- A Seconds PDF- Returns:
- A new, merged
PdfDocument
-
merge
public static PdfDocument merge(List<PdfDocument> Documents)
Static method that joins (concatenates) 2 PDF documents together into one PDF document.If the second PDF contains form fields, the resulting PDF's form fields will be appended with an origin index number. e.g. 'Name' from the first PDF will become 'Name_0'
- Parameters:
Documents
- A List of PdfDocument. To merge existing PDF files you may use the PdfDocument.FromFile static method in conjunction with Merge.- Returns:
- A new, merged
PdfDocument
-
copyPage
public final PdfDocument copyPage(int PageIndex)
Creates a new PDF by copying a page from this PdfDocument into a new blank document.- Parameters:
PageIndex
- Index of the page. Note: Page 1 has index 0...- Returns:
- A new
PdfDocument
-
copyPages
public final PdfDocument copyPages(PageSelection pageSelection)
Creates a new PDF by copying a page from this PdfDocument into a new blank document.- Parameters:
pageSelection
- The selected page index(es). Default is all pages.- Returns:
- A new
PdfDocument
-
copyPages
public final PdfDocument copyPages(int StartIndex, int EndIndex)
Creates a new PDF by copying a range of pages from thisPdfDocument
into a new blank document.- Parameters:
StartIndex
- The index of the first PDF page to copy. Note: Page 1 has index 0EndIndex
- The index of the last PDF page to copy.- Returns:
- A new
PdfDocument
-
appendPdf
public final PdfDocument appendPdf(PdfDocument AnotherPdfFile)
Appends another PDF to the end of the currentPdfDocument
.If AnotherPdfFile contains form fields, those fields will be appended with '_' in the resulting PDF. e.g. 'Name' will become 'Name_'
- Parameters:
AnotherPdfFile
- PdfDocument to append.- Returns:
- A new
PdfDocument
-
insertPdf
public final PdfDocument insertPdf(PdfDocument AnotherPdfFile)
Inserts another PDF into the current PdfDocument, starting at a given Page Index.If AnotherPdfFile contains form fields, those fields will be appended with '_' in the resulting PDF. e.g. 'Name' will be 'Name_'
- Parameters:
AnotherPdfFile
- Another PdfDocument...- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
insertPdf
public final PdfDocument insertPdf(PdfDocument AnotherPdfFile, int AtIndex)
Inserts another PDF into the current PdfDocument, starting at a given Page Index.If AnotherPdfFile contains form fields, those fields will be appended with '_' in the resulting PDF. e.g. 'Name' will be 'Name_'
- Parameters:
AnotherPdfFile
- Another PdfDocument.AtIndex
- Index at which to insert the new content. Note: Page 1 has index 0...- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
prependPdf
public final PdfDocument prependPdf(PdfDocument AnotherPdfFile)
Adds another PDF to the beginning of the current PdfDocument.If AnotherPdfFile contains form fields, those fields will be appended with '_' in the resulting PDF. e.g. 'Name' will be 'Name_'
- Parameters:
AnotherPdfFile
- PdfDocument to prepend.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
removePages
public final PdfDocument removePages(PageSelection pageSelection)
Removes a range of pages from the PDF- Parameters:
pageSelection
- The selected page index(es). Default is all pages.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
getPagesInfo
public final List<PageInfo> getPagesInfo()
Gets a list of information about pages in this PDF as a List ofPageInfo
.- Returns:
- A list of information about the PDF’s pages.
-
getPagesInfo
public final Map<Integer,PageInfo> getPagesInfo(PageSelection pageSelection)
Gets a Map of information a selection of pages in this PDF as a List ofPageInfo
.- Parameters:
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- a map of page index and page information.
-
rotateAllPages
public final void rotateAllPages(PageRotation rotation)
Rotates all pages of the PdfDocument by a specified number of degrees.- Parameters:
rotation
- Degrees of rotation. May be 0,90,180 or 270
-
rotatePage
public final void rotatePage(PageRotation pageRotation, PageSelection pageSelection)
Rotates a selection page of the PdfDocument by a specified number of degrees.- Parameters:
pageRotation
- Degrees of rotation. May be 0,90,180 or 270pageSelection
- Selected page indexes. Default is all pages.
-
resizePage
public final void resizePage(double pageWidth, double pageHeight, PageSelection pageSelection)
Resize a page to the specified dimensions (in millimeters)- Parameters:
pageWidth
- Desired page width, in millimeterspageHeight
- Desired page height, in millimeterspageSelection
- Selected page indexes.
-
addBackgroundPdf
public final PdfDocument addBackgroundPdf(PdfDocument backgroundPdf)
Adds a background to each page of this PDF. The background is copied from a first page in the backgroundPdf document.- Parameters:
backgroundPdf
- The background PDF document.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addBackgroundPdf
public final PdfDocument addBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex)
Adds a background to each page of this PDF. The background is copied from a selected page in the backgroundPdf document.- Parameters:
backgroundPdf
- The background PDF document.backgroundPdfPageIndex
- Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addBackgroundPdf
public final PdfDocument addBackgroundPdf(PdfDocument backgroundPdf, PageSelection pageSelection)
Adds a background to selected page(s) of this PDF. The background is copied from a selected page in the backgroundPdf document.- Parameters:
backgroundPdf
- The background PDF document.pageSelection
- PageSelection to which the background/foreground will be added. Default is PageSelection.AllPages().- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addBackgroundPdf
public final PdfDocument addBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex, PageSelection pageSelection)
Adds a background to selected page(s) of this PDF. The background is copied from a selected page in the backgroundPdf document.- Parameters:
backgroundPdf
- The background PDF document.backgroundPdfPageIndex
- Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.pageSelection
- PageSelection to which the background/foreground will be added. Default is PageSelection.AllPages().- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addForegroundPdf
public final PdfDocument addForegroundPdf(PdfDocument foregroundPdf)
Adds a foreground to each page of this PDF. The foreground is copied from a first page of the foregroundPdf document.- Parameters:
foregroundPdf
- The foreground PDF document.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addForegroundPdf
public final PdfDocument addForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex)
Adds a foreground to each page of this PDF. The foreground is copied from a selected page in the foregroundPdf document.- Parameters:
foregroundPdf
- The foreground PDF document.foregroundPdfPageIndex
- Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addForegroundPdf
public final PdfDocument addForegroundPdf(PdfDocument foregroundPdf, PageSelection pageSelection)
Adds a foreground to selected page(s) of this PDF. The foreground is copied from a selected page in the foregroundPdf document.- Parameters:
foregroundPdf
- The foreground PDF document.pageSelection
- PageSelection to which the background/foreground will be added. Default is PageSelection.AllPages().- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addForegroundPdf
public final PdfDocument addForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex, PageSelection pageSelection)
Adds a foreground to selected page(s) of this PDF. The foreground is copied from a selected page in the foregroundPdf document.- Parameters:
foregroundPdf
- The foreground PDF document.foregroundPdfPageIndex
- Index (zero-based page number) of the page to copy from the Background/Foreground PDF. Default is 0.pageSelection
- PageSelection to which the background/foreground will be added. Default is PageSelection.AllPages().- Returns:
- Returns this PdfDocument object, allowing for a 'fluent' chained in-line code style
-
addTextHeader
public PdfDocument addTextHeader(TextHeaderFooter header)
Renders TEXT page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.TextHeaderFooter that defines the header content and layout.- Returns:
- the pdf document
-
addTextHeader
public PdfDocument addTextHeader(TextHeaderFooter header, PageSelection pageSelection)
Renders TEXT page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.TextHeaderFooter that defines the header content and layout.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addTextHeader
public PdfDocument addTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions)
Renders TEXT page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.TextHeaderFooter that defines the header content and layout.headerFooterOptions
- HeaderFooterOption.- Returns:
- the pdf document
-
addTextHeader
public PdfDocument addTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders TEXT page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.TextHeaderFooter that defines the header content and layout.headerFooterOptions
- HeaderFooterOption.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addTextFooter
public PdfDocument addTextFooter(TextHeaderFooter footer)
Renders TEXT page footers onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.TextHeaderFooter that defines the footer content and layout.- Returns:
- the pdf document
-
addTextFooter
public PdfDocument addTextFooter(TextHeaderFooter footer, PageSelection pageSelection)
Renders TEXT page footers onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.TextHeaderFooter that defines the footer content and layout.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addTextFooter
public PdfDocument addTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions)
Renders TEXT page footer onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.TextHeaderFooter that defines the footer content and layout.headerFooterOptions
- HeaderFooterOption.- Returns:
- the pdf document
-
addTextFooter
public PdfDocument addTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders TEXT page footer onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.TextHeaderFooter that defines the footer content and layout.headerFooterOptions
- HeaderFooterOption.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addHtmlHeader
public PdfDocument addHtmlHeader(HtmlHeaderFooter header)
Renders HTML page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout.- Returns:
- the pdf document
-
addHtmlHeader
public PdfDocument addHtmlHeader(HtmlHeaderFooter header, PageSelection pageSelection)
Renders HTML page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addHtmlHeader
public PdfDocument addHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions)
Renders HTML page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout.headerFooterOptions
- HeaderFooterOption.- Returns:
- the pdf document
-
addHtmlHeader
public PdfDocument addHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders HTML page headers onto an existing PDF File- Parameters:
header
- A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout.headerFooterOptions
- HeaderFooterOption.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addHtmlFooter
public PdfDocument addHtmlFooter(HtmlHeaderFooter footer)
Renders HTML page footers onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout.- Returns:
- the pdf document
-
addHtmlFooter
public PdfDocument addHtmlFooter(HtmlHeaderFooter footer, PageSelection pageSelection)
Renders HTML page footers onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
addHtmlFooter
public PdfDocument addHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions)
Renders HTML page footer onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout.headerFooterOptions
- HeaderFooterOption.- Returns:
- the pdf document
-
addHtmlFooter
public PdfDocument addHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)
Renders HTML page footer onto an existing PDF File- Parameters:
footer
- A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout.headerFooterOptions
- HeaderFooterOption.pageSelection
- Selected page indexes. Default is all pages.- Returns:
- the pdf document
-
drawImage
public final void drawImage(Path imagePath, DrawImageOptions option) throws IOException
Draws an image onto the PDF document- Parameters:
imagePath
- The image file path.option
- the option- Throws:
IOException
- the io exception
-
drawImage
public final void drawImage(byte[] imageBytes, DrawImageOptions option)
Draws an image onto the PDF document- Parameters:
imageBytes
- image byte arrayoption
- the option
-
toBufferedImages
public final List<BufferedImage> toBufferedImages() throws IOException
Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Returns:
- An array of BufferedImage objects.
- Throws:
IOException
- the io exception
-
toBufferedImages
public final List<BufferedImage> toBufferedImages(ToImageOptions options) throws IOException
Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Parameters:
options
- TheToImageOptions
- Returns:
- An array of BufferedImage objects.
- Throws:
IOException
- the io exception
-
toBufferedImages
public final List<BufferedImage> toBufferedImages(PageSelection pageSelection) throws IOException
Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Parameters:
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of BufferedImage objects.
- Throws:
IOException
- the io exception
-
toBufferedImages
public final List<BufferedImage> toBufferedImages(ToImageOptions options, PageSelection pageSelection) throws IOException
Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Parameters:
options
- TheToImageOptions
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of BufferedImage objects.
- Throws:
IOException
- the io exception
-
toPngImages
public final List<String> toPngImages(String fileNamePattern) throws IOException
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.png- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toPngImages
public final List<String> toPngImages(String fileNamePattern, ToImageOptions options) throws IOException
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.pngoptions
- TheToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toPngImages
public final List<String> toPngImages(String fileNamePattern, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.pngpageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toPngImages
public final List<String> toPngImages(String fileNamePattern, ToImageOptions options, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.pngoptions
- TheToImageOptions
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toImages
public List<String> toImages(String fileNamePattern, String imageFileType) throws IOException
Renders the pages of the PDF as specific image files type and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgimageFileType
- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toImages
public List<String> toImages(String fileNamePattern, String imageFileType, ToImageOptions options) throws IOException
Renders the pages of the PDF as specific image files type and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgimageFileType
- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"options
- TheToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toImages
public List<String> toImages(String fileNamePattern, String imageFileType, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as specific image files type and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgimageFileType
- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toImages
public List<String> toImages(String fileNamePattern, String imageFileType, ToImageOptions options, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as specific image files type and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgimageFileType
- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"options
- TheToImageOptions
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toJpegImages
public final List<String> toJpegImages(String fileNamePattern) throws IOException
Renders the pages of the PDF as JPEG image files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpg- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toJpegImages
public final List<String> toJpegImages(String fileNamePattern, ToImageOptions options) throws IOException
Renders the pages of the PDF as JPEG image files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgoptions
- TheToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toJpegImages
public final List<String> toJpegImages(String fileNamePattern, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as JPEG image files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgpageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toJpegImages
public final List<String> toJpegImages(String fileNamePattern, ToImageOptions options, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as JPEG image files and saves them to disk.Specific image dimensions and page numbers may be given as optional parameters.
fileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers.
- Parameters:
fileNamePattern
- A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpgoptions
- TheToImageOptions
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- An array of the file paths of the image files created.
- Throws:
IOException
- the io exception
-
toMultiPageTiff
public String toMultiPageTiff(Path filePath) throws IOException
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk. Specific image dimensions and page numbers may be given as optional parameters FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers- Parameters:
filePath
- A file path for the output file. E.g. C:\images\pdf_pages.tiff- Returns:
- A file path of the image file created.
- Throws:
IOException
- the io exception
-
toMultiPageTiff
public String toMultiPageTiff(Path filePath, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk. Specific image dimensions and page numbers may be given as optional parameters FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers- Parameters:
filePath
- A file path for the output file. E.g. C:\images\pdf_pages.tiffpageSelection
- Selected page indexes. Default is all pages.- Returns:
- A file path of the image file created.
- Throws:
IOException
- the io exception
-
toMultiPageTiff
public String toMultiPageTiff(Path filePath, ToImageOptions options) throws IOException
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk. Specific image dimensions and page numbers may be given as optional parameters FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers- Parameters:
filePath
- A file path for the output file. E.g. C:\images\pdf_pages.tiffoptions
- TheToImageOptions
- Returns:
- A file path of the image file created.
- Throws:
IOException
- the io exception
-
toMultiPageTiff
public String toMultiPageTiff(Path filePath, ToImageOptions options, PageSelection pageSelection) throws IOException
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk. Specific image dimensions and page numbers may be given as optional parameters FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers- Parameters:
filePath
- A file path for the output file. E.g. C:\images\pdf_pages.tiffoptions
- TheToImageOptions
pageSelection
- Selected page indexes. Default is all pages.- Returns:
- A file path of the image file created.
- Throws:
IOException
- the io exception
-
compressImages
public final void compressImages(int quality)
Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality setting.- Parameters:
quality
- Quality (1 - 100) to use during compression
-
compressImages
public final void compressImages(int quality, boolean scaleToVisibleSize)
Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality settings.- Parameters:
quality
- Quality (1 - 100) to use during compressionscaleToVisibleSize
- Scale down the image resolution according to its visible size in the PDF document; may cause distortion with some image configurations. Default is false.
-
compressStructTree
public final void compressStructTree(int quality, boolean scaleToVisibleSize)
Remove document struct tree information which describes the logical layout of the document. Removing the "structure tree" can significantly reduce the disk space used by the document. Removing the "structure tree" of a complicated document can negatively impact text selection.
-
extractAllImages
public final List<BufferedImage> extractAllImages() throws IOException
Finds all embedded Images from within the PDF and returns them as a list ofBufferedImage
images.- Returns:
- The extracted images as
BufferedImage
objects. - Throws:
IOException
- the io exception
-
extractAllRawImages
public final List<byte[]> extractAllRawImages() throws IOException
Finds all embedded Images from within the PDF and returns as a list of image bytes- Returns:
- The extracted images as byte arrays.
- Throws:
IOException
- the io exception
-
extractAllImagesFromPages
public final List<BufferedImage> extractAllImagesFromPages(PageSelection pageSelection) throws IOException
Finds all embedded Images from within the PDF and returns as a list of image bytes- Parameters:
pageSelection
- The selected page index(es). Default is all pages.- Returns:
- The extracted images as
BufferedImage
objects. - Throws:
IOException
- the io exception
-
extractAllRawImagesFromPages
public final List<byte[]> extractAllRawImagesFromPages(PageSelection pageSelection) throws IOException
Finds all embedded Images from within the PDF and returns them as raw bytes.- Parameters:
pageSelection
- The selected page index(es). Default is all pages.- Returns:
- The extracted images as byte arrays.
- Throws:
IOException
- the io exception
-
saveAs
public final PdfDocument saveAs(Path filePath) throws IOException
Saves this PdfDocument to a file.- Parameters:
filePath
- File Path- Returns:
- This PdfDocument for fluid code notation.
- Throws:
IOException
- the io exception
-
saveAs
public final PdfDocument saveAs(String filePath) throws IOException
Saves this PdfDocument to a file.- Parameters:
filePath
- File path string- Returns:
- This PdfDocument for fluid code notation.
- Throws:
IOException
- the io exception
-
saveAsRevision
public final PdfDocument saveAsRevision(Path filePath) throws IOException
Saves this PdfDocument to a file.- Parameters:
filePath
- File Path- Returns:
- This PdfDocument for fluid code notation.
- Throws:
IOException
- the io exception
-
saveAsRevision
public final PdfDocument saveAsRevision(String filePath) throws IOException
Saves this PdfDocument to a file.- Parameters:
filePath
- File path string- Returns:
- This PdfDocument for fluid code notation.
- Throws:
IOException
- the io exception
-
getBinaryData
public final byte[] getBinaryData()
Saves the PDF as byte array, including any changes.- Returns:
- The PDF file as a byte array.
-
getBinaryDataIncremental
public final byte[] getBinaryDataIncremental()
Saves the PDF as byte array with changes appended to the end of the file.- Returns:
- The PDF file as a byte array.
-
getRevision
public final byte[] getRevision(int index)
Saves the PDF as byte array at the specified revision number.saveAsRevision(java.nio.file.Path)
- Parameters:
index
- revision index- Returns:
- a
PdfDocument
document
-
print
public void print() throws PrinterException
Prints this PDF by sending it to the computer's real world printer(s).For advanced real-world printing options please implement your own java.awt.print code.
This class
PdfDocument
implements java.awt.print.Printable.- Throws:
PrinterException
- the printer exception
-
printWithoutDialog
public void printWithoutDialog() throws PrinterException
Prints this PDF by sending it to the computer's real world printer(s).For advanced real-world printing options please implement your own java.awt.print code.
This class
PdfDocument
implements java.awt.print.Printable.- Throws:
PrinterException
- the printer exception
-
print
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
- Specified by:
print
in interfacePrintable
- Throws:
PrinterException
-
applyWatermark
public final PdfDocument applyWatermark(String html, int opacity, VerticalAlignment verticalAlignment)
Adds a watermark to this PDF.Please use
applyStamp(Stamper)
for more control.- Parameters:
html
- The HTML fragment which will be stamped onto your PDF.opacity
- Watermark transparent value. 0 is invisible, 100 if fully opaque.verticalAlignment
- The vertical alignment of the watermark relative to the page.- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
applyWatermark
public final PdfDocument applyWatermark(String html, int opacity, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
Adds a watermark to this PDF.Please use
applyStamp(Stamper)
for more control.- Parameters:
html
- The HTML fragment which will be stamped onto your PDF.opacity
- Watermark transparent value. 0 is invisible, 100 if fully opaque.verticalAlignment
- The vertical alignment of the watermark relative to the page.horizontalAlignment
- The horizontal alignment of the watermark relative to the page.- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
applyWatermark
public final PdfDocument applyWatermark(String html, int opacity)
Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.- Parameters:
html
- The HTML fragment which will be stamped onto your PDF.opacity
- Watermark transparent value. 0 is invisible, 100 if fully opaque.- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
applyWatermark
public final PdfDocument applyWatermark(String html)
Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.- Parameters:
html
- The HTML fragment which will be stamped onto your PDF.- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
applyStamp
public final PdfDocument applyStamp(Stamper stamper)
Edits the PDF by applying theStamper
's rendered to every page.- Parameters:
stamper
- TheStamper
object that has the content to be stamped onto the PDF.- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
applyStamp
public final PdfDocument applyStamp(Stamper stamper, PageSelection pageSelection)
Edits the PDF by applying theStamper
's rendered to only selected page(s).- Parameters:
stamper
- TheStamper
object that has the content to be stamped onto the PDF.pageSelection
- The selected page index(es). Default is all pages,- Returns:
- Returns this
PdfDocument
, allowing for a 'fluent' chained in-line code style
-
extractAllText
public final String extractAllText()
Extracts the written text content from the PDF and returns it as a string.- Returns:
- All text in the PDF as a string.
Pages are separated by 4 consecutive line breaks
-
extractTextFromPage
public final String extractTextFromPage(PageSelection pageSelection)
Extracts the text content from one page of the PDF and returns it as a string.- Parameters:
pageSelection
- The selected page index(es). Default is all pages.- Returns:
- The text extracted from the PDF page as a string.
-
replaceText
public final void replaceText(PageSelection pageSelection, String oldText, String newText)
Replace the specified old text with new text on a given page.- Parameters:
pageSelection
- The selected page index(es).oldText
- Old text to removenewText
- New text to add
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, String baseUrl) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.baseUrl
- Optional. Setting the BaseURL property gives the relative file path or URL context for hyperlinks, images, CSS and JavaScript files.- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.renderOptions
- Rendering optionsloginCredentials
- Http login credentials- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.baseUrl
- Optional. Setting the BaseURL property gives the relative file path or URL context for hyperlinks, images, CSS and JavaScript files.renderOptions
- Rendering optionsloginCredentials
- Http login credentials- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, ChromeHttpLoginCredentials loginCredentials) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.loginCredentials
- Http login credentials- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromeHttpLoginCredentials loginCredentials) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.baseUrl
- Optional. Setting the BaseURL property gives the relative file path or URL context for hyperlinks, images, CSS and JavaScript files.loginCredentials
- Http login credentials- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.renderOptions
- Rendering options- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderHtmlFileAsPdf
public static PdfDocument renderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions) throws IOException
Creates a PDF file from a local Html file, and returns it as aPdfDocument
.- Parameters:
htmlFilePath
- Path to a Html to be rendered as a PDF.baseUrl
- Optional. Setting the BaseURL property gives the relative file path or URL context for hyperlinks, images, CSS and JavaScript files.renderOptions
- Rendering options- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderUrlAsPdf
public static PdfDocument renderUrlAsPdf(String url)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.- Parameters:
url
- An absolute (fully formed) Uri. Points to the Html document to be rendered as a PDF.- Returns:
- A
PdfDocument
-
renderUrlAsPdf
public static PdfDocument renderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.- Parameters:
url
- An absolute (fully formed) Uri. Points to the Html document to be rendered as a PDF.renderOptions
- Rendering optionsloginCredentials
- Http login credentials- Returns:
- A
PdfDocument
-
renderUrlAsPdf
public static PdfDocument renderUrlAsPdf(String url, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.- Parameters:
url
- An absolute (fully formed) Uri. Points to the Html document to be rendered as a PDF.loginCredentials
- Http login credentials- Returns:
- A
PdfDocument
-
renderUrlAsPdf
public static PdfDocument renderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a URL or local file path and returns it as aPdfDocument
.- Parameters:
url
- An absolute (fully formed) Uri. Points to the Html document to be rendered as a PDF.renderOptions
- Rendering options- Returns:
- A
PdfDocument
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.- Parameters:
html
- The Html to be rendered as a PDF.- Returns:
- A
PdfDocument
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.- Parameters:
html
- The Html to be rendered as a PDF.loginCredentials
- Http login credentials- Returns:
- A
PdfDocument
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.- Parameters:
html
- The Html to be rendered as a PDF.renderOptions
- Rendering options- Returns:
- A
PdfDocument
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)
Creates a PDF file from a Html string, and returns it as aPdfDocument
.- Parameters:
html
- The Html to be rendered as a PDF.renderOptions
- Rendering optionsloginCredentials
- Http login credentials- Returns:
- A
PdfDocument
-
renderRtfAsPdf
public static PdfDocument renderRtfAsPdf(String rtfString)
Creates a PDF file from RTF string, and returns it as aPdfDocument
.- Parameters:
rtfString
- The RTF string to be rendered as a PDF.- Returns:
- A
PdfDocument
-
renderRtfFileAsPdf
public static PdfDocument renderRtfFileAsPdf(String rtfFilePath) throws IOException
Creates a PDF file from RTF file, and returns it as aPdfDocument
.- Parameters:
rtfFilePath
- The RTF file path to be rendered as a PDF.- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderRtfFileAsPdf
public static PdfDocument renderRtfFileAsPdf(Path rtfFilePath) throws IOException
Creates a PDF file from RTF file, and returns it as aPdfDocument
.- Parameters:
rtfFilePath
- The RTF file path to be rendered as a PDF.- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderZipAsPdf
public static PdfDocument renderZipAsPdf(Path zipFilePath, String mainFile, ChromePdfRenderOptions renderOptions) throws IOException
Creates a PDF file from a local Zip file, and returns it as aPdfDocument
.IronPDF is a W3C standards compliant HTML rendering based on Google's Chromium browser. If your output PDF does not look as expected:
- Validate your HTML file using https://validator.w3.org/ & CSS https://jigsaw.w3.org/css-validator/
- To debug HTML, view the file in Chrome web browser's print preview which will work almost exactly as IronPDF.
- Read our detailed documentation on pixel perfect HTML to PDF: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/
- Parameters:
zipFilePath
- Path to a Zip to be rendered as a PDF.mainFile
- Name of the primary HTML file.renderOptions
- Rendering options- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
renderZipAsPdf
public static PdfDocument renderZipAsPdf(Path zipFilePath, String mainFile) throws IOException
Creates a PDF file from a local Zip file, and returns it as aPdfDocument
.IronPDF is a W3C standards compliant HTML rendering based on Google's Chromium browser. If your output PDF does not look as expected:
- Validate your HTML file using https://validator.w3.org/ & CSS https://jigsaw.w3.org/css-validator/
- To debug HTML, view the file in Chrome web browser's print preview which will work almost exactly as IronPDF.
- Read our detailed documentation on pixel perfect HTML to PDF: https://ironpdf.com/tutorials/pixel-perfect-html-to-pdf/
- Parameters:
zipFilePath
- Path to a Zip to be rendered as a PDF.mainFile
- Name of the primary HTML file.- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
saveAsPdfA
public PdfDocument saveAsPdfA(String filePath) throws IOException
Save the current document into the specified PDF-A standard format- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
saveAsPdfA
public PdfDocument saveAsPdfA(String filePath, String customICCFilePath) throws IOException
Save the current document into the specified PDF-A standard format- Parameters:
customICCFilePath
- (Optional) Custom color profile file path- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
convertToPdfA
public PdfDocument convertToPdfA() throws IOException
Convert the current document into the specified PDF-A standard format- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
convertToPdfA
public PdfDocument convertToPdfA(String customICCFilePath) throws IOException
Convert the current document into the specified PDF-A standard format- Parameters:
customICCFilePath
- (Optional) Custom color profile file path- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
saveAsPdfUA
public PdfDocument saveAsPdfUA(String filePath, NaturalLanguages naturalLanguages) throws IOException
Save the current document into the specified PDF/UA standard format- Parameters:
naturalLanguages
- Natural Languages Specification- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
convertToPdfUA
public PdfDocument convertToPdfUA(NaturalLanguages naturalLanguages) throws IOException
Convert the current document into the specified PDF/UA standard format- Parameters:
naturalLanguages
- Natural Languages Specification- Returns:
- A
PdfDocument
- Throws:
IOException
- the io exception
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-