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

Free Support Forum - aspose.com

Convert HTML to PDF on linux

Dears,

We have the Aspose License that we are using for a long time. (Company Name: Everteam)
We are having issues converting an HTML file to PDF on linux using the following code:

	//Convert HTML file to PDF
	AsposeLicence.loadPdfLicense();
	
	  
	  File htmlFile = new File(htmlPath);
	  HtmlLoadOptions htmloptions = new HtmlLoadOptions(basePath);
	  System.out.println(" ---- converted file path ---- "+htmlFile.getAbsolutePath());
	  
	  com.aspose.pdf.Document doc = new com.aspose.pdf.Document(basePath + "a667f466-09ad-476f-aa13-ff96232bdee1.html",htmloptions);
	  
	  //create an empty PDF File
	  File resultingPDFFile  = new File(TmpFile.getTempDirPath()+File.separator+UUID.randomUUID().toString()+".pdf");
	  if(!resultingPDFFile.exists()){
		  resultingPDFFile.createNewFile();
	  }
	  
	  doc.save(resultingPDFFile.getAbsolutePath());
	  System.out.println(" ----- Saved Successfully : "+resultingPDFFile.getAbsolutePath()+" ---------------");

Note that the same piece of code works fine on windows.
Attached you can find the log file.

AsposeLogError.zip (740 Bytes)
Please advise,

Regards,

Dears,

sorry for the inconvenience we managed to solve the problem by setting the JVM argument: - Djava.awt.headless =true and using the latest Aspose Library.

Many Thanks,

@Emilee

Thank you for your kind feedback.

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