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.PrintableNO_SUCH_PAGE, PAGE_EXISTS
 
- 
 - 
Constructor SummaryConstructors 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 SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfDocumentaddBackgroundPdf(PdfDocument backgroundPdf)Adds a background to each page of this PDF.PdfDocumentaddBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex)Adds a background to each page of this PDF.PdfDocumentaddBackgroundPdf(PdfDocument backgroundPdf, int backgroundPdfPageIndex, PageSelection pageSelection)Adds a background to selected page(s) of this PDF.PdfDocumentaddBackgroundPdf(PdfDocument backgroundPdf, PageSelection pageSelection)Adds a background to selected page(s) of this PDF.PdfDocumentaddForegroundPdf(PdfDocument foregroundPdf)Adds a foreground to each page of this PDF.PdfDocumentaddForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex)Adds a foreground to each page of this PDF.PdfDocumentaddForegroundPdf(PdfDocument foregroundPdf, int foregroundPdfPageIndex, PageSelection pageSelection)Adds a foreground to selected page(s) of this PDF.PdfDocumentaddForegroundPdf(PdfDocument foregroundPdf, PageSelection pageSelection)Adds a foreground to selected page(s) of this PDF.PdfDocumentaddHtmlFooter(HtmlHeaderFooter footer)Renders HTML page footers onto an existing PDF FilePdfDocumentaddHtmlFooter(HtmlHeaderFooter footer, PageSelection pageSelection)Renders HTML page footers onto an existing PDF FilePdfDocumentaddHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions)Renders HTML page footer onto an existing PDF FilePdfDocumentaddHtmlFooter(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)Renders HTML page footer onto an existing PDF FilePdfDocumentaddHtmlHeader(HtmlHeaderFooter header)Renders HTML page headers onto an existing PDF FilePdfDocumentaddHtmlHeader(HtmlHeaderFooter header, PageSelection pageSelection)Renders HTML page headers onto an existing PDF FilePdfDocumentaddHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions)Renders HTML page headers onto an existing PDF FilePdfDocumentaddHtmlHeader(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)Renders HTML page headers onto an existing PDF FilePdfDocumentaddTextFooter(TextHeaderFooter footer)Renders TEXT page footers onto an existing PDF FilePdfDocumentaddTextFooter(TextHeaderFooter footer, PageSelection pageSelection)Renders TEXT page footers onto an existing PDF FilePdfDocumentaddTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions)Renders TEXT page footer onto an existing PDF FilePdfDocumentaddTextFooter(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)Renders TEXT page footer onto an existing PDF FilePdfDocumentaddTextHeader(TextHeaderFooter header)Renders TEXT page headers onto an existing PDF FilePdfDocumentaddTextHeader(TextHeaderFooter header, PageSelection pageSelection)Renders TEXT page headers onto an existing PDF FilePdfDocumentaddTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions)Renders TEXT page headers onto an existing PDF FilePdfDocumentaddTextHeader(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection)Renders TEXT page headers onto an existing PDF FilePdfDocumentappendPdf(PdfDocument AnotherPdfFile)Appends another PDF to the end of the currentPdfDocument.PdfDocumentapplyStamp(Stamper stamper)Edits the PDF by applying theStamper's rendered to every page.PdfDocumentapplyStamp(Stamper stamper, PageSelection pageSelection)Edits the PDF by applying theStamper's rendered to only selected page(s).PdfDocumentapplyWatermark(String html)Adds Watermark to PDF, Please useapplyStamp(Stamper)for more control.PdfDocumentapplyWatermark(String html, int opacity)Adds Watermark to PDF, Please useapplyStamp(Stamper)for more control.PdfDocumentapplyWatermark(String html, int opacity, VerticalAlignment verticalAlignment)Adds a watermark to this PDF.PdfDocumentapplyWatermark(String html, int opacity, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)Adds a watermark to this PDF.voidclose()voidcompressImages(int quality)Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality setting.voidcompressImages(int quality, boolean scaleToVisibleSize)Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality settings.voidcompressStructTree(int quality, boolean scaleToVisibleSize)Remove document struct tree information which describes the logical layout of the document.PdfDocumentconvertToPdfA()Convert the current document into the specified PDF-A standard formatPdfDocumentconvertToPdfA(String customICCFilePath)Convert the current document into the specified PDF-A standard formatPdfDocumentconvertToPdfUA()Convert the current document into the specified PDF/UA standard formatPdfDocumentcopyPage(int PageIndex)Creates a new PDF by copying a page from this PdfDocument into a new blank document.PdfDocumentcopyPages(int StartIndex, int EndIndex)Creates a new PDF by copying a range of pages from thisPdfDocumentinto a new blank document.PdfDocumentcopyPages(PageSelection pageSelection)Creates a new PDF by copying a page from this PdfDocument into a new blank document.voiddrawImage(byte[] imageBytes, DrawImageOptions option)Draws an image onto the PDF documentvoiddrawImage(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 ofBufferedImageimages.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.StringextractAllText()Extracts the written text content from the PDF and returns it as a string.StringextractTextFromPage(PageSelection pageSelection)Extracts the text content from one page of the PDF and returns it as a string.static PdfDocumentfromFile(Path pdfFilePath)Opens an existing PDF document for editing.static PdfDocumentfromFile(Path pdfFilePath, ChangeTrackingModes trackChanges)Opens an existing PDF document for editing.static PdfDocumentfromFile(Path pdfFilePath, String password)Opens an existing PDF document for editing.static PdfDocumentfromFile(Path pdfFilePath, String password, ChangeTrackingModes trackChanges)Opens an existing PDF document for editing.static PdfDocumentfromFile(Path pdfFilePath, String password, String ownerPassword)Opens an existing PDF document for editing.static PdfDocumentfromFile(Path pdfFilePath, String password, String ownerPassword, ChangeTrackingModes trackChanges)Opens an existing PDF document for editing.static PdfDocumentfromImage(List<Path> imagesPath)Converts a single image file to an identical PDF document of matching dimensions.static PdfDocumentfromImage(List<Path> imagesPath, ImageBehavior imageBehavior)Converts a single image file to an identical PDF document of matching dimensions.static PdfDocumentfromImage(List<Path> imagesPath, ImageBehavior imageBehavior, ChromePdfRenderOptions renderOptions)Converts a single image file to an identical PDF document of matching dimensions.static PdfDocumentfromImage(List<Path> imagesPath, ImageBehavior imageBehavior, PaperSize paperSize)Converts a single image file to an identical PDF document of matching dimensions.static PdfDocumentfromImage(List<Path> imagesPath, PaperSize paperSize)Converts a single image file to an identical PDF document of matching dimensions.AnnotationManagergetAnnotation()Gets the annotation manager for this PDF document.AttachmentManagergetAttachment()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.BookmarkManagergetBookmark()Gets the BookmarkManager for this PDF document.FormManagergetForm()Gets the form manager for this PDF document.MetadataManagergetMetadata()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.SecurityManagergetSecurity()Gets security.SignatureManagergetSignature()Gets signature.PdfDocumentinsertPdf(PdfDocument AnotherPdfFile)Inserts another PDF into the current PdfDocument, starting at a given Page Index.PdfDocumentinsertPdf(PdfDocument AnotherPdfFile, int AtIndex)Inserts another PDF into the current PdfDocument, starting at a given Page Index.static PdfDocumentmerge(PdfDocument A, PdfDocument B)Static method that joins (concatenates) 2 PDF documents together into one PDF document.static PdfDocumentmerge(List<PdfDocument> Documents)Static method that joins (concatenates) 2 PDF documents together into one PDF document.PdfDocumentprependPdf(PdfDocument AnotherPdfFile)Adds another PDF to the beginning of the current PdfDocument.voidprint()Prints this PDF by sending it to the computer's real world printer(s).intprint(Graphics graphics, PageFormat pageFormat, int pageIndex)voidprintWithoutDialog()Prints this PDF by sending it to the computer's real world printer(s).PdfDocumentremovePages(PageSelection pageSelection)Removes a range of pages from the PDFstatic PdfDocumentrenderHtmlAsPdf(String html)Creates a PDF file from a Html string, and returns it as aPdfDocument.static PdfDocumentrenderHtmlAsPdf(String html, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a Html string, and returns it as aPdfDocument.static PdfDocumentrenderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions)Creates a PDF file from a Html string, and returns it as aPdfDocument.static PdfDocumentrenderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a Html string, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, String baseUrl)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderHtmlFileAsPdf(String htmlFilePath, String baseUrl, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a local Html file, and returns it as aPdfDocument.static PdfDocumentrenderRtfAsPdf(String rtfString)Creates a PDF file from RTF string, and returns it as aPdfDocument.static PdfDocumentrenderRtfFileAsPdf(String rtfFilePath)Creates a PDF file from RTF file, and returns it as aPdfDocument.static PdfDocumentrenderRtfFileAsPdf(Path rtfFilePath)Creates a PDF file from RTF file, and returns it as aPdfDocument.static PdfDocumentrenderUrlAsPdf(String url)Creates a PDF file from a URL or local file path and returns it as aPdfDocument.static PdfDocumentrenderUrlAsPdf(String url, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a URL or local file path and returns it as aPdfDocument.static PdfDocumentrenderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions)Creates a PDF file from a URL or local file path and returns it as aPdfDocument.static PdfDocumentrenderUrlAsPdf(String url, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials)Creates a PDF file from a URL or local file path and returns it as aPdfDocument.static PdfDocumentrenderZipAsPdf(Path zipFilePath, String mainFile)Creates a PDF file from a local Zip file, and returns it as aPdfDocument.static PdfDocumentrenderZipAsPdf(Path zipFilePath, String mainFile, ChromePdfRenderOptions renderOptions)Creates a PDF file from a local Zip file, and returns it as aPdfDocument.voidreplaceText(PageSelection pageSelection, String oldText, String newText)Replace the specified old text with new text on a given page.voidresizePage(double pageWidth, double pageHeight, PageSelection pageSelection)Resize a page to the specified dimensions (in millimeters)voidrotateAllPages(PageRotation rotation)Rotates all pages of the PdfDocument by a specified number of degrees.voidrotatePage(PageRotation pageRotation, PageSelection pageSelection)Rotates a selection page of the PdfDocument by a specified number of degrees.PdfDocumentsaveAs(String filePath)Saves this PdfDocument to a file.PdfDocumentsaveAs(Path filePath)Saves this PdfDocument to a file.PdfDocumentsaveAsPdfA(String filePath)Save the current document into the specified PDF-A standard formatPdfDocumentsaveAsPdfA(String filePath, String customICCFilePath)Save the current document into the specified PDF-A standard formatPdfDocumentsaveAsPdfUA(String filePath)Save the current document into the specified PDF/UA standard formatPdfDocumentsaveAsRevision(String filePath)Saves this PdfDocument to a file.PdfDocumentsaveAsRevision(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.StringtoMultiPageTiff(Path filePath)Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.StringtoMultiPageTiff(Path filePath, PageSelection pageSelection)Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.StringtoMultiPageTiff(Path filePath, ToImageOptions options)Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.StringtoMultiPageTiff(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- 
PdfDocumentpublic 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
 
 - 
PdfDocumentpublic 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
 
 - 
PdfDocumentpublic 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
 
 - 
PdfDocumentpublic 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
 
 - 
PdfDocumentpublic 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..)
 
 - 
PdfDocumentpublic 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)
 
 - 
PdfDocumentpublic PdfDocument(Path pdfFilePath) throws IOException Opens an existing PDF document for editing.- Parameters:
- pdfFilePath- The PDF file path.
- Throws:
- IOException- the io exception
 
 - 
PdfDocumentpublic 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
 
 - 
PdfDocumentpublic 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.
 
 - 
PdfDocumentpublic 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)
 
 - 
PdfDocumentpublic PdfDocument(byte[] pdfData) Opens an existing PDF document for editing.- Parameters:
- pdfData- The PDF file data as byte array.
 
 - 
PdfDocumentpublic 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- 
fromFilepublic 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
 
 - 
fromFilepublic 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
 
 - 
fromFilepublic 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
 
 - 
fromFilepublic 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
 
 - 
fromFilepublic 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
 
 - 
fromFilepublic 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
 
 - 
fromImagepublic 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 PdfDocumentdocument which can then be edited, saved or served over the web.
 
 - 
fromImagepublic 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 PdfDocumentdocument which can then be edited, saved or served over the web.
 
 - 
fromImagepublic 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 PdfDocumentdocument which can then be edited, saved or served over the web.
 
 - 
fromImagepublic 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 PdfDocumentdocument which can then be edited, saved or served over the web.
 
 - 
fromImagepublic 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 PdfDocumentdocument which can then be edited, saved or served over the web.
 
 - 
getBookmarkpublic 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
 
 - 
getMetadatapublic 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
 
 - 
getAnnotationpublic AnnotationManager getAnnotation() Gets the annotation manager for this PDF document. AnnotationManager allows annotation objects to be edited.See: AnnotationManager.- Returns:
- the AnnotationManager
 
 - 
