Not able to convert from PDF to SVG via stream

@chiraagbangera

We are in process of investigation and will get back to you in a while. Please give us some time.

Thanks @asad.ali, I understand, Please prioritize this issue as it is currently a blocker for us and we are on a deadline for our product launch this month. A workaround to get it working in Unity3D is also acceptable.

@chiraagbangera

An investigation ticket as SVG-100 has been logged in our issue tracking system for your scenario. We will further look into its details and inform you as soon as it is resolved. Please give us some time.

We apologize for the inconvenience.

@asad.ali Thanks, hoping for a speedy bug fix or workaround.

@chiraagbangera

We have found the next reason for this issue: Some encodings (including popular Windows-1252) are defined in separate NuGet packages and these encodings are not available by default on .NET Core.

Workaround:

  1. You can use Aspose.SVG netstandard2.0 assembly. (it is available on the path packages\aspose.svg\20.12.0\lib\netstandard2.0\Aspose.SVG.dll). We have found that you use NET4.0 framework instead.
  2. You can add next code to the program:
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

Like this:

void Start() 
{
 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
 var pdf = ".\\Assets\\Sample.pdf";
 var document = Converter.Convert2SVG(pdf);
 foreach (var page in document)
 {
  var svgElement = page.RootElement;
 } 
} 

And it is necessary to add the next libraries to Assets:

  • System.Runtime.CompilerServices.Unsafe.dll
  • System.Security.Permissions.dll
  • System.Text.Encoding.CodePages.dll

More information can be found here:

@asad.ali Thank you, that worked. I can confirm that it works for .NET 4.x scripting backend in Unity3D too. However, I did have to do the other steps such as download the required dependencies and also register the text encodings.

@chiraagbangera

It is good to know that your issue has been resolved by suggested workaround. Please keep using our API and feel free to create a new topic in case you need further assistance.