Dear Aspose Team,
I have a requirement to convert web site( user will provide web site url) to image using .NET and display on the page.
I tried with the below code:
Approach-1:
// Initialize an HTML document from the file
using var document = new HTMLDocument(“Message Handlers | C#”);
// Create an instance of the ImageRenderingOptions class
var imageOptions = new ImageRenderingOptions(ImageFormat.Jpeg);
// Create an instance of the ImageDevice
using var device = new ImageDevice(imageOptions, savePath);
// Render HTML to JPG
document.RenderTo(device);
Approach -2:
// Initialize an HTML document from the file
var document = new HTMLDocument(“Message Handlers | C#”);
// Initialize ImageSaveOptions
var options = new Aspose.Html.Saving.ImageSaveOptions(ImageFormat.Png);
// Convert HTML to PNG
Converter.ConvertHTML(document, options, “test-html.png”);
The code is working fine for the url. But, It’s not working if i give some urls.
Example:
Please help me.
Regards,
Kamal