getFormpublic FormManager getForm() Gets the form manager for this PDF document. FormManager allows AcroForm fields to be read and set.See: FormManager.- Returns:
- the FormManager
 
 - 
getAttachmentpublic AttachmentManager getAttachment() Gets the attachment manager for this PDF document. AttachmentManager allows attachment objects to be edited.See: AttachmentManager.- Returns:
- the AttachmentManager
 
 - 
getSecuritypublic SecurityManager getSecurity() Gets security.- Returns:
- the SecurityManager
 
 - 
getSignaturepublic SignatureManager getSignature() Gets signature.- Returns:
- the SignatureManager
 
 - 
mergepublic 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 PDF
- B- A Seconds PDF
- Returns:
- A new, merged PdfDocument
 
 - 
mergepublic 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
 
 - 
copyPagepublic 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
 
 - 
copyPagespublic 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
 
 - 
copyPagespublic final PdfDocument copyPages(int StartIndex, int EndIndex) Creates a new PDF by copying a range of pages from thisPdfDocumentinto a new blank document.- Parameters:
- StartIndex- The index of the first PDF page to copy. Note: Page 1 has index 0
- EndIndex- The index of the last PDF page to copy.
- Returns:
- A new PdfDocument
 
 - 
appendPdfpublic 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
 
 - 
