You can find more details at: Save Webpage as PDF in C#
Created
June 10, 2022 13:08
-
-
Save aspose-com-gists/7588fbdd00f173796beaeb57e69cbb58 to your computer and use it in GitHub Desktop.
Save webpage as PDF in C# | C# print web page to PDF
This file contains 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 from URL | |
HTMLDocument document = new HTMLDocument("https://www.aspose.com"); | |
// Initialize PdfPermissions class object to allow printing and form filling in the PDF document | |
PdfPermissions permissions = PdfPermissions.PrintDocument | PdfPermissions.FillForm; | |
// Initialize PdfSaveOptions class object and set the encryption properties | |
PdfSaveOptions options = new PdfSaveOptions(); | |
options.Encryption = new PdfEncryptionInfo("user", "owner", permissions, Encryption.PdfEncryptionAlgorithm.RC4_128); | |
// Save output PDF file with encryption | |
Converter.ConvertHTML(document, options, "URLtoPDF_encrypted.pdf"); |
This file contains 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 | |
HTMLDocument document = new HTMLDocument("https://www.aspose.com"); | |
// Initialize PdfSaveOptions class object | |
PdfSaveOptions options = new PdfSaveOptions(); | |
// Save webpage as PDF in C# | |
Converter.ConvertHTML(document, options, "URLtoPDF.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment