Created
February 29, 2020 02:22
-
-
Save aspose-com-gists/ad68c928411bded41103ded76e6554c6 to your computer and use it in GitHub Desktop.
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
WebRequest req = WebRequest.Create(@"https://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html"); | |
// Get web page into stream | |
using (Stream stream = req.GetResponse().GetResponseStream()) | |
{ | |
// Initialize HTML load options | |
HtmlLoadOptions htmloptions = new HtmlLoadOptions("https://docs.oracle.com/"); | |
// Load stream into Document object | |
Document pdfDocument = new Document(stream, htmloptions); | |
// Save output as PDF format | |
pdfDocument.Save("HTML-to-PDF.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
// Create HTML load options | |
HtmlLoadOptions htmloptions = new HtmlLoadOptions(); | |
// Load HTML file | |
Document doc = new Document("HTML-Document.html", htmloptions); | |
// Set encryption parameters | |
doc.Encrypt("userpassword", "ownerPassword", Permissions.ModifyContent, CryptoAlgorithm.AESx256); | |
// Convert HTML file to PDF | |
doc.Save("HTML-to-PDF.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
// Create HTML load options | |
HtmlLoadOptions htmloptions = new HtmlLoadOptions(); | |
// Load HTML file | |
Document doc = new Document("HTML-Document.html", htmloptions); | |
// Convert HTML file to PDF | |
doc.Save("HTML-to-PDF.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment