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

Free Support Forum - aspose.com

Save in SVG 1.0

Hi,

My question is simple. Is it possible to extract a chart in SVG format following the SVG specifications 1.0 ?

Thank you in advance.

@KvnLr Yes, it is possible. Please see the following simple code:

Document doc = new Document(@"C:\Temp\in.docx");

NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int chartCounter = 0;
foreach (Shape s in shapes)
{
    if (s.HasChart)
    {
        ImageSaveOptions opt = new ImageSaveOptions(SaveFormat.Svg);
        s.GetShapeRenderer().Save(string.Format(@"C:\Temp\chart_{0}.svg", chartCounter++), opt);
    }
}

First of all thank you for your reply.
I know it’s possible to extract a shape and save it as SVG, but this will output an SVG file following the SVG 1.1 spec.
For some special reason, I can’t use the SVG 1.1 files.
I would like know if it is possible, by setting the save options for example, to generate a SVG 1.0 file ?

Thanks in advance.

(FYI, I use the aspose version 19.5)

@KvnLr Thank you for additional information. Unfortunately, there is not such option. I have logged a feature request WORDSNET-23354. We will consider providing such option in one of future versions.
Also, I have created another feature request WORDSNET-23355 to allow passing SvgSaveOptions into ShapeRenderer.Save and OfficeMathRenderer.Save methods, to make it possible to specify SVG specific save options.

Thanks a lot for your return.
I don’t know if it matters or not, but I’m using Aspose.Word in Java.

Have a good day.

@KvnLr Aspose.Words for .NET is the main project, all fixes made in .NET version are auto-ported to Java version.

@KvnLr After discussing differences between SVG 1.0 and 1.1 and reviewing current Aspose.Words’ behavior we’re still not inclined to implement the “export to SVG 1.0” feature, because:

  • SVG 1.0 is an outdated specification, which was superseeded by SVG 1.1;
  • it seems that SVG 1.1 works fine in most scenarios and we suspect that SVG 1.0 won’t be used by our customers.

Could you please provide additional information about the scenario in which SVG produced by Aspose.Words causes problems. Hopefully, we’ll figure out a workaround for the issue.

First of all thanks for the follow up.

I need to extract charts or other graphic objects in a vector format in order to use them in a engine renderer. And unfortunately I have limits with this tool.
So I opted to extract the graphics in pdf format. And I have another question about this. Is it possible to specify the pdf version when saving a document with Aspose.Word?

Thank you in advance.

@KvnLr Sure you can specify version of PDF. Please see PdfSaveOptions.Compliance property.

I misspoke.
I would like to generate a PDF in version 1.4.

PdfCompliance only offers versions 1.5 and 1.7.

@KvnLr You can using PdfA1a or PdfA1b, which are PDF 1.4 based.