Large output file size with WrapImagesInSvg for certain PDF files in .NET

Converting the attached images to HTML results in a very large HTML file.
The input files are smaller than 110 KB, but the output is larger than 8 MB.
Without the “WrapImagesInSvg” flag, the output size is around 700 KB.
Visually, the quality increases quite a lot, using the “WrapImagesInSvg” option, which is good, but not at the cost of such large output files.
I did not see such an increase for other files so far, what makes this one different?
Can we control the output quality / file size somehow?

            var options = HtmlViewOptions.ForEmbeddedResources("output_viewer{0}.html");
            options.PdfOptions.WrapImagesInSvg = true;
            viewer.View(options);

Large output size.zip (181.2 KB)

@Clemens_Pestuka

Thank you for reporting this issue. We’ll take a look and update you.

Hi @Clemens_Pestuka

We have investigated the described situation with your PDF files and can confirm that the resultant HTML size is unreasonably large and this should be fixed. We already started to work on it and logged it under the “VIEWERNET-5051” moniker in our internal tracking system. Meanwhile we can suggest two options for you, which may help to decrease the output HTML size:

  1. You’re using the all-embedded resultant HTML, when use a HtmlViewOptions.ForEmbeddedResources static factory - it converts and stores all resources, including image background, with base64 encoding, which is not so efficient as source (unencoded) data. If it is possile for your use-case, try to use the HtmlViewOptions.ForExternalResources static factory - in such case the resultant HTML will be small, and resources will be saved separately and as distinct files, but not combinen together into one piece.

  2. If it is possile for your use-case, use the GroupDocs.Viewer for the .NET 6.0+ target environment - in that case the resultant HTML file size will be not the 8+ MiB (as it is on .NET Framework or .NET Core), but 6+ MiB in base64-embedded version.

We will notify you as soon as new information becomes available.

Sorry for the inconvenience.

With best regards,
Denis