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

Free Support Forum - aspose.com

Aspose Slides for Java Not Recognisizing License to Remove Trial Version Watermark

We have purchased the Aspose Total Product Family for Java but the Aspose Slides Total Product Family License fails to eliminate the Evaluation Watermark when we generate a PDF.

We declare the absolute path to the License file on the server and we create a com.aspose.slides.License object and initialize it by passing an InputStream for the License file.

We use the same license and the same process for the other Aspose components (e.g. Word, Cells, PDF, SharePoint, etc.) and they all work generating a final product without the obnoxious evaluation watermark.

What do we need to do differently to make Slides work? Searching the Aspose forums indicates this is a recurring problem which should have been resolved in an earlier version.

Would appreciate any assistance.
Thanks.
Ed

Hi Ed,


I am sorry for caused inconvenience on your end. I request you to please share the sample java file where by you are calling all license instances and Aspose.Slides is failing in it. Please visit these guidelines to share the license file. Please notify us here in this thread once you have shared the license file.

Many Thanks,

Here is just a snippet of my class file…

package testaspose;

import com.aspose.slides.;

import java.io.;

public class AsposeSlideTest {

private final String LICENSE_PATH = “D:/some path/Aspose//Licenses/”;

private final String LICENSE_NAME = “Aspose.Total.Product.Family.lic”;

protected String dataDir = “D:/temp/”;

protected boolean useDefaultOptions = false;

public AsposeSlideTest() { super(); }

public Boolean convertPowerpoint2PDF(String filename, String dataDir) {

Boolean converted = false;

ByteArrayOutputStream outStream = new ByteArrayOutputStream();

try {

FileInputStream fstream = null;

try {

fstream = new FileInputStream(LICENSE_PATH+LICENSE_NAME);

com.aspose.slides.License license = new com.aspose.slides.License();

license.setLicense(fstream);

}

catch (Exception e) { ; }

finally {

if (fstream != null) fstream.close();

}

}

catch (IOException ioe) {

ioe.printStackTrace(System.out);

}

String newFile = filename.substring(0, filename.lastIndexOf(".")) + “.pdf”;

Presentation presentation = null;

try {

try {

presentation = new Presentation(dataDir + filename);

PdfOptions options = new PdfOptions();

options.setJpegQuality((byte) 90);

options.setSaveMetafilesAsPng(true);

options.setTextCompression(PdfTextCompression.Flate);

options.setCompliance(PdfCompliance.Pdf15);

if (useDefaultOptions) {

presentation.save(dataDir + newFile, SaveFormat.Pdf);

}

else {

presentation.save(dataDir + newFile, SaveFormat.Pdf, options);

}

converted = true;

}

catch (OutOfMemoryError err) {

if (presentation != null) presentation.dispose();

converted = false;

}

}

catch (Exception e) {

if (presentation != null) presentation.dispose();

converted = false;

}

finally {

if (presentation != null) presentation.dispose();

}

return converted;

}

}

I will be sending my License file, as requested, immediately following this post.

Thank you.

Ed

As requested, I have sent our License file to Mudassir and am notifying Aspose via this forum.

Thanks.
Ed

Hi Ed,


I have worked with the java and license file shared by you on my end. I have not been able to observe any issue while loading the license. I have made small modification in your java file to get the status that if license file is properly loaded or not. The License.getLicenced() method returns true in case of valid license load and false in case of failing. I request you to please create a sample application from scratch to verify the working of license on your end and make sure that paths are correct.

Many Thanks,

Mudassir,



Thank you for the suggestion. Unfortunately, the method you suggest “License.getLicenced()” is not part of the com.aspose.slides.License library. In fact, I could not find reference to this method in the com.aspose.cells or com.aspose.words libraries either. Perhaps that is a deprecated method, a future version, an administrative or development library unavailable to the public, or one of the other API License object methods? We are using Slides 14.8.0, Words 14.10.0, Cells 8.3.0, and PDF 9.5.2 while our Total Product Family License version is 14.7.0.0.



After setting the appropriate License object, to validate the License object of a “Slides” object, you can only use the License.getVersion() which returns a String representing the current version of the Slides library. I was surprised to learn that the methods used to validate/verify the License object of Slides, Words, and Cells objects are inconsistent. There are no methods to verify a Words object. To verify a Cells object, you use License.isLicenseSet() which returns a Boolean. I would have expected the License object would be consistent across each Aspose API.



Anyhow, I was able to convert a PowerPoint file to PDF without the obnoxious evaluation watermark. Apparently, I had an issue with my “global” License object declaration and once corrected it worked fine.



Thanks.

Ed

Hi ED,


That is appreciable that things have started to work on your end. Please try using following sample code to validate the license.

com.aspose.slides.License lic=new com.aspose.slides.License();
lic.setLicense(path+“Aspose.Total.Product.Family.lic”);
boolean licenced= lic.isLicensed();
I am sorry for your inconvenience that I mistakenly wrote getLicensed() instead of isLicensed() method.

Many Thanks,

Mudassir,

I tried using your suggestion, but once again you reference a method not available via the com.aspose.slides.License object (e.g. lic.isLicensed()). Are you able to actually compile your suggestion? I’m also disappointed in Aspose’s online Java documentation. The only references I find for the com.aspose.slides.License object are:

License() – constructor

setLicense(String LicenseName)

Through my Java IDE (Oracle JDeveloper 11g), I can see the following available methods, once a License object is instantiated are:

license.clone() returns Object

license.equalsObject() returns boolean

license.finalize() returns void

license.getClass() returns Class

license.getVersion() returns String

license.hashCode() returns int

license.notify() returns void

license.notifyAll() returns void

license.setLicense(InputStream) returns void

license.setLicense(String) returns void

license.toString() returns String

license.wait(long) returns void

license.wait(long, int) returns void

license.wait() returns void

Here is the code I am using to validate my com.aspose.slides.License object has been loaded with a valid license:

final String LICENSE_PATH = “C:/absolute path/”;

final String LICENSE_NAME = “Aspsoe.Total.Product.Family.lic”;

com.aspose.slides.License license = new com.aspose.slides.License();

FileInputStream fstream = new FileInputStream(LICENSE_PATH, LICENSE_NAME);

license.setLicense(fstream);

//alternative method to set License object

// license.setLicense(LICENSE_PATH + LICENSE_NAME);

// to verify License loaded and assume valid if result returned is not null

String licenseVersion = license.getVersion();

System.out.println("License Version = " + licenseVersion);

result:

License Version = 14.7.0.0

Therefore, I assume the License has been loaded and the License is valid.

Thanks.

Ed

Hi Ed,


I am sorry for your inconvenience. I will look further into API documentation improvement as well on my end. Secondly, the sample code that I have shared is actually working with Aspose.Slides for Java 14.8.0 and I have tested that as well before sharing with you. Secondly, it is good if things are working on your end.

Many Thanks,