Rank: Member
Groups: Registered
Joined: 5/30/2016(UTC) Posts: 14  Thanks: 4 times
|
Hi,
I have a need to work with PDFIUM.NET in a ASP.NET Core App (targetting .NET Framework) I've used the typical PdfCommon.Initialize command to register the licence but then I get a
Patagames.Pdf.Net.Exceptions.NoLicenseException: 'The requested operation cannot be completed due to a license restrictions. The requested operation cannot be completed due to a license restrictions. You need to have a full license to be able to complete this operation.' on first API call.
The exact same code works in a Console app
Any clue on how to activate in this environment ?
Thanks
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Could you please provide a line of code there this exception is thrown or exception's stack trace.
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/30/2016(UTC) Posts: 14  Thanks: 4 times
|
The code is : Code:
//Gets the location of the current assembly as URI
string codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string assemblyPath = Uri.UnescapeDataString(uri.Path);
//Gets directory for assembly
var DllFolder = Environment.Is64BitProcess ? "x64" : "x86";
var PdfiumPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(assemblyPath), $@"{DllFolder}\pdfium.dll");
PdfCommon.Initialize("XXXXXXX", PdfiumPath);
var doc = Patagames.Pdf.Net.PdfDocument.Load(DocumentPath);
List<LayerInfo> LayerInfos = new List<LayerInfo>();
Patagames.Pdf.Net.BasicTypes.PdfTypeDictionary root = doc.Root;
Patagames.Pdf.Net.BasicTypes.PdfTypeDictionary oc_prop = root["OCProperties"] as Patagames.Pdf.Net.BasicTypes.PdfTypeDictionary;
Patagames.Pdf.Net.BasicTypes.PdfTypeArray ocgs = oc_prop["OCGs"] as Patagames.Pdf.Net.BasicTypes.PdfTypeArray;
Of course, real licence is not XXXXXXX. Exception occur at line : Patagames.Pdf.Net.BasicTypes.PdfTypeDictionary root = doc.Root; Code:Patagames.Pdf.Net.Exceptions.NoLicenseException
HResult=0x80131500
Message=The requested operation cannot be completed due to a license restrictions. The requested operation cannot be completed due to a license restrictions. You need to have a full license to be able to complete this operation.
Source=Patagames.Pdf
StackTrace:
at Patagames.Pdf.Pdfium.ProcessLastError()
at Patagames.Pdf.Pdfium.ManagedCallbackFunc(Int32 level, String pcode)
at Patagames.Pdf.Pdfium.FPDF_GetRoot_native(IntPtr document)
at Patagames.Pdf.Pdfium.FPDF_GetRoot(IntPtr document)
at Patagames.Pdf.Net.PdfDocument.get_Root()
at PDFEditorSample3.PdfiumSample.Load(String DocumentPath) in D:\Source\Repos\PDFEditorSample\PDFEditorSample3\PdfiumSample.cs:line 27
at PDFEditorSample3.Controllers.HomeController.Index() in D:\Source\Repos\PDFEditorSample\PDFEditorSample3\Controllers\HomeController.cs:line 18
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Well, you trying to get access to the document's internals: Document.Root for example. This functionality is not available in the LITE version of SDK, but seems you are initializing it by the key for LITE version. if you don't know which type of key you are using, please provide it to support@patagames.com to check. Edited by user Tuesday, September 18, 2018 8:37:20 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/30/2016(UTC) Posts: 14  Thanks: 4 times
|
Indeed, that may be the reason. I didn't pay attention to which functionnalities are available to which licensing mode.
As it's the first time I try to access the doc internals, I did not encounter the issue before.
I'll have a look at the full license
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
To test the the full functionality you can switch back to the trial mode by removing your key from initialization .
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/30/2016(UTC) Posts: 14  Thanks: 4 times
|
Thanks Paul for the info. So my post title is wrong, it's not an environment issue but a licensing issue. Not sure if it's worth keeping this thread in the support forum.
|
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close