Free Support Forum - aspose.com

Avoid Text wrapping while converting html to PDF using Aspose Java

Hi,

Would like to get suggestion in converting html to pdf without any text wrapping.
I’m able to achieve that by setting the width manually, I have attached a html file, a default pdf file where I haven’t mentioned any width and a pdf file where I have specified the width as 10k px.

But for different html files, we may require different width. Is there a way to set the width dynamically?

Note:
Aspose Java version: 21.4
OS: Ubuntu 18.04.2 LTS

Sample.zip (39.6 KB)

Thanks,
Sharanya

@SharanyaK

We tried to achieve your requirements by using the below code snippet and Aspose.HTML for Java 21.5 but did not get much success:

com.aspose.html.HTMLDocument htmlDocument = new com.aspose.html.HTMLDocument(dataDir + "sample.html");
// Initialize PdfSaveOptions
com.aspose.html.saving.PdfSaveOptions options = new com.aspose.html.saving.PdfSaveOptions();
options.getPageSetup().setAdjustToWidestPage(true);

Therefore, have logged an issue as HTMLJAVA-807 in our issue tracking system. We will further look into details of your requirements and let you know once the ticket is fixed. Please be patient and spare us some time.

We are sorry for the inconvenience.