We need to create a pdf based on a SVG file.
Goal is the keep the text from the svg file searchable/selectable in the pdf.
The following code converts a svg file to a pdf and it takes 20 seconds for a simple one page pdf to create.
The svg image use in the example is attached to this issue.
What is the reason for this bad performance?
Is there any faster way to create a pdf based on a svg while keeping the text in the pdf selectable?
private static void ConvertSvgToPdfTest()
{
using (MemoryStream msSvg = new MemoryStream(System.IO.File.ReadAllBytes(@"C:\temp\qrbill.svg")))
{
using (var document = new Aspose.Html.Dom.Svg.SVGDocument(msSvg, ""))
{
// Initialize PdfSaveOptions.
// Set A5 as a page-size and change the background color to green
var options = new Aspose.Html.Saving.PdfSaveOptions()
{
PageSetup =
{
AnyPage = new Aspose.Html.Drawing.Page()
{
Size = new Aspose.Html.Drawing.Size(Aspose.Html.Drawing.Length.FromCentimeters(21.0f),
Aspose.Html.Drawing.Length.FromCentimeters(29.7f)),
Margin = new Margin(50, 670,0,0)
}
}
};
var tmp = Path.GetTempPath() + Path.DirectorySeparatorChar + new Random().Next();
// Convert HTML to PDF
Stopwatch sw = Stopwatch.StartNew();
Aspose.Html.Converters.Converter.ConvertSVG(document, options, tmp);
Console.WriteLine(sw.ElapsedMilliseconds);
}
}
}
qrbill.zip (4.2 KB)