Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

c# - Sautinsoft PdfFocus exception after migration to .NET Core 2.1

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)DLLsNet Core 2.0SautinSoft.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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...