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

Free Support Forum - aspose.com

Generate PDF file with inline SVG using C#

Hello,
when I try generate pdf with inline svg I have got an error: DashPattern value is not valid.
svg:

    <svg viewBox='-10 -10 20 20'>
      <circle r='10' cx='0' cy='0' fill='#f0f0f0'></circle>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle' stroke='#FFCD00'
                stroke-dasharray='5.969026041820607 31.41592653589793' transform='rotate(-90)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow' stroke='#FFCD00'
                stroke-dasharray='5.969026041820607 31.41592653589793' transform='rotate(-90)'></circle>
      </g>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle' stroke='#F4706D'
                stroke-dasharray='11.938052083641214 31.41592653589793' transform='rotate(-21.599999999999994)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow' stroke='#F4706D'
                stroke-dasharray='11.938052083641214 31.41592653589793' transform='rotate(-21.599999999999994)'></circle>
      </g>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle' stroke='#62b5e5'
                stroke-dasharray='8.79645943005142 31.41592653589793' transform='rotate(115.20000000000002)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow' stroke='#62b5e5'
                stroke-dasharray='8.79645943005142 31.41592653589793' transform='rotate(115.20000000000002)'></circle>
      </g>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle'
                stroke='#3D2074' stroke-dasharray='1.8849555921538756 31.41592653589793'
                transform='rotate(216.00000000000003)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow'
                stroke='#3D2074' stroke-dasharray='1.8849555921538756 31.41592653589793'
                transform='rotate(216.00000000000003)'></circle>
      </g>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle'
                stroke='#C8158B' stroke-dasharray='2.827433388230814 31.41592653589793'
                transform='rotate(237.60000000000002)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow'
                stroke='#C8158B' stroke-dasharray='2.827433388230814 31.41592653589793'
                transform='rotate(237.60000000000002)'></circle>
      </g>
      <g>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='6' class='pie-chart__pie-circle' stroke='#992165'
                stroke-dasharray='0, 31.41592653589793' transform='rotate(270)'></circle>
        <circle r='5' cx='0' cy='0' fill='transparent' stroke-width='10' class='shadow' stroke='#992165'
                stroke-dasharray='0, 31.41592653589793' transform='rotate(270)'></circle>
      </g>
      <circle r='5.3' cx='0' cy='0' fill='#fff' class='pie-chart__center-circle'></circle>
    </svg> 

