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

Free Support Forum - aspose.com

Tried to convert a html file to pdf but failed with "Ambiguous match found"

When I tried to convert the html file, it failed with following message.

class com.aspose.pdf.internal.p575.z1: Ambiguous match found.
com.aspose.pdf.internal.p575.z79.m1(Unknown Source)
com.aspose.pdf.internal.ms.System.z142.m3(Unknown Source)
com.aspose.pdf.internal.ms.System.z142.m2(Unknown Source)
com.aspose.pdf.internal.p189.z3.m1(Unknown Source)
com.aspose.pdf.internal.p196.z24.m1(Unknown Source)
com.aspose.pdf.internal.p196.z22.m1(Unknown Source)
com.aspose.pdf.internal.p191.z16.m1(Unknown Source)
com.aspose.pdf.internal.p196.z25.m1(Unknown Source)
com.aspose.pdf.internal.p191.z13$z1.m1(Unknown Source)
com.aspose.pdf.internal.p191.z13.m1(Unknown Source)
com.aspose.pdf.internal.p218.z11.m1(Unknown Source)
com.aspose.pdf.internal.p218.z11.m1(Unknown Source)
com.aspose.pdf.internal.p218.z11.m1(Unknown Source)
com.aspose.pdf.internal.p178.z22.m1(Unknown Source)
com.aspose.pdf.internal.p178.z22.m1(Unknown Source)
com.aspose.pdf.internal.p359.z1.m1(Unknown Source)
com.aspose.pdf.internal.p359.z1.m1(Unknown Source)
com.aspose.pdf.z35.m1(Unknown Source)
com.aspose.pdf.ADocument.m1(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)

Below is my code
Can you help me what the problem is?
License license = new License();
license.setLicense("Aspose.Pdf.lic");
TourGroup tourGroup = tourGroupService.getGroupTourDetail(param);
String host = req.getServerName();
int port = req.getServerPort();

url = req.getScheme()+"://"+host;
if(port>80){
url += ":"+Integer.toString(port);
}
log.debug("\n\n========================> Url : "+url);


Document doc = Jsoup.connect(url+"/planPreview2/"+groupNo).get();
for( Element element : doc.select("nav") )
{
element.remove();
}

File tempHtmlFile = new File(tempDir+"/"+groupNo+".html");
tempHtmlFile.createNewFile();
FileWriter tempHtmlFileWrite = new FileWriter(tempHtmlFile);
tempHtmlFileWrite.write(doc.toString());
tempHtmlFileWrite.flush();
tempHtmlFileWrite.close();

com.aspose.pdf.HtmlLoadOptions htmloptions = new com.aspose.pdf.HtmlLoadOptions(tempDir);
com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document(tempDir+"/"+groupNo+".html",htmloptions);
pdfDoc.save(tempDir+"/"+tourGroup.getGroupCode()+".pdf");


Hi there,

Thanks for your inquiry. I have tested the HTML to PDF conversion with shared document using Aspose.Pdf for Java 11.2.0 and managed to observe the reported exception. For further investigation, I have logged an issue in our issue tracking system as PDFNEWJAVA-35556 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-35556) have been fixed in Aspose.Pdf for Java 11.4.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.