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

Free Support Forum - aspose.com

Help converting SVG TO PDF

I want to convert an SVG to PDF. I have attached the SVG - I changed/added extension of txt, otherwise I could not upload. Below is the code I used. When I open the PDF, it’s blank.



What is wrong?





’ Instantiate SvgLoadOptions object using SVG load option

Dim loadopt As Aspose.Pdf.SvgLoadOptions = New Aspose.Pdf.SvgLoadOptions()



loadopt.ConversionEngine = Aspose.Pdf.SvgLoadOptions.ConversionEngines.NewEngine



’ Create Document object

Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document(“C:\Users\con-ccoabe1hxr\Downloads\airport.svg”, loadopt)



’ Save the resultant PDF document

doc.Save(“c:\harold\airport.pdf”, SaveFormat.Pdf)

Hi there,


Thanks for your inquiry. It seems your shared SVG is corrupted, as when I open it browser shows an error. We will appreciate it if you please zip your SVG file and share it again, so we will look into the issue and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,
Hi,

Thanks for using our API's.

I have tested the scenario and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNEWNET-40643 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

I do not believe the SVG is corrupt. While I also cannot open it in IE (browser), it opens fine in a program like Inkscape or Illustrator that can edit/view SVG files. I do not know enough about SVG to explain why it does not open using IE.

I need to be able to convert similar SVG files to PDF.

Also, instead of converting from File to File, if I have an input stream that contains my SVG, can that then be saved to a PDF file?

I have discovered that the issue is with the tags added by Inkscape. I have attached another SVG that has no Inkscape tags, and this converts fine to PDF. Maybe this still is an Aspose issue in that you need to ignore the Inkscape tags??

Also, in convert these SVG to PDF, Aspose does not seem to take into account the opacity tag. I need Aspose to do this

Hi there,

hlrosenberger:
I do not believe the SVG is corrupt. While I also cannot open it in IE (browser), it opens fine in a program like Inkscape or Illustrator that can edit/view SVG files. I do not know enough about SVG to explain why it does not open using IE.

I need to be able to convert similar SVG files to PDF.


Thanks for your feedback. Our product team will look into this problem as well while investigating the logged issue. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience caused.

Best Regards,
Hi there,

hlrosenberger:
Also, instead of converting from File to File, if I have an input stream that contains my SVG, can that then be saved to a PDF file?

Thanks for your inquriy. Document object support both stream and file parameter for loading and saving documents. You can load SVG file from stream and save resultant PDF to file using constructors with respective parameter type. Please find sample code snippet to load SVG from stream and saving to PDF file, hopefully it will help you to accomplish the task.

// load PDF document

Aspose.Pdf.SvgLoadOptions loadopt = new Aspose.Pdf.SvgLoadOptions();

loadopt.ConversionEngine = Aspose.Pdf.SvgLoadOptions.ConversionEngines.NewEngine;

Aspose.Pdf.Document doc = new Aspose.Pdf.Document(inputStream,loadopt);

//doc.Save(outputStream);

doc.Save("E:/data/svgtopdf.pdf");


Best Regards,

Hi there,

hlrosenberger:
I do not believe the SVG is corrupt. While I also cannot open it in IE (browser), it opens fine in a program like Inkscape or Illustrator that can edit/view SVG files. I do not know enough about SVG to explain why it does not open using IE. I need to be able to convert similar SVG files to PDF.

HaroldRosenberger:
Also, in convert these SVG to PDF, Aspose does not seem to take into account the opacity tag. I need Aspose to do this

Thanks for sharing your findings. We have passed on your findings to our product team. We will consider these during the issue investigation. We will notify you as soon as we made some significant progress towards issue resolution.

Best Regards,