How to avoid PDF page break when inserting images into ol/ul lists?

Post here questions and problems related to editing and publishing DITA content.
youny
Posts: 7
Joined: Thu Jul 25, 2024 10:54 am

How to avoid PDF page break when inserting images into ol/ul lists?

Post by youny »

When I add images, notes or other elements in the unordered or ordered list, and apply to DITA Map PDF-based on HTML5&CSS, the PDF will break the page even there is much space like this:
Image
However, when I add a outputclass parameter to avoid this ordered list to break the page like this:
<ol id="ol_icl_5bh_fdc" outputclass="page-break-avoid">

The PDF output result will show some contents hidden.
Image
Even I added page-break-avoid parameter to image element in my css file, this still does not solve the problem.
There are much cases like this, may I know if any parameter can reduce the space when output as PDF?
julien_lacour
Posts: 596
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to avoid PDF page break when inserting images into ol/ul lists?

Post by julien_lacour »

Hello,

Using <oXygen/> XML Editor 26.1, build 2024091606 and the following sample:

Code: Select all

<topic id="topic">
    <title>Topic</title>
    <body>
        <ol id="ol_icl_5bh_fdc" outputclass="page-break-avoid">
            <li>Turn on the device.<image placement="break" href="images/start.png" id="image_wth_2xm_jdc"/></li>
        </ol>
    </body>
</topic>
I did get the correct output:
image.png
image.png (16.51 KiB) Viewed 312 times
Could you indicate which version of Oxygen you are using?
Have you tried to run the default DITA Map PDF - based on HTML5 & CSS scenario? Did the problem occur?

Regards,
Julien
youny
Posts: 7
Joined: Thu Jul 25, 2024 10:54 am

Re: How to avoid PDF page break when inserting images into ol/ul lists?

Post by youny »

julien_lacour wrote: Thu Nov 14, 2024 12:05 pm Hello,

Using <oXygen/> XML Editor 26.1, build 2024091606 and the following sample:

Code: Select all

<topic id="topic">
    <title>Topic</title>
    <body>
        <ol id="ol_icl_5bh_fdc" outputclass="page-break-avoid">
            <li>Turn on the device.<image placement="break" href="images/start.png" id="image_wth_2xm_jdc"/></li>
        </ol>
    </body>
</topic>
I did get the correct output:
image.png
Could you indicate which version of Oxygen you are using?
Have you tried to run the default DITA Map PDF - based on HTML5 & CSS scenario? Did the problem occur?

Regards,
Julien
Sorry for my not clarify my problem. Yes after adding the page-break-avoid statement, the picture will not break but it cause the new problem that the pictures will not display normally when the size is over the page. It looks like there is not any limit or configuration to recognize the page edge to generate the page break intelligently.
Image
julien_lacour
Posts: 596
Joined: Wed Oct 16, 2019 3:47 pm

Re: How to avoid PDF page break when inserting images into ol/ul lists?

Post by julien_lacour »

Hello,

This is normal as you have added the outputclass="page-break-avoid" on the list, as explained in our user-guide:
page-break-avoid
Use this to avoid page breaks inside the marked element.
If you remove this outputclass, the image will be displayed on the following page.

Regards,
Julien
Post Reply