APOSE.PDF License Error

Hi

I’m trying to get the following piece of code working.

It works for all other Aspose Modules like pdf.kit word cell etc.

but not for the Aspose.PDF.

It’s runs on an SQL Server as a stored procedure.

Error Message below

Thanks for the help

Michael

[Microsoft.SqlServer.Server.SqlProcedure]
public static void alber_activatePDFLicense()
{
Aspose.Pdf.License license = new Aspose.Pdf.License();

license.SetLicense(“Aspose.Total.lic”);



}

Msg 6522, Level 16, State 1, Procedure alber_activatePDFLicense, Line 0

A .NET Framework error occurred during execution of user-defined routine or aggregate "alber_activatePDFLicense":

System.IO.FileNotFoundException: Could not load file or assembly '{e70953a9-b163-4c7d-9424-9a7adb3a96d3}, PublicKeyToken=3e56350693f7355e' or one of its dependencies. The system cannot find the file specified.

System.IO.FileNotFoundException:

at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

at ..(Object , ResolveEventArgs )

at System.AppDomain.OnResourceResolveEvent(String resourceName)

at System.Reflection.Assembly._GetResource(String resourceName, UInt64& length, StackCrawlMark& stackMark, Boolean skipSecurityCheck)

at System.Reflection.Assembly.GetManifestResourceStream(String name, StackCrawlMark& stackMark, Boolean skipSecurityCheck)

at System.Reflection.Assembly.GetManifestResourceStream(String name)

at ..(String , Assembly )

at ..(String , Assembly , Boolean )

at ..(String , Assembly )

at Aspose.Pdf.License.SetLicense(String licenseName)

at StoredProcedures.alber_activatePDFLicense()

.

Hi Michael,

Thanks for using our products.

Can you please share which version of Aspose.Pdf for .NET you are using ? Actually we noticed similar issue in previous release version of Aspose.Pdf for .NET but its been fixed in latest version available. Please try using Aspose.Pdf for .NET 6.2.0 and in case you still face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

Hi Nayyer

Thank you for looking into this.
I using currently 6.2.0 but also got the same issue with 6.1.0 and an older 5.x.0 version.
I'm using the DLL as an Assembly in a SQL Server 2008.

Thanks

Michael

Hi Michael,

Thanks for sharing the details.

Can you please share the license file so that we can test the scenario at our end. We apologize for this inconvenience. Please visit the following link for instructions on How to send a license?

License has been sent to you.

Thanks

Hi Michael,

I am afraid I have not yet received any license file from your side. Can you please again try sending the required artifact so that we can test the scenario at our end. We are sorry for your inconvenience.

OK I send it again to you.

Hi,

I get the same error. I'm using an Aspose.Total license with Aspose.Pdf version 6.2 just downloaded today.

Rgds Bent

AlberM:

OK I send it again to you.



Hi Michael,

I am afraid I have not yet received any license file. Can you please try sending it once again. Please ensure that you are properly following the instructions specified over How to send a license?
PELLE42:

Hi,

I get the same error. I'm using an Aspose.Total license with Aspose.Pdf version 6.2 just downloaded today.

Hi Bent,

Thanks for using our products. Can you please share the license file so that we can test the scenario at our end.We apologize for your inconvenience. Please visit the following link for instructions on How to send a license?

License file has been sent.

BRgds Bent

Ok it’s send. Now With Firefox

Hi Bent,

I am afraid I have not yet received any documents from your side. In
fact currently there is an issue with our send email module and we are
already working on resolving this problem. We are really sorry for this inconvenience.

Hi Michael,

I am afraid I have not yet received any documents from your side. In
fact currently there is an issue with our send email module and we are
already working on resolving this problem. We are really sorry for this inconvenience.

Here some more information: I am working on a winform application. I have embedded several ddl's into the exe-file - including aspose.pdf.dll, aspose.cells.dll and aspose.word.dll. During application initiation all the assemblies are loading via a eventhadler for AppDomain.CurrentDomain.AssemblyResolve. This works very well for aspose.cells.dll and aspose.word.dll but it fails for aspose.pdf.dll with the above error. Moving the SetLicense for aspose.pdf before the registration of the eventhandler solved the problem, but then I am not able to embed the aspose.pdf.dll into the exe file.

Hope this information will be usefull for you.

BRgds Bent

Hi Michael,

I have been able to receive the license file from your side and have tested the scenario while using it but I am afraid I am unable to notice any issue when using the license file as an Embedded resource. Please note that when using license file as an embedded resource, please try using the following code lines.

[C#]
Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense(“MergedAPI.Aspose.Total.lic”);
lic.Embedded = true;

where MergedAPI is the default name space of the project. Please try using it and in case you still face any problem or you have any further query, please feel free to contact.

PS, I have tested the scenario while using Aspose.Pdf for .NET 6.2.0 in VisualStudio 2010 project where the target platform for my application is set to .Net Framework 4.0.

PELLE42:
Here some more information: I am working on a winform application. I have embedded several ddl's into the exe-file - including aspose.pdf.dll, aspose.cells.dll and aspose.word.dll. During application initiation all the assemblies are loading via a eventhadler for AppDomain.CurrentDomain.AssemblyResolve. This works very well for aspose.cells.dll and aspose.word.dll but it fails for aspose.pdf.dll with the above error. Moving the SetLicense for aspose.pdf before the registration of the eventhandler solved the problem, but then I am not able to embed the aspose.pdf.dll into the exe file.


Hi Bent,

I have been able to receive the license file form your side and have tested the scenario where I have include the license file as an embedded resource in my VisualStudio 2010 project. I am afraid I am unable to notice any issue. Can you please try following the steps specified in above post and in case you still face any issue, can you please help us in replicating the issue at our end. Can you please share the code snippet/sample project? (Please remember to remove the license file from project when sharing). We are really sorry for your inconvenience.

Hi I know that it works outside SQL Server.

Compile the following code as CLR stored procedure on a Sql server 2008 machine. It crashes and returns:

System.NullReferenceException: Object reference not set to an instance of an object.

please note that excalty this code works in all other APOSE products it seems the license autentification code in the PDF Module is not the same as in the others.


using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using Aspose.Pdf;
using System.IO;


public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void activatePDFLicense()
{
Aspose.Pdf.License lic = new Aspose.Pdf.License();
lic.SetLicense("Aspose.Total.lic");
lic.Embedded = true;


}
};

Hi,

I have tried replicating the issue but I am afraid I am unable to test the scenario completely. In fact I have created a project in VisualStudio 2008 and have selected its type as “SQL Server Project”. Now that I want to add Aspose.Pdf for .NET reference, I could not find the option to provide the .dll path information. I can only see Projects and SQL Server tabs over Add References dialog. Can you please help us in replicating the issue so that we can test it completely in our environment. We are really sorry for this inconvenience.

Sure no problem.

Connect to the Database with Sql server Management Studio
Open the Database
Open the Tree “Programmability”
Right click on Assemblies
New Assembly
Browse to the Aspose.pdf dll (.net version 2.0)
Permission set UNFASE
Click ok

There might a chance that you have to add more system assemblies where Apose.pdf is dependend from.

Go back to the VS 2008
Right lick on references
Add SQL Server Reference ASPOSE.pdf
Compile

Run the stored Procedure
And you will see the error.

Full walkthrough:
http://geekswithblogs.net/frankw/archive/2008/05/03/a-quick-walk-through-of-clr-integration-with-sql-server.aspx

http://msdn.microsoft.com/en-us/library/ms345106.aspx