I’m trying to convert HTML with inline SVG to PDF. The inline SVG is inserted as an image and a base64 string:
<img src="data:image/svg+xml;base64,PHN2ZyB4bWxu....">
However, I keep getting the following error when saving the document:
“Exception”:"System.ArgumentException: Parameter is not valid. at System.Drawing.Graphics.set_Transform(Matrix value)
I’ve tried to use the CustomLoaderOfExternalResources to load the SVG manually; first by removing “data:image/svg+xml;base64,” from the src and then converting the base64 string to a byte array and then returned the ResourceLoadingResult, like so:
new Aspose.Pdf.LoadOptions.ResourceLoadingResult(resultBytes)
{
// Set MIME Type
MIMETypeIfKnown = "image/svg+xml"
};
Is there any way to make inline SVG as image work? This error only appears on a Linux server. The code works perfectly locally on my Windows machine. Btw, I’m using Aspose.PDF 21.10.1