We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

SVG exported incorrectly in output DOCX and PDF using .NET

Hi

We have some troubles with the correct layout of svg images in word or pdf. Also there are different behaviors saving either as docx or pdf.

Problems:

  • Text alignement ignoring text-anchor: end / middle (occurs when only transform="…" without x=“0” y=“0” is set)
  • Arc drawing: incorrect output in pdf
  • Font-Styles: incorrect output in word (when fonts are not installed locally)
  • font-weight seems to ignore numerical values as 400,700 (workaround use normal/bold)

Windows Universal, Aspose.Words v18.10.0

Sample svg File and Outputs: svg_issues.zip (489.1 KB)

Could you please give us some hints for possible solutions/workarounds.
Thanks in advance.

@bmpi

Thanks for your inquiry. Please ZIP and attach the fonts ‘Lato Light’, ‘Lato’, and ‘Lato Bold’ here for testing. Please also share the code example that help us to reproduce this issue at our end. Thanks for your cooperation.

The zip file contains these fonts with an windows uwp test application.
AsposeTest.zip (363.4 KB)

@bmpi

Thanks for sharing the detail. We are investigating this issue and will get back to you soon.

@bmpi

Thanks for your patience. We have logged the following issues in our issue tracking system for your case.

WORDSNET-17628 : Arc does not render correctly in output PDF
WORDSNET-17629 : Vertical lines of SVG are rendered at incorrect position in DOCX/PDF
WORDSNET-17630 : Font formatting of SVG is incorrect in DOCX/PDF

You will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

Annotation:
WORDSNET-17629 The problem of my provided example is not the position of the vertical lines, rather than the Text alignment, if no coordinates are given:

@bmpi

Thanks for your inquiry. Could you please share some more detail about this query? We will then log it accordingly in our issue tracking system.

If the coordinates x=“0” y=“0” attributes in the svg text tag are missing (only the transform attribute is provided, assuming implicitly x/y = 0) the text alignment is not applied correctly.

svg Code, not aligned centered in pdf/word output:

<text class="light medium" transform="matrix(1,0,0,1,120,50)">Medium</text>
<style type="text/css">
   .medium {font-size:22px;text-anchor:middle;}
   .light {font-family:'Lato Light';font-weight:'normal';}
</style>

svg code, works fine (added x=“0” y=“0”):

<text class="light medium" x="0" y="0" transform="matrix(1,0,0,1,120,50)">Medium</text>
<style type="text/css">
   .medium {font-size:22px;text-anchor:middle;}
   .light {font-family:'Lato Light';font-weight:'normal';}
</style>

Sample Files
alignment.zip (94.6 KB)

@bmpi

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17647. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17628) have been fixed in this Aspose.Words for .NET 18.12 update and this Aspose.Words for Java 18.12 update.

The issues you have found earlier (filed as WORDSNET-17647,WORDSNET-17629) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

We are still waiting for a fix for “WORDSNET-17630 : Font formatting of SVG is incorrect in DOCX/PDF”.
Can you please tell me what the status is?

@bmpi

We regret to share with you that this issue has been postponed (no estimate is available at the moment). We will inform you via this forum thread as soon as it is resolved.

We apologize for your inconvenience.