Class PdfDocument
- All Implemented Interfaces:
Printable
-
Field Summary
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
ConstructorDescriptionPdfDocument
(byte[] pdfData) Opens an existing PDF document for editing.PdfDocument
(byte[] pdfData, String password) Opens an existing PDF document for editing.PdfDocument
(byte[] pdfData, String password, String ownerPassword) Opens an existing PDF document for editing.PdfDocument
(Path pdfFilePath) Opens an existing PDF document for editing.PdfDocument
(Path pdfFilePath, String password) Opens an existing PDF document for editing.PdfDocument
(Path pdfFilePath, String password, String ownerPassword) Opens an existing PDF document for editing. -
Method Summary
Modifier and TypeMethodDescriptionfinal PdfDocument
addBackgroundPdf
(PdfDocument backgroundPdf) Adds a background to each page of this PDF.final PdfDocument
addBackgroundPdf
(PdfDocument backgroundPdf, int backgroundPdfPageIndex) Adds a background to each page of this PDF.final PdfDocument
addBackgroundPdf
(PdfDocument backgroundPdf, int backgroundPdfPageIndex, PageSelection pageSelection) Adds a background to selected page(s) of this PDF.final PdfDocument
addBackgroundPdf
(PdfDocument backgroundPdf, PageSelection pageSelection) Adds a background to selected page(s) of this PDF.final PdfDocument
addForegroundPdf
(PdfDocument foregroundPdf) Adds a foreground to each page of this PDF.final PdfDocument
addForegroundPdf
(PdfDocument foregroundPdf, int foregroundPdfPageIndex) Adds a foreground to each page of this PDF.final PdfDocument
addForegroundPdf
(PdfDocument foregroundPdf, int foregroundPdfPageIndex, PageSelection pageSelection) Adds a foreground to selected page(s) of this PDF.final PdfDocument
addForegroundPdf
(PdfDocument foregroundPdf, PageSelection pageSelection) Adds a foreground to selected page(s) of this PDF.addHtmlFooter
(HtmlHeaderFooter footer) Renders HTML page footers onto an existing PDF FileaddHtmlFooter
(HtmlHeaderFooter footer, PageSelection pageSelection) Renders HTML page footers onto an existing PDF FileaddHtmlFooter
(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions) Renders HTML page footer onto an existing PDF FileaddHtmlFooter
(HtmlHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection) Renders HTML page footer onto an existing PDF FileaddHtmlHeader
(HtmlHeaderFooter header) Renders HTML page headers onto an existing PDF FileaddHtmlHeader
(HtmlHeaderFooter header, PageSelection pageSelection) Renders HTML page headers onto an existing PDF FileaddHtmlHeader
(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions) Renders HTML page headers onto an existing PDF FileaddHtmlHeader
(HtmlHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection) Renders HTML page headers onto an existing PDF FileaddTextFooter
(TextHeaderFooter footer) Renders TEXT page footers onto an existing PDF FileaddTextFooter
(TextHeaderFooter footer, PageSelection pageSelection) Renders TEXT page footers onto an existing PDF FileaddTextFooter
(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions) Renders TEXT page footer onto an existing PDF FileaddTextFooter
(TextHeaderFooter footer, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection) Renders TEXT page footer onto an existing PDF FileaddTextHeader
(TextHeaderFooter header) Renders TEXT page headers onto an existing PDF FileaddTextHeader
(TextHeaderFooter header, PageSelection pageSelection) Renders TEXT page headers onto an existing PDF FileaddTextHeader
(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions) Renders TEXT page headers onto an existing PDF FileaddTextHeader
(TextHeaderFooter header, HeaderFooterOptions headerFooterOptions, PageSelection pageSelection) Renders TEXT page headers onto an existing PDF Filefinal PdfDocument
appendPdf
(PdfDocument AnotherPdfFile) Appends another PDF to the end of the currentPdfDocument
.final PdfDocument
applyStamp
(Stamper stamper) Edits the PDF by applying theStamper
's rendered to every page.final PdfDocument
applyStamp
(Stamper stamper, PageSelection pageSelection) Edits the PDF by applying theStamper
's rendered to only selected page(s).final PdfDocument
applyWatermark
(String html) Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.final PdfDocument
applyWatermark
(String html, int opacity) Adds Watermark to PDF, Please useapplyStamp(Stamper)
for more control.final PdfDocument
applyWatermark
(String html, int opacity, VerticalAlignment verticalAlignment) Adds a watermark to this PDF.final PdfDocument
applyWatermark
(String html, int opacity, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment) Adds a watermark to this PDF.final void
compressImages
(int quality) Reduces the PDF's file size by compressing existing images using JPEG encoding and the specified quality setting.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.final PdfDocument
copyPage
(int PageIndex) Creates a new PDF by copying a page from this PdfDocument into a new blank document.final PdfDocument
copyPages
(int StartIndex, int EndIndex) Creates a new PDF by copying a range of pages from thisPdfDocument
into a new blank document.final PdfDocument
Creates a new PDF by copying a page from this PdfDocument into a new blank document.final void
drawImage
(byte[] imageBytes, DrawImageOptions option) Draws an image onto the PDF documentfinal void
drawImage
(Path imagePath, DrawImageOptions option) Draws an image onto the PDF documentfinal List<BufferedImage>
Finds all embedded Images from within the PDF and returns them as a list ofBufferedImage
images.final List<BufferedImage>
extractAllImagesFromPages
(PageSelection pageSelection) Finds all embedded Images from within the PDF and returns as a list of image bytesfinal List<byte[]>
Finds all embedded Images from within the PDF and returns as a list of image bytesfinal List<byte[]>
extractAllRawImagesFromPages
(PageSelection pageSelection) Finds all embedded Images from within the PDF and returns them as raw bytes.final String
Extracts the written text content from the PDF and returns it as a string.final String
extractTextFromPage
(PageSelection pageSelection) Extracts the text content from one page of the PDF and returns it as a string.static PdfDocument
Opens an existing PDF document for editing.static PdfDocument
Opens an existing PDF document for editing.static PdfDocument
Opens an existing PDF document for editing.static PdfDocument
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
Converts a single image file to an identical PDF document of matching dimensions.Gets the annotation manager for this PDF document.Gets the attachment manager for this PDF document.final byte[]
Returns the binary data for the full PDF file.Gets the BookmarkManager for this PDF document.getForm()
Gets the form manager for this PDF document.Gets the metadata manager for this PDF document.Gets a list of information about pages in this PDF as a List ofPageInfo
.getPagesInfo
(PageSelection pageSelection) Gets a Map of information a selection of pages in this PDF as a List ofPageInfo
.Gets security.Gets signature.final PdfDocument
insertPdf
(PdfDocument AnotherPdfFile) Inserts another PDF into the current PdfDocument, starting at a given Page Index.final 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.final 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
Prints this PDF by sending it to the computer's real world printer(s).final 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
renderHtmlAsPdf
(String html, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials, String baseUrl) Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf
(String html, String baseUrl) Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf
(String html, String baseUrl, ChromeHttpLoginCredentials loginCredentials) Creates a PDF file from a Html string, and returns it as aPdfDocument
.static PdfDocument
renderHtmlAsPdf
(String html, String baseUrl, ChromePdfRenderOptions renderOptions) 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
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
.final void
replaceText
(PageSelection pageSelection, String oldText, String newText) Replace the specified old text with new text on a given page.final void
rotateAllPages
(PageRotation rotation) Rotates all pages of the PdfDocument by a specified number of degrees.final void
rotatePage
(PageRotation pageRotation, PageSelection pageSelection) Rotates a selection page of the PdfDocument by a specified number of degrees.final PdfDocument
Saves this PdfDocument to a file.final PdfDocument
Saves this PdfDocument to a file.final List<BufferedImage>
Rasterizes (renders) the PDF into BufferedImage objects.final List<BufferedImage>
toBufferedImages
(PageSelection pageSelection) Rasterizes (renders) the PDF into BufferedImage objects.final List<BufferedImage>
toBufferedImages
(ToImageOptions options) Rasterizes (renders) the PDF into BufferedImage objects.final List<BufferedImage>
toBufferedImages
(ToImageOptions options, PageSelection pageSelection) Rasterizes (renders) the PDF into BufferedImage objects.Renders the pages of the PDF as specific image files type and saves them to disk.toImages
(String fileNamePattern, String imageFileType, PageSelection pageSelection) Renders the pages of the PDF as specific image files type and saves them to disk.toImages
(String fileNamePattern, String imageFileType, ToImageOptions options) Renders the pages of the PDF as specific image files type and saves them to disk.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.toJpegImages
(String fileNamePattern) Renders the pages of the PDF as JPEG image files and saves them to disk.toJpegImages
(String fileNamePattern, PageSelection pageSelection) Renders the pages of the PDF as JPEG image files and saves them to disk.toJpegImages
(String fileNamePattern, ToImageOptions options) Renders the pages of the PDF as JPEG image files and saves them to disk.toJpegImages
(String fileNamePattern, ToImageOptions options, PageSelection pageSelection) Renders the pages of the PDF as JPEG image files and saves them to disk.toMultiPageTiff
(Path filePath) Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.toMultiPageTiff
(Path filePath, PageSelection pageSelection) Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.toMultiPageTiff
(Path filePath, ToImageOptions options) Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it to disk.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.toPngImages
(String fileNamePattern) Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.toPngImages
(String fileNamePattern, PageSelection pageSelection) Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.toPngImages
(String fileNamePattern, ToImageOptions options) Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.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 Details
-
PdfDocument
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
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
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
Opens an existing PDF document for editing.- Parameters:
pdfFilePath
- The PDF file path.- Throws:
IOException
- the io exception
-
PdfDocument
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) Opens an existing PDF document for editing.- Parameters:
pdfData
- The PDF file data as byte array.
-
-
Method Details
-
fromFile
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, 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
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
-
fromImage
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
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
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
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
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
Gets the annotation manager for this PDF document. AnnotationManager allows annotation objects to be edited.See:
AnnotationManager
.- Returns:
- the AnnotationManager
-
getForm
Gets the form manager for this PDF document. FormManager allows AcroForm fields to be read and set.See:
FormManager
.- Returns:
- the FormManager
-
getAttachment
Gets the attachment manager for this PDF document. AttachmentManager allows attachment objects to be edited.See:
AttachmentManager
.- Returns:
- the AttachmentManager
-
getSecurity
Gets security.- Returns:
- the SecurityManager
-
getSignature
Gets signature.- Returns:
- the SignatureManager
-
merge
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
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
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
Creates a new PDF by copying a page from this PdfDocument into a new blank document.- Parameters:
PageIndexes
- An IEnumerable of page indexes to copy into the new PDF.- Returns:
- A new
PdfDocument
-
copyPages
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
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
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
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
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
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
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
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
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
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.
-
addBackgroundPdf
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
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
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
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
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
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
-
drawImage
Draws an image onto the PDF document- Parameters:
imagePath
- The image file path.option
- the option- Throws:
IOException
- the io exception
-
drawImage
Draws an image onto the PDF document- Parameters:
imageBytes
- image byte arrayoption
- the option
-
toBufferedImages
Rasterizes (renders) the PDF into BufferedImage objects. 1 BufferedImage for each page.- Returns:
- An array of BufferedImage objects.
- Throws:
IOException
- the io exception
-
toBufferedImages
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
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
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
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
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
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
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
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.
-
extractAllImages
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
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
Saves this PdfDocument to a file.- Parameters:
filePath
- File Path- Returns:
- This PdfDocument for fluid code notation.
- Throws:
IOException
- the io exception
-
saveAs
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()Returns the binary data for the full PDF file.- Returns:
- This PdfDocument expressed as a byte array.
-
print
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
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
- 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
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
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
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
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
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
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
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
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, 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
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html, ChromePdfRenderOptions renderOptions, ChromeHttpLoginCredentials loginCredentials, String baseUrl) 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 credentialsbaseUrl
- Optional. Setting the BaseURL property gives the relative file path or URL context for hyperlinks, images, CSS and JavaScript files.- Returns:
- A
PdfDocument
-
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, 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
-
renderUrlAsPdf
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
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
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
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, String baseUrl, 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.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
-
renderHtmlAsPdf
public static PdfDocument renderHtmlAsPdf(String html, String baseUrl, 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.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
-
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
-
renderHtmlAsPdf
Creates a PDF file from a Html string, and returns it as aPdfDocument
.- Parameters:
html
- The 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
-
renderHtmlAsPdf
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
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
-
renderRtfAsPdf
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
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
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
-