Hi all,
I am trying to use ASPOSE.Html for .Net to export a WebPage to PDF from any entered URL. However the output is missing all styling and images - sometimes even content.
To test, I used the following URLs:
Attached are the outputs for that URL from: 1) The code below 2) Edge print-to-PDF
1 - docs-aspose-com-html-net-working-with-documents-environment-configuration-.pdf (1.1 KB)
2 - docs-aspose-com-html-net-working-with-documents-environment-configuration-.pdf (230.5 KB)
1 - ineight-com-.pdf (822.2 KB)
2 - ineight-com-.pdf (8.5 MB)
Following is the code used:
using (var configuration = new Configuration())
{
Aspose.Html.Net.RequestMessage requestMessage = new Aspose.Html.Net.RequestMessage(webTargetURL);
configuration.Security = Sandbox.None;
var options = new Aspose.Html.Saving.PdfSaveOptions()
{
Css =
{
MediaType= Aspose.Html.Rendering.MediaType.Print
}
};
// Initialize an HTML document with specified configuration
using (var document = new HTMLDocument(requestMessage, configuration))
{
// Convert HTML to PDF
Converter.ConvertHTML(document, options, Path.Combine(outputFolder, outputFilename));
}
}
Any help in figuring out how to get this exported is highly appreciated!
Thanks!