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

Free Support Forum - aspose.com

Create PDF from HTML without page breaks using Aspose.PDF for .NET - HTML to Single Page PDF

We are using Aspose.Words to create PDFs from Word documents. Is it possible to convert a multipage Word document to a PDF which is one long page?

@richarddale

Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. MS Word does not allow the page height greater than 1584pt. The page measurement must be between 7.2pt and 1584pt.

If your document has not huge content, you can decrease the font size of text to fit them on one page. To decrease the font size of text, please use Run.Font.Size property. Hope this helps you.

Hi Tahir,

Thanks for getting back to me. Is it possible to create a PDF with one long page from a HTML string using Aspose.PDF?

Regards

Richard

@richarddale

Please note that Aspose.PDF mimics the behavior of Adobe Acrobat. Would you please share a sample PDF file created with Adobe Acrobat, as expected output, so that we may investigate further to help you out.

We haven’t already tried to do this with Adobe Acrobat. We have HTML content that we are coverting to PDF using Aspose and it would be a lot easier to read if there were no page breaks. The HTML contains images which results in page breaks that make reading awkward. Getting the PDF to look like the HTML does in a browser would make it easier to read.

@richarddale

We are afraid generating a PDF document with single continuous page may not be possible. However, you may specify page dimensions while converting HTML to PDF but this will insert a new page once the content overflows and there is need of another page. Therefore, creating a PDF document having single page but accommodating variable contents dynamically may not be possible.

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

@richarddale

We would like to share with you that you can try rendering HTML on a Single Page of PDF by using IsRenderToSinglePage property of HtmlLoadOptions Class.

Render HTML contents on single page PDF

string outFile = "out.pdf";
HtmlLoadOptions options = new HtmlLoadOptions();
options.IsRenderToSinglePage = true;
Document doc = new Document("HTML/input.htm", options);
doc.Save(outFile);