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,
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
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.
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?
// 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,
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