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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…