At most 4 elements (for any collection) can be viewed in evaluation mode. With latest licence

We have the mentioned issue with our code that converts PDF to DocX. Here is the java code snippet:

public static byte[] convertPDFToDOCX(Document document) {
byte[] buffer;
try {
final File tempFile = File.createTempFile(“wordTempFile”, “.tmp”);
//the issue occurs on the following line:
document.save(tempFile.getAbsolutePath(), SaveFormat.DocX);
buffer = Files.readAllBytes(Paths.get(tempFile.getAbsolutePath()));
} catch (Exception e) {
log.error("", e);
throw new ClmaRuntimeException(e.getMessage());
}
return buffer;
}

We get the error that : At most 4 elements (for any collection) can be viewed in evaluation mode.
We have the latest purchased 5 days ago, but this is still not working after license upgrade. I notice that there are quite a lot people with this issue, that you advised to check their license. This is NOT our case.

Best,
Sofija

@callidus

Thank you for contacting support.

I would like to share with you that the issue pertains to setting the license. Your license is not being set properly. Please try setting it with the following code in your environment.

com.aspose.pdf.License license = new com.aspose.pdf.License();
license.setLicense("D:\\License\\Aspose.Pdf.Java.lic");

and then you may verify if the license has been set successfully or not, with the following code.

if (com.aspose.pdf.Document.isLicensed()) {
    System.out.println("License is Set!");
}

This will hopefully resolve the evaluation limitation you are facing. In case the issue persists, please send your license file to us so that we may investigate it further to help you out.

As I mentioned, our license is good and just updated. We are using the Aspose 17.8 with Aspose.Total for Java (Developer OEM) license.

However, we used suggested code to verify, and we were able to see that license is working as expected.

What do you mean by send your license???

@callidus

If the license is working as expected, then this error may not be thrown by Aspose.Pdf API. Are you working with any other component at the same time? Like Aspose.Words for Java or any other API from Aspose. If you are using any other component then you need to set license separately for each API. Please try converting the PDF file to a DOCX file in a new project while working with Aspose.Pdf only; or you may check with breakpoints that which line of code is causing this error.

Kindly share your license file with us by following the instructions written over this link: How to send your license file to an Aspose staff member

Furthermore, kindly share your source PDF file here in this thread while mentioning your environment details (OS details, JDK version etc) so that we may investigate your scenario in our environment to help you out.

You can see in the code example I sent you that we only use Aspose for PDF in this class. The problem occures when we try to save pdf document as docx file. (As you can see in my code snippet, I left the comment above the line that’s causing problem. I debugged that already.)
We have license set separately for Aspose.Word and Aspose.PDF in our application. This is our code for this (note that we use streams, not files):

       InputStream stream = new ByteArrayInputStream(LicenseConstants.Aspose.getBytes(StandardCharsets.UTF_8));

        // init Licenses license
        log.debug("License Licenses");
        com.aspose.words.License licenseWord = new com.aspose.words.License();
        licenseWord.setLicense(stream);

        com.aspose.pdf.License licensePdf = new com.aspose.pdf.License();
        InputStream stream2 = new ByteArrayInputStream(LicenseConstants.Aspose.getBytes(StandardCharsets.UTF_8));
        licensePdf.setLicense(stream2);

Thanks for the explanation regarding the license, I will send it to you now.

@callidus

Thank you for sharing the license with us.

I have worked with the license file shared by you but I am unable to reproduce the issue you have reported. The license is working fine and PDF to DOCX conversion takes place without any error or evaluation watermark on generated file. I have attached the source PDF file along with a java class that contains simplified code to perform the conversion, for your kind reference. Please run this file in your environment and then share your kind feedback with us.

files.zip

As requested earlier, please share your environment details(OS details, JDK version etc) with us. In case the issue persists, kindly share your source file and narrowed down sample application reproducing the issue.

Can you please try the same with the attached PDF file

CLM-676.pdf (27.6 KB)

@callidus

I have worked with your source PDF file and it is converted to a DOCX file successfully while using the license file shared by you. I have attached the generated DOCX file for your kind reference. CLM-676.zip

Please share your feedback and environment details(OS details, JDK version etc) with us.

We are experiencing this issue on the following OS:
Centos 6.7
Windows 7

Java version:
1.8_112-b15

@callidus

Thank you for sharing requested details.

Please share if you have tried executing the class file that I had shared in “files.zip” in a separate project, or not? Kindly share your observations if this has fixed the issue or not. A most likely reason for this issue can be if you are working with the API before the license is being set in your code. Please share your feedback after testing the issue with aforementioned java class in a separate project.

Hi, I tried executing the class you sent me. It works as expected. Not sure how is this going to help me.
I have initially suspected that this issue is related to the older API problem, but haven’t received any suggestion how to fix it to this date.
We are still experiencing the same issue in our main application.

@callidus

The class file I had shared with you is working fine. This concludes, there is certainly no issue with your license. A minor problem while setting the license file may be getting overlooked in your application. Please share your narrowed down sample application reproducing the issue, as a zip file. So that we may investigate further to help you out.

Hi, I said in my no. 1 post that we don’t have any problems with the license and you made me check that in 3 different ways? This is unbelievable. I also sent my code initially, and you once again have the courage to ask me for the sample application, after wasting 10 days on going back and forth with you?
Our team decided that this issue is not big enough problem for us to continue wasting our time on this bug of yours. We expect that someone with more patience will report it, so you are going to fix it anyways.

@callidus

We are sorry for the inconvenience you have been facing. We really understand your concerns and considering the description of error you have shared with us, there is no doubt that it could be some other reason except setting the license. Tracing this error, we have tried to check it with every way possible. But you are still facing the issue, so I have been requesting for your sample application, the whole project including all the java classes and any other necessary resource to reproduce it because in order to fix an issue it is necessary to replicate that issue in our environment. Since it is evident that the issue is related to your environment and program routine and certainly not related to the API.

That is why I have requested you in my earlier post(s) to share your sample project, so that we can investigate, which routine of your code may be causing the issue.

I updated to version 17.11 and it works now

@callidus

Thank you for your kind feedback.

We are glad to know that your issue has been resolved. Please keep using our API and in event of any further query, feel free to ask.