insertPdfpublic 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
 
 - 
insertPdfpublic 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
 
 - 
prependPdfpublic 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
 
 - 
removePagespublic 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
 
 - 
getPagesInfopublic 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.
 
 - 
getPagesInfopublic 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.
 
 - 
rotateAllPagespublic 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
 
 - 
rotatePagepublic 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 270
- pageSelection- Selected page indexes. Default is all pages.
 
 - 
resizePagepublic final void resizePage(double pageWidth, double pageHeight, PageSelection pageSelection)Resize a page to the specified dimensions (in millimeters)- Parameters:
- pageWidth- Desired page width, in millimeters
- pageHeight- Desired page height, in millimeters
- pageSelection- Selected page indexes.
 
 - 
addBackgroundPdfpublic 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
 
 - 
addBackgroundPdfpublic 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
 
 - 
addBackgroundPdfpublic 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
 
 - 
addBackgroundPdfpublic 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
 
 - 
addForegroundPdfpublic 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
 
 - 
addForegroundPdfpublic 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
 
 - 
addForegroundPdfpublic 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
 
 - 
addForegroundPdfpublic 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
 
 - 
addTextHeaderpublic 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
 
 - 
addTextHeaderpublic 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
 
 - 
addTextHeaderpublic 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
 
 - 
addTextHeaderpublic 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
 
 - 
addTextFooterpublic 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
 
 - 
addTextFooterpublic 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
 
 - 
addTextFooterpublic 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
 
 - 
