I'm trying to insert a SVG into a PDF document, but I keep getting this exception:
Nullable object must have a value.
The stack trace shows:
at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_NoValue()
at iText.Svg.Renderers.Path.Impl.AbstractPathShape.CreatePoint(String coordX, String coordY)
at iText.Svg.Renderers.Impl.PathSvgNodeRenderer.AddMoveToShapes(IPathShape pathShape, String[] pathProperties)
at iText.Svg.Renderers.Impl.PathSvgNodeRenderer.ProcessPathOperator(String[] pathProperties, IPathShape previousShape)
at iText.Svg.Renderers.Impl.PathSvgNodeRenderer.GetShapes()
at iText.Svg.Renderers.Impl.PathSvgNodeRenderer.DoDraw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractSvgNodeRenderer.Draw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.GroupSvgNodeRenderer.DoDraw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.ClipPathSvgNodeRenderer.DoDraw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractSvgNodeRenderer.Draw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractSvgNodeRenderer.DrawInClipPath(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractSvgNodeRenderer.Draw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractBranchSvgNodeRenderer.DoDraw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.SvgTagSvgNodeRenderer.DoDraw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.AbstractSvgNodeRenderer.Draw(SvgDrawContext context)
at iText.Svg.Renderers.Impl.PdfRootSvgNodeRenderer.Draw(SvgDrawContext context)
at iText.Svg.Converter.SvgConverter.ConvertToXObject(ISvgNodeRenderer topSvgRenderer, PdfDocument document, SvgDrawContext context)
at iText.Svg.Converter.SvgConverter.ConvertToXObject(ISvgProcessorResult processorResult, PdfDocument document, ISvgConverterProperties props)
at iText.Svg.Converter.SvgConverter.ConvertToXObject(Stream stream, PdfDocument document, ISvgConverterProperties props)
at iText.Svg.Converter.SvgConverter.ConvertToXObject(Stream stream, PdfDocument document)
at iText.Svg.Converter.SvgConverter.ConvertToImage(Stream stream, PdfDocument document)
at HPT.Files.Infrastructure.Pdf.PdfProcessingService.GeneratePdfFile(List`1 customPlanStreams, PdfContent pdfContent, ICompressor compressor) in C:\--omited--\PdfProcessingService.cs:line 438
Here is the content of my SVG:
https://drive.google.com/file/d/1xT941Ps_ulIkv4VUQ1v8iDlE2r6VOUT0/view?usp=sharing
Here is how I'm trying to generate the picture:
var img = SvgConverter.ConvertToImage(planStream, pdf);
the weird thing is, with some SVGs it works, but the majority of them are throwing that exception.
-what should I try? -what am I doing wrong?
I also tried parsing the SVG to an XObject but I get the same exception. If I take the contents of the SVG it displays correctly in a browser.
