Sautinsoft PdfFocus exception after migration to .

2019-09-22 18:34发布

I have a purchased license of the DLLs (6.9.4.10) and my *.csproj contains this:

<ItemGroup>
  <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0"/>
  ...
  <PackageReference Include="System.IO.Packaging" Version="4.5.0"/>
  <PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.0"/>
  <PackageReference Include="ZKWeb.System.Drawing" Version="4.0.0"/>
</ItemGroup>
...
<ItemGroup>
  <Reference Include="SautinSoft.PdfFocus">
    <HintPath>..\PDF Focus .Net Full (6.9.4.10)\DLLs\Net Core 2.0\SautinSoft.PdfFocus.dll</HintPath>
  </Reference>
</ItemGroup>

I am trying to convert a PDF into a DOCX-file (which worked in .NET 4.5).

This is the relevant part of the code:

....
SautinSoft.PdfFocus f = new SautinSoft.PdfFocus();
f.Serial = Settings.GetAppSetting("PdfFocusSerial", "**MySerial**");
f.OpenPdf(buffer);

if (f.PageCount > 0)
{
    f.WordOptions.Format = SautinSoft.PdfFocus.CWordOptions.eWordDocument.Docx;

    var result = f.ToWord(); //f.Exception set after this
    ...
}
...

I've checked that the same buffer is sent in as in the old code, but the output differs by some bytes. And I get an Exception set in f.Exception, which is:

{System.Collections.Generic.KeyNotFoundException:
The given key '0' was not present in the dictionary. ...

When I try to open the newly created *.docx-file, Word says it's damaged. After clicking through some dialogs it can still open the file.

Anyone have any ideas?

Is this a known bug for this library in .Net Core 2.1? (Only 2.0 is mentioned on their website)

I've also tried the free version published on NuGet with the same results.

EDIT

This was indeed a bug in the .NET Core specific version. They have fixed this in version 6.9.6.29.

1条回答
对你真心纯属浪费
2楼-- · 2019-09-22 18:49

My Name is Dmitry and I work in SautinSoft. Thank you for your issue. You are right. We have some problems with PDF Focus.Net and Net Core 2.1 Our developers try to fix this issue. We have found where is a bug (resources/fonts) and I hope, that we will prepare a new version very quickly. I'll inform you.

查看更多
登录 后发表回答