HTML to pdf awesome SVG Icons not working


#1

Dear Colleagues

We would like to convert html files to pdf. We have some awesome icons in the html in svg format which do not work, see attached images.

For more information regarding awesome: https://fontawesome.com/how-to-use/on-the-web/setup/getting-started?using=svg-with-js

And also the css style from the css file do not work.

Thanks a lot.

Kind regards.
Marc Huber

image1.png (99.0 KB)
image1.png (99.0 KB)
image2.png (79.8 KB)


#2

@marchuber

Thank you for contacting support.

Would you please share the source and generated files by uploading a ZIP file, along with the code snippet so that we may investigate further to help you out. Before sharing requested data, please ensure using Aspose.HTML for .NET 18.9 in your environment.


#3

Dear Farhan

Here is the code:

case "html":
	using (Stream stream = File.Open(path, FileMode.Open))
	{
		// .pdf
		MemoryStream dstStream = new MemoryStream();
		Html.Rendering.Pdf.PdfRenderingOptions pdf_options = new Html.Rendering.Pdf.PdfRenderingOptions();
		using (Html.Rendering.Pdf.PdfDevice pdf_device = new Html.Rendering.Pdf.PdfDevice(pdf_options, dstStream))
		using (Html.Rendering.HtmlRenderer renderer = new Html.Rendering.HtmlRenderer())
		using (Html.HTMLDocument html_document = new Html.HTMLDocument(stream, ""))
		{
			renderer.Render(pdf_device, html_document);
		}
		dstStream.Position = 0;
		string outputPath = Path.Combine(outputRootPath, Path.GetFileNameWithoutExtension(path) + " " + DateTime.Now.Ticks.ToString() + ".pdf");
		using (FileStream fs = new FileStream(outputPath, FileMode.CreateNew, FileAccess.Write))
		{
			dstStream.CopyTo(fs);
		}
		dstStream.Close();
		stream.Position = 0;

	}
	fileName = Path.Combine(outputRootPath, Path.GetFileNameWithoutExtension(path) + " " + DateTime.Now.Ticks.ToString() + extension);
	if (!File.Exists(fileName))
	{
		File.Copy(path, fileName);
	}
	break;

Thanks.

Marc Huber

SourceFiles.zip (890.0 KB)
Output.zip (45.7 KB)


#4

@marchuber

We have worked with the data shared by you and have been able to notice the difference. A ticket with ID HTMLNET-1516 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.