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

Free Support Forum - aspose.com

SVG is truncated when inserted into Document using Java

Hi,

I am in the process of evaluating your library exporting data to word and I encountered a certain error that I cannot solve or search for a solution.

    com.aspose.words.Document doc = new com.aspose.words.Document();
    DocumentBuilder builder = new DocumentBuilder(doc);
    builder.insertImage(writer.toString().getBytes(),
            0, 0.0D, 0, 0.0D,
            scaledGraphSize.get(Attributes.width.name()),
            scaledGraphSize.get(Attributes.height.name()),0);

By adding a photo to the builder in svg format, as a result, it gets a cropped image 25% off the original height and width. Evaluation version Aspose-words-20.5-jdk17. In the attachment I am sending a photo (in a zip package) which is saved incorrectly.UCG_17.zip (5.8 KB)

Thanks
A.P

@aolo23

We are moving your inquiry to respective forum where you will be assisted accordingly.

@aolo23

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-20592 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The problem lies in the fact that the svg image has no width and height attributes set.
When you set them, the scaling works correctly.

@aolo23

Thanks for sharing the detail. We will inform you via this forum thread once there is an update available on it.