You can find more details at: Save Webpage as PDF in Java
Last active
June 10, 2022 13:03
-
-
Save farhan-raza/81e031e7252bb15fe4b33fbeb86310af to your computer and use it in GitHub Desktop.
Save webpage as PDF in Java | Print web page to PDF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input HTML file from URL | |
HTMLDocument document = new HTMLDocument("https://www.aspose.com/"); | |
// Initialize PdfSaveOptions class object and set the encryption properties | |
PdfSaveOptions options = new PdfSaveOptions(); | |
options.setEncryption(new PdfEncryptionInfo("user", "owner", PdfPermissions.PrintDocument, PdfEncryptionAlgorithm.RC4_128)); | |
// Save output PDF file with encryption | |
Converter.convertHTML(document, options, "URLtoPDF_encrypted.pdf"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load input HTML file from URL | |
HTMLDocument document = new HTMLDocument("https://www.aspose.com"); | |
// Initialize PdfSaveOptions class object | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Save webpage as PDF in Java | |
Converter.convertHTML(document, options, "URLtoPDF.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment