Problems with inserting svg-image into pdf

Hello,

I have an issue with inserting svg-image to pdf format. Please see attached “income.svg” for example.


1. Example for Aspose.Pdf and incoming file:

var loadopt = new SvgLoadOptions();
loadopt.AdjustPageSize = true;
var Doc = new Aspose.Pdf.Document(FileSVG, loadopt);
Doc.Pages[1].PageInfo.Margin.Top = 0;
Doc.Pages[1].PageInfo.Margin.Left = 0;
Doc.Pages[1].PageInfo.Margin.Bottom = 0;
Doc.Pages[1].PageInfo.Margin.Right = 0;
Doc.Save(streamPdf);

Result in attached file “SaveChart-via-Aspose.Pdf.Pdf”
Problems are related to mess/shifting items (markers, texts) in comaring with original file.


2. Example for Aspose.Words and incoming file:
Aspose.Words.DocumentBuilder wordDocument = new Aspose.Words.DocumentBuilder();
wordDocument.InsertImage(System.Text.Encoding.Default.GetBytes(svgstring));
wordDocument.PageSetup.PageWidth = 1200;
MemoryStream stream = new MemoryStream();
wordDocument.Document.Save(stream, Aspose.Words.SaveFormat.Pdf);

Result in attached file “SaveChart-via-Aspose.Words.Pdf”
Problems are related to font displaying and "pixel art" picture in general.

Note: Mentioned files are in attachment.

Best Regards,
Vasili.

investion:
I have an issue with inserting svg-image to pdf format. Please see attached “income.svg” for example.


1. Example for Aspose.Pdf and incoming file:

var loadopt = new SvgLoadOptions();
loadopt.AdjustPageSize = true;
var Doc = new Aspose.Pdf.Document(FileSVG, loadopt);
Doc.Pages[1].PageInfo.Margin.Top = 0;
Doc.Pages[1].PageInfo.Margin.Left = 0;
Doc.Pages[1].PageInfo.Margin.Bottom = 0;
Doc.Pages[1].PageInfo.Margin.Right = 0;
Doc.Save(streamPdf);

Result in attached file “SaveChart-via-Aspose.Pdf.Pdf”
Problems are related to mess/shifting items (markers, texts) in comparing with original file.

Hi Vasili,


Thanks for using our products.

I have tested the scenario and I am able to reproduce the same problem. For the sake of correction, I have logged it in our issue tracking system as PDFNEWNET-35730. We will investigate this issue in details and will keep you updated on the status of a correction.

We apologize for your inconvenience.


PS, Now concerning to Aspose.Words for .NET issue, my fellow worker from respective team will further look into this matter.

Hi Vasili,


Thanks for your inquiry.

Please note that Aspose.Words tries to mimic the same behavior as MS Word do. The SVG is not directly supported in Microsoft Word document, so during inserting SVG image, it will be converted to a format supported by Microsoft Word document and then inserted. Also, Microsoft Word natively supports image formats like Wmf, Emf, Jpeg, Png, Pict.

The SVG is converted to PNG when a document is converted to Pdf. However, we had already logged a feature request to convert SVG to EMF when a document is converted to Pdf for better result. This feature will be available in next version of Aspose.Words (v13.8.0) which is planned to be released by the end of August 2013. We will inform you via this forum thread as soon as August 2013 release is published.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hello Tahir,

Thank you for good news. I'm waiting new version of Aspose.Words.

Best Regards,

Vasili.

The issues you have found earlier (filed as WORDSNET-8655) have been fixed in this .NET update and this Java update.


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

Hello Aspose Team,

Thank you for last fixes and update. Issue with chart was fixed in Aspose.Word (13.8.0.0). But I still have an issue with fonts. Please see attachment.

Best Regards,

Vasili.

Hi Vasili,


Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-8963 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi,
could you please provide a short hint which new 13.8.0 - API method to call to get SVG/EMF inserted into PDF without converting them to an ugly bitmap?
I did not find any delta information in the latest documentation.

Many thanks in advance!
Torsten

Hi Torsten,


Thanks for your inquiry. Unfortunately, I have not completely understood your query. It would be great if you please share some more detail about your query.

