Forcing and preventing page breaks in PDF
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 26
- Joined: Mon Feb 18, 2013 5:44 pm
Forcing and preventing page breaks in PDF
We print our DITA topics to PDF and I noticed that sometimes note sections get splitted leaving the note icon alone at the bottom of a page with the note text on the next page. How can I prevent this?
Also is it possible to prevent an (un)ordered list from splitting if it has 5 items or less? In other words, can I set such a condition for page breaks?
Also is it possible to prevent an (un)ordered list from splitting if it has 5 items or less? In other words, can I set such a condition for page breaks?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Forcing and preventing page breaks in PDF
Post by sorin_ristache »
Hello,
You will need to customize the DITA-OT plugin that creates the PDF output when a DITA Map PDF transformation is executed. This plugin is located in directory [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2. For the second request (avoid splitting a list on different output pages) you will need to set an XSL-FO property like keep-together.within-page="always" in the intermediary XSL-FO file, on the fo:block element corresponding to the list. You can find some examples of setting XSL-FO attributes in the file [Oxygen-14.2-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\cfg\fo\attrs\lists-attr.xsl. In your customization (which will be an XSLT stylesheet actually) it is enough (I think) to add the following inside the FO attribute sets for the ul and ol lists:
I suppose the first request (keeping the note icon and the note text on the same page) can be implemented in the same way, you will just have to identify where (in the XSLT stylesheets of the PDF plugin) the XSL-FO code of the note is generated. You may find the DITA transformation debugging suggestions from the Oxygen User Manual helpful in identifying that place.
You can find details about customizing the PDF plugin of DITA-OT in the file README.txt located in the directory of the plugin ([Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2).
Regards,
Sorin
You will need to customize the DITA-OT plugin that creates the PDF output when a DITA Map PDF transformation is executed. This plugin is located in directory [Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2. For the second request (avoid splitting a list on different output pages) you will need to set an XSL-FO property like keep-together.within-page="always" in the intermediary XSL-FO file, on the fo:block element corresponding to the list. You can find some examples of setting XSL-FO attributes in the file [Oxygen-14.2-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2\cfg\fo\attrs\lists-attr.xsl. In your customization (which will be an XSLT stylesheet actually) it is enough (I think) to add the following inside the FO attribute sets for the ul and ol lists:
Code: Select all
<xsl:attribute name="keep-together.within-page">always</xsl:attribute>
You can find details about customizing the PDF plugin of DITA-OT in the file README.txt located in the directory of the plugin ([Oxygen-install-dir]\frameworks\dita\DITA-OT\plugins\org.dita.pdf2).
Regards,
Sorin
-
- Posts: 26
- Joined: Mon Feb 18, 2013 5:44 pm
Re: Forcing and preventing page breaks in PDF
Thank you, Sorin!
As for the notes, I added the line that you provided under in common-attr.xsl and that helped.
As for the lists, the solution you suggested means that all lists will be kept together, whereas we want to keep only 5-item (or less) lists together. So is it possible to add this condition: keep a list together if it has X or less items?
As for the notes, I added the line that you provided under
Code: Select all
<xsl:attribute-set name="note" use-attribute-sets="common.block">
As for the lists, the solution you suggested means that all lists will be kept together, whereas we want to keep only 5-item (or less) lists together. So is it possible to add this condition: keep a list together if it has X or less items?
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: Forcing and preventing page breaks in PDF
Post by sorin_ristache »
Hi,
If you want to have the attribute only on some lists you will have to customize also other XSLT files from the PDF plugin. I don't know exactly what files, maybe the debug suggestions in the User Manual will help you find the code that creates the list and customizing that.
Regards,
Sorin
If you want to have the attribute only on some lists you will have to customize also other XSLT files from the PDF plugin. I don't know exactly what files, maybe the debug suggestions in the User Manual will help you find the code that creates the list and customizing that.
Regards,
Sorin
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service