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

Free Support Forum - aspose.com

SVG in Report Engine

Using 16.11


I have had succes with importing SVG files to a docx document and saving as PDF preserving the SVG as vector in the PDF…

byte[] data = System.Convert.FromBase64String(image);

b.InsertImage(data, Aspose.Words.Drawing.RelativeHorizontalPosition.LeftMargin, 0, Aspose.Words.Drawing.RelativeVerticalPosition.TopMargin, 0,
-1, -1, Aspose.Words.Drawing.WrapType.Inline);


When I do the same using the ReportingEngine, the SVG is somehow converted to bitmap in the PDF and that is not preferable…

Aspose.Words.Reporting.ReportingEngine eng = new Aspose.Words.Reporting.ReportingEngine();

eng.BuildReport(doc, new object[] {data, user }, new string[] { “Image”, “User” });

Is there any way around this or will I have to do manual insertion of SVG’s?

Thanks in advance :slight_smile:

Hi Allan,


Thanks for your inquiry. Please use the attached template document and try following code example to insert an image into document using Linq Reporting engine. Hope this helps you.

Please refer to the following article:
Inserting Images Dynamically


Document doc = new Document(filePath);

ReportingEngine engine = new ReportingEngine();<o:p></o:p>

ImageStream imageStream = new ImageStream(new FileStream(“c:\temp\input.svg”, FileMode.Open,FileAccess.Read));<o:p></o:p>

engine.BuildReport(doc, imageStream, “src”);<o:p></o:p>

doc.Save(MyDir + @“16.11.0.docx”);<o:p></o:p>


public class ImageStream<o:p></o:p>

{<o:p></o:p>

private Stream _stream;<o:p></o:p>

public ImageStream(Stream stream)<o:p></o:p>

{<o:p></o:p>

_stream = stream;<o:p></o:p>

}<o:p></o:p>

<o:p> </o:p>

public Stream Image<o:p></o:p>

{<o:p></o:p>

get { return _stream; }<o:p></o:p>

}<o:p></o:p>

}<o:p></o:p>



Hi Tahir


Thanks for the reply

I’m trying your solution now but is getting this error:

Additional information: Tag ‘image’ is not well-formed. An expression providing image data should return a byte array, a string, or an instance of type ‘System.IO.Stream’ or ‘System.Drawing.Image’.

I’m using a memorystream since I’m getting the image from a byte[]

eng.BuildReport(doc, new object[] {new ImageStream(new MemoryStream(image)), user}, new string[] { “Image”, “User” });


Tried inserting as Stream directly, but still the SVG is converted to bitmap…


This is not happening when using the DocumentBuilder.InsertImage()
Hi Allan,

Thanks for your inquiry.
farouche:
Additional information: Tag 'image' is not well-formed. An expression providing image data should return a byte array, a string, or an instance of type 'System.IO.Stream' or 'System.Drawing.Image'.
To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

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.
farouche:
Tried inserting as Stream directly, but still the SVG is converted to bitmap...
This is not happening when using the DocumentBuilder.InsertImage()
Could you please share some more detail about this query? We will then provide you more information about this.

Hi Tahir


Please see attached solution for demonstration…

Both docx and svg are included, and I have attached the result.pdf as well.


You should be able to see the difference easily in the result.pdf…

I was just so glad when I used the DocumentBuilder for the first test, and saw that it did it just perfectly, and then a bit disappointed when the ReportBuilder did it in a completely other way…

Hi Allan,

Thanks for sharing the detail. We have logged this problem in our issue tracking system as WORDSNET-14468. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Tahir


Thanks for that…

I just need to be sure that this will actually be solved, otherwise I will have to make my own merging functionality…

Is there any time plan for this ?
Hi Allan,

Thanks for your inquiry. We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. Our developers work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, this issue is pending for analysis. Once our product team completes the analysis of this issue, we will then be able to provide you an estimate.

Thanks for your patience and understanding.

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.