Copy link to clipboard
Copied
Hi Developer Community,
I am currently using Adobe PDF Tools API in order to create PDFs from HTML and CSS.
I come across a problem with the page break and table of content.
In the attachment given below, you can see the image is starting from one page and extended to the next page. Since the HTML is created dynamically and will be processed in the background service, thus we cannot see generated HTML and CSS. Is there any provided mechanism/function in PDF Tool API that allows you to break/continue a particular HTML section?
Secondly, The issue we faced is the creation of a Table of Content. Does Adobe PDF Tool API create a Table of Content? Like List of Page Title and Page Number associated to it?
Copy link to clipboard
Copied
You can control page breaking using CSS Paged Media properties. I've put a few examples below.
page-break-before: auto;
page-break-before: always;
page-break-before: avoid;
page-break-before: left;
page-break-before: right;
page-break-before: recto;
page-break-before: verso;
As for the TOC, we don't have support for that yet.
Copy link to clipboard
Copied
Thanks for the reply, but in our real-world case, HTML will be generated dynamically as a background service, compressed as a ZIP, and will be passed to Adobe PDF API. Thus we cannot see generated HTML and cannot determine whether the Image is contained within 1 page or more.
Copy link to clipboard
Copied
Understood. That's why there are flexible rules to the CSS. My recommendation is to style the images or their containers set to...
page-break-inside: avoid;
This should keep all images on one page.