Aspose.HTML JDK17 Support

Hi,

we are using Aspose.PDF / Aspose.HTML for generating PDF from HTML files (all packages for this are sitting in PDF Aspose java packages).

We have Total Java License. In this case we have applied the License with:

com.aspose.pdf.License pdfLicense = new com.aspose.pdf.License();
pdfLicense.setLicense(AsposeLicense.class.getResourceAsStream(ASPOSE_LICENSE_PATH));

Unfortunately when generating the PDF in the PDF we have: Evaluation Only. Created with Aspose.HTML. Copyright 2013-2020 Aspose Pty Ltd.

So I assume we should also inject the license for Aspose.HTML packed - what is funny because we don’t use this dependency at all.

Unfortunately the Aspose.HTML is not available for JDK17 which we are using for PDF and Words.

Dear Aspose Team - how we can handle this issue?

@przemekenoik

Can you please share your code snippet that you are using to generate PDF? Also, please share the version of the API that you are using.

Hi,

I’m using the following code:

URL url = Resources.getResource("templates/mytemplate.html");
HTMLDocument htmdoc = new HTMLDocument(new Url(url.getPath()));
// Render HTML to PDF
HtmlRenderer renderer = new HtmlRenderer();
String filePath = tempDirectoryPath.toAbsolutePath() + "/mytemplate.pdf";
PdfRenderingOptions pdfRenderingOptions = new PdfRenderingOptions();
renderer.render(new PdfDevice(pdfRenderingOptions, filePath), htmdoc);

The approach coming from official docs: Java HTML API - HTML and CSS Markup Parser and Translator

As I wrote this packages are coming from Aspose.PDF but the component is pointed as Aspose.HTML.

The problem is that we are using JDK17 for entire system (and for Aspose.PDF) and I would like to have the same JDK17 HTML library. Unfortunately I don’t see it.

I’ve tried to applied the HTML license with JDK parameter -noverify and JDK 11 HTML but it doesn’t work.

The license code (we have a Total license for Aspose product):

com.aspose.words.License wordLicense = new com.aspose.words.License();
wordLicense.setLicense(AsposeLicense.class.getResourceAsStream(ASPOSE_LICENSE_PATH));
com.aspose.pdf.License pdfLicense = new com.aspose.pdf.License();
pdfLicense.setLicense(AsposeLicense.class.getResourceAsStream(ASPOSE_LICENSE_PATH));
// com.aspose.html.License htmlLicense = new com.aspose.html.License();
// htmlLicense.setLicense(AsposeLicense.class.getResourceAsStream(ASPOSE_LICENSE_PATH));

Aspose version 23.1 (cannot upgrade to the newer).

The PDF looks as expected - the only issue is that HTML license message.

@przemekenoik

The classes like HTMLDocument, HtmlRenderer in above code snippet could not be accessed using Aspose.PDF. They are from Aspose.HTML. Please check your maven dependencies again. Aspose.HTML must have been installed in your project. If not through maven, please check its JAR may be referenced.

Have you tried after uncommenting the above code? Are you facing any error while setting the license for Aspose.HTML? Can you please provide a console application that only has Aspose.PDF dependency and is able to reproduce the same issue that you are facing?

Dear @asad.ali we are using the following packages:

import com.aspose.pdf.internal.html.HTMLDocument;
import com.aspose.pdf.internal.html.rendering.HtmlRenderer;
import com.aspose.pdf.internal.html.rendering.pdf.PdfDevice;
import com.aspose.pdf.internal.html.rendering.pdf.PdfRenderingOptions; 

As I pointed out previously we cannot use HTML package because there is a missing version for JDK17 which we are using (there are versions for Word and PDF which we are using).

As I also mentioned I’ve tried to use HTML from JDK11 (mixed with JDK17 and noverify parmeter) but that doesn’t work so what we need int this case is Aspose.HTML compiled for JDK17 otherwise the license doesn’t work. We don’t use any other manually installed JAR-s - it’s not nineties anymore :slight_smile:

This is what I see regarding available HTML JDK versions:

image.png (34.4 KB)

I think also the Aspose should provide the imports in documentation, just a suggestion.

@asad.ali are you a Aspose team member or I should concat directly with Aspose team and ask about package HTML for JDK17?

Thanks!

@przemekenoik

I am from official Aspose Team. We are sorry if any of our responses looks unprofessional or naive :slight_smile: The reason of asking those question was that these classes (e.g. import com.aspose.pdf.internal.html.HTMLDocument;) are supposed to be protected and should not be accessible through Aspose.PDF API. There is a reason that we moved everything related to these classes to a separate API i.e. Aspose.HTML. Anyways, we will look into it further.

Furthermore, about JDK17 support, you are right regarding Aspose.HTML but still we raised the question because you were accessing these objects from Aspose.PDF and it caused confusion. Nevertheless, we have logged your concerns and complete scenario details in our issue tracking system under the ticket ID HTMLJAVA-1471. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

@przemekenoik

Aspose.HTML classes are not accessible, their internal logic is obfuscated, and through the reason that it is used as dependency for Aspose.PDF, we integrated it into com.aspose.pdf.internal.html package, and due to specifications of HTML library some public interfaces are left as public to make sure that Aspose.PDF functionality stays intact along with HTML working and as designed.

Therefore, We guarantee using classes from Public API. We don’t guarantee anything for internal package.

All public APIs are in manifest and in the project documentation.

Hi @asad.ali I think the right solution would be just release Aspose.HTML for JDK17. I suspected that team who working on PDF had those packages from HTML internally to handle PDF/HTML import/export.

Right now I deal with the problem with the following code:

com.aspose.pdf.internal.html.License htmlLicense = new com.aspose.pdf.internal.html.License();
htmlLicense.setLicense(AsposeLicense.class.getResourceAsStream(ASPOSE_LICENSE_PATH)); 

So “cheating” the system with internal class :wink:

When (if) you release Aspose.HTML JDK17 - do you have any way to upgrade that kind of patched/bug-fixed versions if our subscription for upgrades expired ~ 1 month ago?

Thanks!

PS. Your responses were professional but maybe a little naive but I assume you had to ask that kind of questions :slight_smile:

@przemekenoik

Yes, you are right and the logged ticket is created for the purpose.

We are afraid that you would need to renew your license as if JDK17 compatible version is going to be released, it would be part of the latest available version. We won’t update the older/previous version(s).

I am also looking for Aspose HTML with JDK17 support. Do we have any update/ETA on that?

@rprasadcr

We are afraid that the investigation of the ticket has not been yet completed and we do not have any ETA information at the moment. We will surely inform you once we make some updates in this regard. Please spare us some time. We are sorry for the inconvenience.