We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Licence file no longer recognised after installing new version (10.9) of PDF for .NET

I have been using a purchased version Aspose.PDF for .NET since March of this year and so have a valid licence file until March 2016. Everything was working correctly in that my generated PDFs did not contain an Evaluation watermark.

I recently installed the latest version of Aspose PDF for .NET (version 10.9) and since I did this, I am now seeing an Evaluation watermark on all my generated PDFs.

No other code changes have been made since the new software installation.

Can you advise if this is a bug or if a new licence file is required for the new version?

Thanks

I have since discovered that this could possibly be an issue with the Aspose.PDF.Document object.
I have placed the Aspose.Pdf.lic file in my project bin folder.
I run the following line of code within the Page_load event:

Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(“Aspose.Pdf.lic”);

I have tested generating a PDF file using two methods:

1) Using the Aspose.Pdf.Generator class and methods
2) Using the Aspose.Pdf.Document class and methods

When using the Generator class, the PDF is created without an Evaluation watermark.
When using the Document class, the PDF is created with an Evaluation watermark.

I need to use the Document class because the Generator class has a bug where my pageinfo settings are only applied to the first page in a multi frame tiff image when converting to a PDF. The Document class appears to process the tiff image correctly and applies page settings across all tiff frames and PDF pages.

Can anyone help?

Thanks

Hi Mike,


We are sorry for the inconvenience caused. If you have a valid license file, then it seems some issue in your license implementation. Please double check your license file in a simple console application with 10.9.0. However if the issue persist then please share here your sample code and source files along with license file via email as suggested here, so we will look into it and guide you accordingly.

Moreover, If you are developing an ASP.NET application, you should 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.

Best Regards,

Hi,

I now believe the issue is not related to the software version but to the Document model that I am using to create my PDF.

I have created a very simple C# .Net Website. In my Global.asax file I have placed the following code:

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense("Aspose.Pdf.lic");
}

I have two buttons on my Default page. The first button takes a multi frame (4) tif file and creates a 4 page PDF based on the tif file contents. For this button I am using the Aspose.PDF.Document class to generate the PDF. This results in an Evaluation watermark appearing in the top left hand corner of the PDF.

The second button takes the same multi frame (4) tif file and creates a 4 page PDF based on the tif file contents. For this button I am using the Aspose.PDF.Generator class to generate the PDF. This results in no Evaluation watermark appearing in the top left hand corner. Below is my code for each button click.

Incidentally there is a bug in the Generator class whereby the PageInfo settings are only applied to the first page when converting a multi frame tif image (you will notice that pages 2, 3 and 4 are a different size to page 1 in this example). This is why I am having to use the Document class and encountered this issue.

Also, when I comment out my License file SetLicense section so that no license is applied, an additional watermark appears (in red) within the PDF. I have attached an example of this along with the pdf files created when the license code is applied.