addTextFooterpublic 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
 
 - 
addHtmlHeaderpublic 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
 
 - 
addHtmlHeaderpublic 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
 
 - 
addHtmlHeaderpublic 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
 
 - 
addHtmlHeaderpublic 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
 
 - 
addHtmlFooterpublic 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
 
 - 
addHtmlFooterpublic 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
 
 - 
addHtmlFooterpublic 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
 
 - 
addHtmlFooterpublic 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
 
 - 
drawImagepublic 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
 
 - 
drawImagepublic final void drawImage(byte[] imageBytes, DrawImageOptions option)Draws an image onto the PDF document- Parameters:
- imageBytes- image byte array
- option- the option
 
 - 
toBufferedImagespublic 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
 
 - 
toBufferedImagespublic final List<BufferedImage> toBufferedImages(ToImageOptions options) throws IOException Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Parameters:
- options- The- ToImageOptions
- Returns:
- An array of BufferedImage objects.
- Throws:
- IOException- the io exception
 
 - 
toBufferedImagespublic 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
 
 - 
toBufferedImagespublic final List<BufferedImage> toBufferedImages(ToImageOptions options, PageSelection pageSelection) throws IOException Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Parameters:
- options- The- ToImageOptions
- pageSelection- Selected page indexes. Default is all pages.
- Returns:
- An array of BufferedImage objects.
- Throws:
- IOException- the io exception
 
 - 
toPngImagespublic 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
 
 - 
toPngImagespublic 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_*.png
- options- The- ToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
- IOException- the io exception
 
 - 
toPngImagespublic 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_*.png
- 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
 
 - 
toPngImagespublic 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_*.png
- options- The- ToImageOptions
- 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
 
 - 
toImagespublic 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_*.jpg
- imageFileType- 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
 
 - 
toImagespublic 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_*.jpg
- imageFileType- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"
- options- The- ToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
- IOException- the io exception
 
 - 
toImagespublic 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_*.jpg
- imageFileType- 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
 
 - 
toImagespublic 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_*.jpg
- imageFileType- a specific image file type without dot. E.g. "jpg", "png", "bmp", "gif", "tiff"
- options- The- ToImageOptions
- 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
 
 - 
toJpegImagespublic 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
 
 - 
toJpegImagespublic 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_*.jpg
- options- The- ToImageOptions
- Returns:
- An array of the file paths of the image files created.
- Throws:
- IOException- the io exception
 
 - 
toJpegImagespublic 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_*.jpg
- 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
 
 - 
toJpegImagespublic 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_*.jpg
- options- The- ToImageOptions
- 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
 
 - 
toMultiPageTiffpublic 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
 
 - 
toMultiPageTiffpublic 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.tiff
- pageSelection- Selected page indexes. Default is all pages.
- Returns:
- A file path of the image file created.
- Throws:
- IOException- the io exception
 
 - 
toMultiPageTiffpublic 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.tiff
- options- The- ToImageOptions
- Returns:
- A file path of the image file created.
- Throws:
- IOException- the io exception
 
 - 
toMultiPageTiffpublic 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.tiff
- options- The- ToImageOptions
- pageSelection- Selected page indexes. Default is all pages.
- Returns:
- A file path of the image file created.
- Throws:
- IOException- the io exception
 
 - 
compressImagespublic 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
 
 - 
compressImagespublic 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 compression
- scaleToVisibleSize- Scale down the image resolution according to its visible size in the PDF document; may cause distortion with some image configurations. Default is false.
 
 - 
compressStructTreepublic 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.
 - 
extractAllImagespublic final List<BufferedImage> extractAllImages() throws IOException Finds all embedded Images from within the PDF and returns them as a list ofBufferedImageimages.- Returns:
- The extracted images as BufferedImageobjects.
- Throws:
- IOException- the io exception
 
 - 
extractAllRawImagespublic 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
 
 - 
extractAllImagesFromPagespublic 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 BufferedImageobjects.
- Throws:
- IOException- the io exception
 
 - 
extractAllRawImagesFromPagespublic 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
 
 - 
