Aspose PDF cannot find the embedded license file

Hi,

The release build of my DLL prompted it cannot locate “Aspose.Total.lic” file… The debug version showing no such problem.

Any idea?

MyBass

Hi Pei Ying,


Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 7.0.0 where I have included the license file as an embedded resource in my VisualStudio 2010 Solution and I have specified .NET Framework 4.0 as target platform and when executing the application in Release or Debug mode, I am unable to notice any problem. I have tested the scenario over Windows 7 X64 Professional. For your reference, I have also attached the screen shot which shows my application environment.

Please note that I have used the following code snippet to initialize the license file.

[C#]

// initialize license object<o:p></o:p>

Aspose.Pdf.License lic = new Aspose.Pdf.License();

// Name of license fie. Note that WindowsFormsApplication1 is default namespace of project

lic.SetLicense("WindowsFormsApplication1.Aspose.Total.Product.Family.lic");

// embed the license file with solution

lic.Embedded=true;


Can you please share further details regarding your working environment i.e. Aspose.Pdf for .NET version, OS version, OS architecture (X64 or X86), .NET Framework version, VisualStudio version etc. We are sorry for your inconvenience.

Hi,

I tested using Windows 7 Professional 64 bit. Due to find out the cause, I have tested using Windows Server 2003 R2 as well. The strange thing is Words, Excel, and Mails do not have such issue. They all in the same assembly. Please refer to the pictures I captured.

OS: Windows7 64 bits.
VS Studio 2010 Version 10.0.40219.1 SP1Rel
.NET Frameword Version 4.0.30319 SP1Rel
Aspose.Pdf - runtime version v4.0.30319

Hi Pei Ying,

Thanks for sharing the details.

I have again tested the scenario using Aspose.Pdf for .NET 7.0.0 in a VisualStudio 2010 project where I have selected the target platform as .NET 4.0 and I have included Aspose.pdf.dll from net4.0 folder present under <Aspose.Pdf_Install_Directory\bin> and I am unable to notice any problem. When using license file as an embedded resource, did you try to initialize the license using following code line.

[C#]
<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

<![endif]–>

Aspose.Pdf.License lic = new Aspose.Pdf.License();

// MergedAPI is default namespace of project

lic.SetLicense("MergedAPI.Aspose.Total.Product.Family.lic");

lic.Embedded = true;


In case the problem still persists, can you please share the license file so that we can test the scenario at our end. Please visit the following link for instructions on How to send a license?

Hi Team,


I am using Aspose License for my website to create PDF and word docs.
It runs fine for a period of time and then suddenly starts throwing errors as Object Reference not set to an object.
When I re-deploy the License or DLL’s of Aspose, it starts working again.
Can somebody help in this regard.

Thanks in advance.
-Saurav Kumar

Hi Saurav,

We are sorry for the inconvenience. I am afraid it is quite difficult to suggest you anything without replicating the issue at our end. However please consider following points. Hopefully it will help you to resolve the issue and if the issue persist then please share a sample project to replicate the issue, so we will look into it and will guide you accordingly.

Aspose.Pdf supports multi-threading but it is multi-thread safe as long as only one thread works on a document at a time. If you manipulate a single document in different threads, the results would be unstable.

Furthermore please check your license implementation logic. It is suggested to set license in some Application Level event. When you will set the license in application level event/scope, it will remain valid till the lifespan of application.

  • If you are developing an ASP.NET application, you can call License.SetLicense from the Global.asax.cs (Global.asax.vb) file, in the Application_Start protected method. It is called once when the application starts. Do not call License.SetLicense from within Page_Load methods since it means the license will be loaded every time a web page is loaded.
  • If you are developing a Windows Forms or console application, call License.SetLicense in your startup code, before using Aspose.Pdf for .NET classes.
  • If you are developing a class library, you can call License.SetLicense from a static constructor of your class that uses Aspose.Pdf for .NET. The static constructor will execute before an instance of your class is created making sure Aspose.PDF for .NET license is properly set.


Best Regards,