My company has just purchased a license of Spire.PDF (KiteEdge).
Our scenario is as follows.
Console EXE (.NET Core or .NET Framework)
---------------
|
|-------Plugin1.dll
|
|-------Plugin2.dll
|
|-------Plugin3.dll
|
|
|-------WatermarkPlugin.dl (using Spire.PDF)
Our EXE is designed to load various plugin assemblies using Assembly.LoadFrom. Each of these plugin assemblies along with their dependencies reside in their own folders.
The plugin assemblies are compiled on .NET Standard 2.0.One such plugin is a WaterMark plugin which calls the Spire.PDF to do the watermark.
We are using the CopyLocalLockFileAssemblies attribute in the CSPROJ to copy over all the dependencies to the output folder of the class library. Please note that the EXE has no knowledge of the plugin dependencies. The EXE has no compile time references to Spire.Pdf.
When WaterMark plugin is compiled using .NET Framework
Everything works fine. We find the folders x86 and x64 getting created and
When WaterMark plugin is compiled using .NET Standard 2.0
The executable throws the error :
- Code: Select all
'libSkiaSharp': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SkiaSharp.SkiaApi.sk_path_new()
at SkiaSharp.SKPath..ctor()
at sprᡑ..ctor()
at sprᨀ..ctor()
at Spire.Pdf.PdfPageBase..ctor(sprᣛ A_0, sprᥙ A_1)
at Spire.Pdf.PdfPageWidget..ctor(PdfDocumentBase A_0, sprᥙ A_1, sprᣛ A_2)
at Spire.Pdf.Widget.PdfPageCollection.ᜄ(sprᣛ A_0)
at sprᥙ.ᜀ(sprᢶ A_0)
at sprᥙ.ᜃ(sprᢶ A_0)
at sprᣣ.ᜂ()
at sprᣣ.ᜀ()
at sprᣣ.ᜁ()
at sprᥙ.ᜃ(sprᢶ A_0)
at Spire.Pdf.Widget.PdfPageCollection.ᜀ(sprᣛ A_0, Int32 A_1, Int32& A_2, Int32& A_3)
at Spire.Pdf.Widget.PdfPageCollection.ᜀ(Int32 A_0, Int32& A_1, Boolean A_2)
at Spire.Pdf.Widget.PdfPageCollection.ᜀ(Int32 A_0)
at Spire.Pdf.Widget.PdfPageCollection.get_Item(Int32 index)
at Spire.Pdf.Widget.PdfPageWidgetEnumerator.get_Current()
at Peak.Plugins.Watermark.SpireWatermarkExtractor.StampFile(String fileIn, String fileOut, String waterMark)
at Peak.Plugins.Watermark.SpireWatermarkExtractor.Exract(DataPointExtractorInputs inputs, DataPointResults results)
at Peak.BaseEngine.Central.legacy.LegacyExtraction.ExecuteAllDynamicDataPointExtractors() in C:\Users\saurabhd\Apex\ApexIngestion\Peak.BaseEngine.CentralStd\LegacyExtraction.cs:line 449
Workaround
I managed to solve the problem by manually adding the files libSkiaSharp.dll and libSkiaSharp.dylib to the WaterMark plugin project and setting the "Copy to Output Directory"
Conclusion
Spire.PDF works very nicely overall. If I had a traditional EXE hard bound to my Watermark class library, the EXE would have resolved the pacakge references and there would be no problems.
To allow for plugin scenarios like the above (plugin), it would be important for Spire.PDF to reference the unmanaged assemblies on .NET Standard 20 and add them automatically to the project. You are already doing this for .NET Framework. Please consider doing something similar for .NET Standard 20 or provide guidance for the workaround.
Thanks