stack trace:
System.ArgumentException: DashPattern value is not valid.
at System.Drawing.Pen.set_DashPattern(Single[] value)
at #=zCha2W9fBBBu_QKXg62$TAJ5MVz$wwzEaLw==.#=zuU1N1Ko=()
at #=zCha2W9fBBBu_QKXg62$TAJ5MVz$wwzEaLw==.#=zq6n9TLM=()
at #=zCha2W9fBBBu_QKXg62$TAJ5MVz$wwzEaLw==.#=zh_gbGnNzDUjZ(FillMode #=zHZVeOig=)
at #=zu8Dbst$Ok13VyXRjoL1xWNIof7wC4mQKyPqYMuI185mdX381fmCPPIw=`1.#=zqNkIZy5Jim1e(#=zIgVXZmF0$GLfaMIMK0xUCDnRDXtNhp1OPRGiEi0= #=zqrCXjCs=)
at #=zz5qs09i$Mwt0gmOQFXKzxILWH3Jgn8j$Shh45X8kkLu4Ky0y0A==.#=zthWBkSM=(#=zIgVXZmF0$GLfaMIMK0xUCDnRDXtNhp1OPRGiEi0= #=zqrCXjCs=)
at #=znUSCXViyehHC2WmHCm3WAJjPsdTJOD9HWFT1tQY=.#=zthWBkSM=(#=zIgVXZmF0$GLfaMIMK0xUCDnRDXtNhp1OPRGiEi0= #=zqrCXjCs=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IJ1.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, Boolean #=zw$kW4JO46LvC, #=zS5IDO4DccFfGA0MMH_vVDPMlnpyEpXrXhfqnHSo=[] #=zq5oS88c=)
at #=zgWFtHvQZ4BBOb8H3HYzNqHq2YIJ1.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, #=zS5IDO4DccFfGA0MMH_vVDPMlnpyEpXrXhfqnHSo=[] #=zq5oS88c=)
at #=z8tb$MXVhIzT30jtxR57W3oIcE8wJO2Wg9Q==.Render(IDisposable #=zzc9TppaknGxSzhJJhQ==, #=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, #=zYUB1G9hkZ0Q2TEaVlWAsYAs=[] #=zq5oS88c=)
at #=zO9ygzzqytzO8JO3ENsXD1OIeKXrq6AI1$g==.#=zXqiKUSo=(Single #=z8KQJTHU=, Single #=zi1RT9Dc=)
at #=zO9ygzzqytzO8JO3ENsXD1OIeKXrq6AI1$g==.#=zthWBkSM=(#=zQTb4_4V7XpfKrKXE64bymu01PlPy #=zzc9TppaknGxSzhJJhQ==, #=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, Single #=z8KQJTHU=, Single #=zi1RT9Dc=, #=zS6WhK879jmWhCyxbDLDJ7LH0zRATT1tTKA== #=zrz_JxkJ5qHrk)
at #=zTcmheW2kLJ2bX9JhY0tS15Sf6uIHOgJlxg==.#=zthWBkSM=(#=zQTb4_4V7XpfKrKXE64bymu01PlPy #=zzc9TppaknGxSzhJJhQ==, #=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, Single #=z8KQJTHU=, Single #=zi1RT9Dc=, #=zS6WhK879jmWhCyxbDLDJ7LH0zRATT1tTKA== #=zrz_JxkJ5qHrk, Boolean #=zsgT_zsW1hwwGyoY7ow==, #=zyvoe7YtES6PBRfmcqfcrOV_oa9wKrxiXJg== #=zqrCXjCs=)
at #=zQTb4_4V7XpfKrKXE64bymu01PlPy.#=zlQxcJtg4oZJ0oYw2Afn4CT0=(#=zUBlhae9wfAtxkq1u5wZhu7PV11DqUJv7mZABw48= #=zwmRxNXWrOV88, Boolean #=zsgT_zsW1hwwGyoY7ow==, #=zyvoe7YtES6PBRfmcqfcrOV_oa9wKrxiXJg== #=zqrCXjCs=)
at #=zQTb4_4V7XpfKrKXE64bymu01PlPy.#=z$V9M3g2ePufYxq0zNw==(#=zbVH7zr3lXeh3pPL01Q== #=zJBHWDZLGMdMusRXkOQ==, Boolean #=zsgT_zsW1hwwGyoY7ow==, #=zyvoe7YtES6PBRfmcqfcrOV_oa9wKrxiXJg== #=zqrCXjCs=)
at #=zQTb4_4V7XpfKrKXE64bymu01PlPy.#=z$V9M3g2ePufYxq0zNw==(#=zbVH7zr3lXeh3pPL01Q== #=zJBHWDZLGMdMusRXkOQ==, Boolean #=zsgT_zsW1hwwGyoY7ow==, #=zyvoe7YtES6PBRfmcqfcrOV_oa9wKrxiXJg== #=zqrCXjCs=)
at #=zQTb4_4V7XpfKrKXE64bymu01PlPy.#=zlh1VsR0=(#=zgeuvzm$UHnHRthgK9ElRzyF9Z$IU1vnM4g== #=zmUzHrQs=, #=zk0i4og2iZ3z8hJjDdQ== #=zJBHWDZLGMdMusRXkOQ==, Boolean #=zsgT_zsW1hwwGyoY7ow==, #=zyvoe7YtES6PBRfmcqfcrOV_oa9wKrxiXJg== #=zqrCXjCs=)
at #=z37imut6RCMR72oXvcwjgkDwBni5W0C1psA==.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=)
at #=zjWFrbw2Xlu5ZDA_k8n_y79ANlHy6y8iKVg==.#=zwbOcPWAD0OyA(#=ziP9Uj9ejCXXJGuCnowTq_x4= #=zzc9TppaknGxSzhJJhQ==, #=zGRvW7PYqAWGblyFZb9rBDnkLfKhv[] #=zk6RPm_p3ePj1, #=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, TimeSpan #=zPKBBeEg=)
at #=z2FYeaiGu6mCb6ngHxREvQaHOUUS5.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, TimeSpan #=zPKBBeEg=, #=zYUB1G9hkZ0Q2TEaVlWAsYAs=[] #=zjtRpfMQ=, #=zh$QvVhNG2b5Df43s6nuy6FM=[] #=zu9PJGxo=)
at #=z2FYeaiGu6mCb6ngHxREvQaHOUUS5.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, TimeSpan #=zPKBBeEg=, #=zh$QvVhNG2b5Df43s6nuy6FM=[] #=zu9PJGxo=)
at #=zJ2OPF7UwG0pwUaTf3xYqJ3c5kGiC.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, #=z8lPG4n4= #=zJSRaHlc=, TimeSpan #=zPKBBeEg=)
at #=zJ2OPF7UwG0pwUaTf3xYqJ3c5kGiC.Render(#=zt9bAOZBFDEuF8HvbyieLkoshYhp1 #=zp_ZvBN8=, #=z8lPG4n4= #=zJSRaHlc=)
at #=zGxTL17fo8QIFRHX$FU1NO4yQTInG.#=zAHyg7RON0PCF(Stream #=z90zns2S_QQXC, Document #=zPJ5TCwQOP50N, HtmlLoadOptions #=znf46LjYc4g4m, String #=z2PM5ZzSgsxm2)
at #=zGxTL17fo8QIFRHX$FU1NO4yQTInG.#=z4GtIO4o=(Stream #=z90zns2S_QQXC, Document #=zPJ5TCwQOP50N, HtmlLoadOptions #=znf46LjYc4g4m, String #=z2PM5ZzSgsxm2)
at #=zGxTL17fo8QIFRHX$FU1NO4yQTInG.#=z4GtIO4o=(Stream #=z90zns2S_QQXC, Document #=zPJ5TCwQOP50N, HtmlLoadOptions #=znf46LjYc4g4m)
at Aspose.Pdf.Document.#=z3QmPk$U=(Stream #=zT5DDZto=, LoadOptions #=zLwzLupg=)
at Aspose.Pdf.Document…ctor(Stream input, LoadOptions options)

Environment
asp.net core 3.1
Version: 1.4.0
Windows
Editioin: Windows 10 Enerprise
Version: 1909
OS build: 18363.1916

@olsavchuk

Would you please share your sample code snippet with us that you are using to generate the PDF file using the above-shared SVG string?

Yes sure, thanks for quick answer
Added sample code
Downloads.zip (1.8 KB)

@olsavchuk

We were able to replicate the similar exception in our environment while testing the case using Aspose.PDF for .NET 21.11. Hence, it has been logged as PDFNET-50995 in our issue tracking system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.