iTextSharp.LGPLv2.Core
is an unofficial port of the last LGPL version of the iTextSharp (V4.1.6) to .NET Core.
To install iTextSharp.LGPLv2.Core, run the following command in the Package Manager Console:
PM> Install-Package iTextSharp.LGPLv2.Core
You can also view the package page on NuGet.
The SkiaSharp
library needs extra dependencies to work on Linux and containers. Please install the following NuGet packages:
PM> Install-Package SkiaSharp.NativeAssets.Linux.NoDependencies
PM> Install-Package HarfBuzzSharp.NativeAssets.Linux
You also need to modify your .csproj
file to include some MSBuild directives that ensure the required files are in a good place. These extra steps are normally not required but seems to be some issues on how .NET loads them.
<Target Name="CopyFilesAfterPublish" AfterTargets="AfterPublish">
<Copy SourceFiles="$(TargetDir)runtimes/linux-x64/native/libSkiaSharp.so" DestinationFolder="$([System.IO.Path]::GetFullPath('$(PublishDir)'))/bin/" />
<Copy SourceFiles="$(TargetDir)runtimes/linux-x64/native/libHarfBuzzSharp.so" DestinationFolder="$([System.IO.Path]::GetFullPath('$(PublishDir)'))/bin/" />
</Target>
The pdf is created, but when I try to view it, it says that the document is in use by another process.
You should dispose the FileStream/MemoryStream explicitly. It won't be closed and disposed automatically at the end.
I can't find what would be the equivalent of the PdfTextExtractor class.
PdfTextExtractor exists in v5.0.2+ with AGPL license (Current project is based on the iTextSharp 4.x, not 5.x).
It can't display Unicode characters.
You can find more samples about how to define and use Unicode fonts here.
Table rowspans don't work correctly.
This version which is based on iTextSharp V4.1.6 doesn't support rowspans correctly (iTextSharp supports row spans correctly since v5.4.3, not before that). A solution based on the current version: use nested tables
to simulate it.
iTextSharp.text.html.simpleparser.HTMLWorker does not exist.
It has been renamed to HtmlWorker.
You have three license choices when it comes to iTextSharp: LGPL/MPL, AGPL, or a commercial license. The LGPL/MPL license is only an option with the older 4.1.6 version (used here). After that version, they switched to a dual AGPL/Commercial.
If you need a more recent version, you either have to make your project open-source or pay the license fee.