When you insert a SVG file into Aspose.Words DOM, it is inserted as image type EMF. Please check the following code snippet for your kind reference.

var doc = new Document();<o:p></o:p>

var builder = new DocumentBuilder(doc);

Shape shape = builder.InsertImage(MyDir + "in.svg");

Console.WriteLine(shape.ImageData.ImageType);


Moreover, I like to share with you that the issue WORDSNET-8963 has been resolved and its fix will be included in the next version of Aspose.Words (v13.9.0) which is planned to be released by the end of September 2013. We will inform you via this forum thread as soon as September 2013 release is published.

Hi Tahir,


as I understood this thread (and the release notes to 13.8.0), SVG images are inserted as EMF into the document now. So I thought, that they stay a vector graphics (EMF) inside the “Document” object. So, when the document is saved to DOC/DOCX/PDF they should stay a vector graphic.


I experienced that in PDF format, this image is NOT a vector graphics but only a bitmap. So maybe I’ve just not used the correct option to let the PDF generation insert the image as EMF into the result file?
I’ve tried the following:


PdfSaveOptions options = new PdfSaveOptions();



options.setJpegQuality(100);

options.setDownsampleResolution(300);

options.setDownsampleImages(false);

options.setUseHighQualityRendering(true);



Thanks and best regards,

Torsten

Hi Torsten,


Thanks for your inquiry. When you insert a SVG file into Aspose.Words DOM, it is converted to EMF file and then inserted into Aspose.Words DOM. Please check the following code snippet.


var doc = new Document();<o:p></o:p>

var builder = new DocumentBuilder(doc);<o:p></o:p>

Shape shape = builder.InsertImage(MyDir + “in.svg”);<o:p></o:p>

Console.WriteLine(shape.ImageData.ImageType);


It would be great if you please share how you check that the output PDF contains the bitmap instead of EMF. Moreover, please share your input document, SVG and output Pdf file here for investigation purposes.


Hi Tahir,

please find attached some example code, the used EMF and the result PDF. After opening the PDF, you see that in different zoom factors some lines disappear and that beginning with a certain zoom factor “stair” artifacts appear in the graphic. So this EMF appears to be inserted as a bitmap and not as an EMF.

BR,
Torsten

Hi Torsten,


Thanks for sharing the detail. I have managed to reproduce the same issue at my side. The lines of EMF file does not appear correctly in output Pdf file. I have logged this issue as WORDSNET-9003 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hi Torsten,


Thanks for your inquiry via private message. It would be great if you please post your same query at Priority Support forum here:
http://www.aspose.com/community/forums/aspose.priority.support/480/showforum.aspx

I will linked your Priority Support thread to the same issue and this issue will be treated as Priority Support level. Thanks for your cooperation.

The issues you have found earlier (filed as WORDSNET-8963) have been fixed in this .NET update and this Java update.


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

Hello Aspose Team,

Thank you for good job. I checked fix in Aspose.Word (13.9.0.0) and it works correctly.

Best Regards,

Vasili.

Hi Vasili,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Hello Aspose Team!

Unfortunately, issue was not fixed completely.
Please, look on attached archive.
There is issue with inserting svg into doc if svg-file has string with mixed font attributes (bold, normal).

Best Regards,

Vasili.

Hi Vasili,


Thanks
for your inquiry. I have managed to reproduce the same issue at
my side with MixTitleWithBold.svg. I have logged this issue as WORDSNET-9223 in our issue
tracking system. I have linked this forum thread to the same issue and
you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Tahir,

Can you please check following issue aditionally ?

If use MixTitleWithBold.svg data-file for inserting svg-image into Word:

- after inserting shp.Width and shp.Height have the same values as in attached svg file: ~1112 and ~400.
- but doc-file contains image with another height and width (1483x533)

Code examples:

var wordDocument = new Aspose.Words.DocumentBuilder();

var ps = wordDocument.PageSetup;
ps.LeftMargin = 0;
ps.RightMargin = 0;
ps.TopMargin = 0;
ps.BottomMargin = 0;

var shp = wordDocument.InsertImage(Encoding.Default.GetBytes(svg));

ps.PageWidth = shp.Width;
ps.PageHeight = shp.Height;

Thank you in advance.

Vasili.