protected void btnConvert_Click(object sender, EventArgs e)
{
// Create a new bitmap image to get the dimensions and other image details
Bitmap b = new Bitmap(@"C:\Temp\28-10-2015_3268000932101455.tif");
lblProgress.Text = "Bitmap Loaded....";

//New document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
lblProgress.Text = "Aspose Document Object created....";

//Add a page to the document
Aspose.Pdf.Page page = doc.Pages.Add();
lblProgress.Text = "Page added to document....";

//Set PDF document Page settings
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;

page.PageInfo.Width = b.Width;
page.PageInfo.Height = b.Height;
lblProgress.Text = "Page settings applied....";

//Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
lblProgress.Text = "PDF Image object created....";

//Add image object to the Paragraph collection
page.Paragraphs.Add(image1);
lblProgress.Text = "Image object added to Paragraph....";

//Set image properties
image1.IsBlackWhite = true;
image1.FixWidth = page.PageInfo.Width;
image1.FixHeight = page.PageInfo.Height;
lblProgress.Text = "Image properties set....";

image1.File = @"C:\Temp\07-05-2015_3268000932101831.tif";
lblProgress.Text = "Image file path set....";

//Save the PDF
doc.Save("C:\\Temp\\AsposeDocumentTest.pdf");
lblProgress.Text = "PDF saved....";

//Clean bitmap image
b.Dispose();

}
protected void btnConvert1_Click(object sender, EventArgs e)
{

// Create a new bitmap image to get the dimensions and other image details
Bitmap b = new Bitmap(@"C:\Temp\28-10-2015_3268000932101455.tif");
lblProgress.Text = "Bitmap Loaded....";

//Instantiate a PDF Object
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

pdf1.PageSetup.PageWidth = b.Width;
pdf1.PageSetup.PageHeight = b.Height;

//Create a section in the PDF Object
Aspose.Pdf.Generator.Section sec1 = new Aspose.Pdf.Generator.Section(pdf1);

//Set the margins
sec1.PageInfo.Margin.Top = 0;
sec1.PageInfo.Margin.Bottom = 0;
sec1.PageInfo.Margin.Left = 0;
sec1.PageInfo.Margin.Right = 0;

//Set Page size to match image
sec1.PageInfo.PageWidth = b.Width;
sec1.PageInfo.PageHeight = b.Height;

//Add the section to the sections collection
pdf1.Sections.Add(sec1);

//Create an Image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

//Add image object in the Paragraph collection of the section
sec1.Paragraphs.Add(image1);

//SEt the Image type
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
image1.ImageInfo.TiffFrame = -1;
image1.ImageInfo.IsAllFramesInNewPage = true;

//set image to match page size
image1.ImageWidth = sec1.PageInfo.PageWidth;
image1.ImageHeight = sec1.PageInfo.PageHeight;


//Attempt to gain a performance improvement by forcing the Tif image to be black and white
image1.ImageInfo.IsBlackWhite = true;

//set the path of the image file
image1.ImageInfo.File = @"C:\Temp\07-05-2015_3268000932101831.tif";

//save the PDF
pdf1.Save("C:\\Temp\\AsposeGeneratorTest.pdf");
}protected void btnConvert_Click(object sender, EventArgs e)
{
// Create a new bitmap image to get the dimensions and other image details
Bitmap b = new Bitmap(@"C:\Temp\28-10-2015_3268000932101455.tif");
lblProgress.Text = "Bitmap Loaded....";

//New document
Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
lblProgress.Text = "Aspose Document Object created....";

//Add a page to the document
Aspose.Pdf.Page page = doc.Pages.Add();
lblProgress.Text = "Page added to document....";

//Set PDF document Page settings
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Left = 0;
page.PageInfo.Margin.Right = 0;

page.PageInfo.Width = b.Width;
page.PageInfo.Height = b.Height;
lblProgress.Text = "Page settings applied....";

//Create an image object
Aspose.Pdf.Image image1 = new Aspose.Pdf.Image();
lblProgress.Text = "PDF Image object created....";

//Add image object to the Paragraph collection
page.Paragraphs.Add(image1);
lblProgress.Text = "Image object added to Paragraph....";

//Set image properties
image1.IsBlackWhite = true;
image1.FixWidth = page.PageInfo.Width;
image1.FixHeight = page.PageInfo.Height;
lblProgress.Text = "Image properties set....";

image1.File = @"C:\Temp\07-05-2015_3268000932101831.tif";
lblProgress.Text = "Image file path set....";

//Save the PDF
doc.Save("C:\\Temp\\AsposeDocumentTest.pdf");
lblProgress.Text = "PDF saved....";

//Clean bitmap image
b.Dispose();

}
protected void btnConvert1_Click(object sender, EventArgs e)
{

// Create a new bitmap image to get the dimensions and other image details
Bitmap b = new Bitmap(@"C:\Temp\28-10-2015_3268000932101455.tif");
lblProgress.Text = "Bitmap Loaded....";

//Instantiate a PDF Object
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

pdf1.PageSetup.PageWidth = b.Width;
pdf1.PageSetup.PageHeight = b.Height;

//Create a section in the PDF Object
Aspose.Pdf.Generator.Section sec1 = new Aspose.Pdf.Generator.Section(pdf1);

//Set the margins
sec1.PageInfo.Margin.Top = 0;
sec1.PageInfo.Margin.Bottom = 0;
sec1.PageInfo.Margin.Left = 0;
sec1.PageInfo.Margin.Right = 0;

//Set Page size to match image
sec1.PageInfo.PageWidth = b.Width;
sec1.PageInfo.PageHeight = b.Height;

//Add the section to the sections collection
pdf1.Sections.Add(sec1);

//Create an Image object in the section
Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);

//Add image object in the Paragraph collection of the section
sec1.Paragraphs.Add(image1);

//SEt the Image type
image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Tiff;
image1.ImageInfo.TiffFrame = -1;
image1.ImageInfo.IsAllFramesInNewPage = true;

//set image to match page size
image1.ImageWidth = sec1.PageInfo.PageWidth;
image1.ImageHeight = sec1.PageInfo.PageHeight;


//Attempt to gain a performance improvement by forcing the Tif image to be black and white
image1.ImageInfo.IsBlackWhite = true;

//set the path of the image file
image1.ImageInfo.File = @"C:\Temp\07-05-2015_3268000932101831.tif";

//save the PDF
pdf1.Save("C:\\Temp\\AsposeGeneratorTest.pdf");
}

Hi Mike,


Thanks for providing additional information. We have already noticed that Aspose.Pdf is adding a watermark in resultant PDF document when we convert TIF image to PDF with IsBlackWhite property to true, and we had logged a ticket PDFNEWNET-38522 in our issue tracking system for the rectification. We have linked your post to the issue as well, so we will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-38522) have been fixed in Aspose.Pdf for .NET 11.1.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.