saveAspublic 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
 
 - 
saveAspublic 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
 
 - 
saveAsRevisionpublic 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
 
 - 
saveAsRevisionpublic 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
 
 - 
getBinaryDatapublic final byte[] getBinaryData() Saves the PDF as byte array, including any changes.- Returns:
- The PDF file as a byte array.
 
 - 
getBinaryDataIncrementalpublic 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.
 
 - 
getRevisionpublic 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 PdfDocumentdocument
 
 - 
printpublic void print() throws PrinterExceptionPrints 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 PdfDocumentimplements java.awt.print.Printable.- Throws:
- PrinterException- the printer exception
 
 - 
printWithoutDialogpublic void printWithoutDialog() throws PrinterExceptionPrints 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 PdfDocumentimplements java.awt.print.Printable.- Throws:
- PrinterException- the printer exception
 
 - 
printpublic int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException - Specified by:
- printin interface- Printable
- Throws:
- PrinterException
 
 - 
applyWatermarkpublic 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
 
 - 
applyWatermarkpublic 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
 
 - 
applyWatermarkpublic 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
 
 - 
applyWatermarkpublic 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
 
 - 
applyStamppublic final PdfDocument applyStamp(Stamper stamper) Edits the PDF by applying theStamper's rendered to every page.- Parameters:
- stamper- The- Stamperobject that has the content to be stamped onto the PDF.
- Returns:
- Returns this PdfDocument, allowing for a 'fluent' chained in-line code style
 
 - 
applyStamppublic final PdfDocument applyStamp(Stamper stamper, PageSelection pageSelection) Edits the PDF by applying theStamper's rendered to only selected page(s).- Parameters:
- stamper- The- Stamperobject 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
 
 - 
extractAllTextpublic 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 
 
 - 
extractTextFromPagepublic 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.
 
 - 
replaceTextpublic 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 remove
- newText- New text to add
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderHtmlFileAsPdfpublic 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 options
- loginCredentials- Http login credentials
- Returns:
- A PdfDocument
- Throws:
- IOException- the io exception
 
 - 
renderHtmlFileAsPdfpublic 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 options
- loginCredentials- Http login credentials
- Returns:
- A PdfDocument
- Throws:
- IOException- the io exception
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderHtmlFileAsPdfpublic 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
 
 - 
renderUrlAsPdfpublic 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
 
 - 
renderUrlAsPdfpublic 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 options
- loginCredentials- Http login credentials
- Returns:
- A PdfDocument
 
 - 
renderUrlAsPdfpublic 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
 
 - 
renderUrlAsPdfpublic 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
 
 - 
renderHtmlAsPdfpublic 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
 
 - 
renderHtmlAsPdfpublic 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
 
 - 
renderHtmlAsPdfpublic 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
 
 - 
renderHtmlAsPdfpublic 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 options
- loginCredentials- Http login credentials
- Returns:
- A PdfDocument
 
 - 
renderRtfAsPdfpublic 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
 
 - 
renderRtfFileAsPdfpublic 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
 
 - 
renderRtfFileAsPdfpublic 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
 
 - 
renderZipAsPdfpublic 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
 
 - 
renderZipAsPdfpublic 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
 
 - 
saveAsPdfApublic 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
 
 - 
saveAsPdfApublic 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
 
 - 
convertToPdfApublic PdfDocument convertToPdfA() throws IOException Convert the current document into the specified PDF-A standard format- Returns:
- A PdfDocument
- Throws:
- IOException- the io exception
 
 - 
convertToPdfApublic 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
 
 - 
saveAsPdfUApublic PdfDocument saveAsPdfUA(String filePath) throws IOException Save the current document into the specified PDF/UA standard format- Returns:
- A PdfDocument
- Throws:
- IOException- the io exception
 
 - 
convertToPdfUApublic PdfDocument convertToPdfUA() throws IOException Convert the current document into the specified PDF/UA standard format- Returns:
- A PdfDocument
- Throws:
- IOException- the io exception
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
 
 
- 
 
-