Div contents exceed page length

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Div contents exceed page length

Post by Fiona »

I have some text and an image inside <div> tags that make it into a note. In the PDF output, I expect the entire note to be on a single page (the CSS is set up this way). However, the location within the PDF is such that there is insufficient room on the page at the start of the note. Rather than moving the entire note to the next page, the PDF starts it on the page it's on and then it "falls off" the bottom of the page. I don't want to hard code page breaks before the note as that's not future-proof. If I don't include the text and image within the <div> tags then the PDF is correctly formatted, with the text and associated image moving to the next page.

Any advice on how tosort this would be greatly appreciated! Thanks.

For cpmpleteness, the contents of the note are:
Text (paragraph styled to keep with next)
Image
Image caption styled to keep with previous
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Div contents exceed page length

Post by robdocsmith »

I'd enclose the complete note inside a DIV classed as "note" or something similar. Then in the DIV.note style set "page-break-inside: avoid;" (also column and frame breaks avoid if that is an issue in your docs). That way the entire note will be carried to the next page if there isn't room. I use this a lot with things like notes, figures with captions, caution constructs, etc.

Rob
Fiona
Sr. Propeller Head
Posts: 117
Joined: Tue Jan 27, 2015 7:44 am
Location: U.K.

Re: Div contents exceed page length

Post by Fiona »

I already have that set. The problem is not that the content of the note is breaking across pages, it's that it's too long to fit on the page from its starting point and instead of moving to the next page it carries on anyway and falls off the bottom.
robdocsmith
Sr. Propeller Head
Posts: 248
Joined: Thu May 24, 2018 3:11 pm
Location: Queensland, Australia

Re: Div contents exceed page length

Post by robdocsmith »

Ah I'm not sure I've understood the issue. If the overall div contents exceed the length of a content frame then all Flare can do is try it's best to fit it, and then break the content despite any avoid-break-inside statements in the CSS.

You could force a page break by having page-break-before: always; on this style (or have a specific version of the style that has a page break before it). I've a generic style .keeptogether that I apply to DIVs that has page-break-inside: avoid; and I have a .newpage generic style that includes a page break before it. So if forced to, and to avoid using inline styles, I might nest a div.keeptogether inside a div.newpage. I try not to do this, though in some instances it is unavoidable. Instead I'd try to reduce the size of the div contents, or move it in the text to where it might flow better in the PDF.
Post Reply