Hi We have Aspose Words for Java and Aspose Cells for Java. We are having a valid licence file and yet the java plugin that we are using is showing evaluation only in the output document. I have checked the java plugin code and it sets the licence file as filestream before converting the document to PDF. Are there any additional changes required to be done to remove the evaluation only watermark?
@nidhul Please check the following points:
- Make sure your call to
SetLicense
gets executed. Step through in the debugger. - Make sure your code does not catch an exception thrown by Aspose.Words licensing code. For example, Aspose.Words will throw if it cannot find the license.
- Make sure the input documents do not already have the evaluation message. Aspose.Words does not delete existing evaluation messages.
- Make sure
SetLicense
is executed before you instantiate anyDocument
object. - Make sure you applied the license for all Aspose products used in your application.
Word Looks fine . The problem seems to be isolated to the Aspose.Cells. I have checked the code and the SetLicense is being done correctly before the workbook is called for conversion. The PDF gets generated with watermark Evaluation Only. Created with Aspose.Cells for Java.Copyright 2003 - 2020 Aspose Pty Ltd. The code is
private static void convertExcelToPdf(String excelDocumentPath, String s, FileInputStream licenseStream) throws Exception {
PdfSaveOptions pdfSaveOptions = null;
Workbook workbook = null;
Worksheet worksheet = null;
License license = new License();
license.setLicense(licenseStream);
try
{
workbook = new Workbook(excelDocumentPath);
for (int i = 0; i < workbook.getWorksheets().getCount(); i++)
{
worksheet = workbook.getWorksheets().get(i);
worksheet.autoFitColumns();
}
pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setOnePagePerSheet(true);
}
As part of debugging we did a license check using the code and it returns as invalid. The same happened for a trial license i got as well. Can you please help
private static boolean checkLicense(FileInputStream licenseStream) throws Exception {
try {
// Initialize license
License license = new License();
license.setLicense(licenseStream);
// Create a new workbook to test if the license was set correctly
Workbook workbook = new Workbook();
return workbook.isLicensed();
} catch (Exception e) {
System.out.print("Error checking license: ");
return false;
}
}
@nidhul Most likely License
class is taken from the wrong namespace. Please try using fully qualified names like this:
com.aspose.words.License wordsLic = new com.aspose.words.License();
wordsLic.setLicense("C:\\Temp\\Aspose.Total.lic");
com.aspose.cells.License cellsLic = new com.aspose.cells.License();
cellsLic.setLicense("C:\\Temp\\Aspose.Total.lic");
i made the code change as suggested but Still unable to get the right outcome. is there any other parameters that we are missing ?
@nidhul There are no other parameters. Since the problem is related to Aspose.Cells, I will move it to the appropriate forum. My colleagues from Aspose.Cells team will help you shortly.
It seems that you are using an older version of Aspose.Cells for Java with your (new) license. Which version of Aspose.Cells for Java are you using? We recommend using the latest version of the API instead of an older version with your license (if possible). If you want to persist with the older version of Aspose.Cells for Java, you may use your older license with the older version of the API. Anyways, to evaluate and investigate your issue precisely, we need your license file via a private message. In order to send a private message with an attachment (license file - please zip the file first), please click on my name and find the “Message” button. Now, please attach the zipped archive containing the license and send it to us. We will check the issue with your provided license. Also, see the topic on how to send the license to Aspose staff for your reference.
https://forum.aspose.com/t/how-to-send-license-file-to-support-team/225542
We do not have an old license file.We recently procured this license file for out application use case of Excel to PDF conversion. What are the changes in context of the functionality in the new version of API ? In the plugin code i can see the 20.5 jar file for Aspose.Cells. Do we have to refactor to the new version of API?
Thanks for sending us the license file via private message.
I have evaluated your issue using your license file, and it works absolutely fine with newer versions as I tested. I used Aspose.Cells for Java v24.5 with your license file, and it worked fine with the latest version of the API. Here is my sample code for your reference:
e.g.,
Sample code:
com.aspose.cells.License license = new com.aspose.cells.License();
license.setLicense("E:\\Licenses\\29-5-2024 Aspose.Cells for Java\\ClientAspose.Cells.Java.lic");
System.out.println(CellsHelper.getVersion());
Workbook workbook = new Workbook();
System.out.println(workbook.isLicensed());
....
output:
24.5.0
true
Why are you using an older version (20.5 jar)? We recommend that you kindly upgrade and try using newer versions of the API, as over the years we have included more enhancements and features to make the API more robust and feature-rich. To learn about new features, API changes, and other enhancements included in different versions, we recommend reviewing the release notes documents (for different years) of Aspose.Cells for Java versions for your complete reference.
https://releases.aspose.com/cells/java/release-notes/
Thanks for the update. Updating to new Jar file will be long term solution. In Interim, is there a way to get License compatible with the older version of Aspose Jar?
@nidhul
Please note that newer licenses are signed with SHA256, while older ones were signed with SHA1. You cannot use a SHA256 license with older versions of the API. You may either use your older license to work with older versions of Aspose.Cells for Java and use your new license to work with newer versions. This will always work.
For version 20.5 of Aspose.Cells for Java, it does not support the new license file (which is signed with SHA256) when you are using JDKs other than JDK1.6.
You may request an updated (new) license (in the purchase section) that should be signed with SHA1 and will work for you with both older and newer versions of the API.
Thanks for the update. We are going to proceed with the Java code uplift.
@nidhul
Thank you for your feedback. You are welcome. If you have any questions, please feel free to contact us.