SVG Slow Rendering time, how can i optimize this?

Hello,

Using aspose words i need to exportimages to one file so i have the following saveoptions call:

var options = new Aspose.Words.Saving.SvgSaveOptions()
                {
                    ExportEmbeddedImages = true,
                    TextOutputMode = Aspose.Words.Saving.SvgTextOutputMode.UsePlacedGlyphs,
                    OptimizeOutput = true,
                };

            
            doc.Save(outputStream,options); 

I need all of these settings except OptimizeOutput which doesnt make a difference. How can i reduce render time significantly? We typically have 3-4 page resumes that may or may not contain images.

we need a solution that can handle anything.

@shayan.ahmad,

Thanks for your inquiry. Please note that performance and memory usage all depend on complexity and size of the documents you are generating. In terms of memory, Aspose.Words does not have any limitations. If you’re loading huge Word documents into Aspose.Words’ DOM, more memory would be required.

Could you please ZIP and attach your input Word document here for testing? We will investigate the issue on our side and provide you more information.

i just want to know if you guys have any methods that will optimize the SVG markup for optimal rendering in your current framework

Sovern SampleResume.pdf (54.5 KB)

here is a file. im converting from pdf to docx to svg

@shayan.ahmad,

Thanks for your inquiry. Please note that performance and memory usage all depend on complexity and size of the documents you are generating.

The process of building layout model is not linear; it may take a minute to render one page and may take a few seconds to render 100 pages. Also, Aspose.Words has to create APS (Aspose Page Specification) model in memory and this may again eat some more time and memory for some documents.

You are already using FixedPageSaveOptions.OptimizeOutput to optimize the output. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please ZIP and attach your Word document here for testing.
  • Please share your working environment e.g. Operating system, .NET Framework etc.
  • Please share the execution time of rendering document to SVG at your end.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

letters.zip (10.4 KB)

The following file when converted with Aspose.Words to SVG format is breaking IE11 web page upon embedding.

@shayan.ahmad,

Thanks for sharing the document. We have tested the scenario and noticed that Document.Save takes around 2.7 seconds for conversion and file size is 11MB. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15700. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@shayan.ahmad,

Thanks for your patience. It is to inform you that the issue you are facing is actually not a bug in Aspose.Words. So, we are closing this issue (WORDSNET-15700) as ‘Not a Bug’.

You are using placed glyphs approach to display text in SVG. This approach is good when there is not much text in the document. When UsePlacedGlyphs is used each character is rendered as <use x=“0” xlink:href="#Font1c84" /> takes much more space in the resulting file that simple character in tspan element. Since each character is rendered separately, OptimizeOutput option does not give significant effect.

We suggest you please use SvgTextOutputMode.UseSvgFonts. In this case fonts used by text are embedded into SVG file and output is much more compact and is rendered in IE very fast.

SvgFonts options leads to formatting errors for a couple of our resumes. UsedPlacedGlyphs is the only reliable way to preserve original formatting.

Please look into optimizing SVGs using svgo library:

this is certainly a bug.

i can attach files that do not convert correctly using the SVGFont option.

@shayan.ahmad,

Thanks for sharing the detail. When you use SvgTextOutputMode.UseSvgFonts, the SVG fonts are used to render text. Please note that not all browsers support SVG fonts.

You are using SvgTextOutputMode.UsePlacedGlyphs in your code and behavior you are facing is expected. The slow SVG rendering time is explained in my previous post.

Please let us know if you have any more queries.