SetLicense for php with javabridge

Hello,

I just purchased a license for Aspose.words for java. I am using it within PHP with the the Java bridge. Creating documents is going fine with the following code:

$doc = new Java('com.aspose.words.Document');

etc…

I thought I just have to add the following code, but my documents are still having the Evaluation Only message.

$license = new Java('com.aspose.words.License');
$license->setLicense(æAspose.Words.lic');

Somebody a working licensed php code example?

thanks

w

Hi Winfred,
Thanks for your inquiry. Your code for setting license is correct and should work without any issues. Please make sure:

  1. You set license before using other Aspose.Words classes.
  2. setLicense does not throw and exception.

Your code should look like the following:

<?php
require_once("http://localhost:8080/JavaBridge/java/Java.inc");
java_require("lib\\Aspose.Words.jdk15.jar;lib\\jaxen-1.1.jar");
$license = new Java("com.aspose.words.License");
$license->setLicense("Aspose.Words.lic");
$doc = new Java("com.aspose.words.Document");
$builder = new Java("com.aspose.words.DocumentBuilder");
$builder->setDocument($doc);
$builder->write("Hello world!");
$doc->save("C:\\Temp\\out.doc");
?>

Hope this helps.
Best regards,