Page 1 of 1

How to create a page break in the text

Posted: Fri Apr 17, 2015 11:25 am
by ludmila
In the text of one of the topics I need to insert a page break. How can i do this?

Re: How to create a page break in the text

Posted: Fri Apr 17, 2015 11:48 am
by Radu
Hi,

You would need an xslt customization for this.
In the DITA content between the DITA elements where you want a page break you could add a processing instruction like:

Code: Select all

<?pagebreak?>
and then in an XSLT stylesheet used for PDF processing, for example:

DITA-OT\plugins\com.oxygenxml.highlight\pdfHighlight.xsl

you can add an additional XSLT Template like:

Code: Select all

  <xsl:template match="processing-instruction('pagebreak')">
<fo:block break-after="page"/>
</xsl:template>
Regards,
Radu

Re: How to create a page break in the text

Posted: Tue Oct 25, 2016 3:44 pm
by ann.jensen
Hi,
Does it matter in which file this code is placed?
I am working with the structure as described in http://www.dita-ot.org/dev/dev_ref/pdf- ... ample.html.
Thanks in advance,
Ann

Re: How to create a page break in the text

Posted: Wed Oct 26, 2016 1:38 pm
by radu_pisoi
Hi,

You can add the above XSLT customization stylesheet in the cfg/fo/xsl/custom.xsl file. See the step 6 from the procedure you refer, http://www.dita-ot.org/dev/dev_ref/pdf- ... ample.html.

Re: How to create a page break in the text

Posted: Tue Apr 23, 2019 10:23 pm
by abaris
Same issue as OP. Docs created in Oxygen, then in xdocs, sent to PDF. Horrible widows and orphans. Attempting to place "page-break-after" in various properties didn't work. This is the last resort. IT is attempting to insert the few lines of code as shown above.
The link, http://www.dita-ot.org/dev/dev_ref/pdf- ... ample.html, is broken.

Re: How to create a page break in the text

Posted: Thu Apr 25, 2019 8:38 am
by Radu
Hi,

The PDF customization section in the DITA OT docs is here:

https://www.dita-ot.org/dev/topics/pdf- ... ation.html

Honestly we kind of stopped giving advice on using XSL-FO to generate PDF from DITA.
In recent Oxygen versions we added a new way to obtain PDF from DITA using CSS:

https://www.oxygenxml.com/doc/versions/ ... 5-x-2.html

and with CSS it's way easier and more intuitive to add or avoid page breaks between elements:

https://www.oxygenxml.com/doc/versions/ ... e_breaking

Regards,
Radu

Re: How to create a page break in the text

Posted: Thu Apr 25, 2019 2:38 pm
by abaris
Thanks Radu...this is all new to me. We use xDocs 3.3A with XML Author 13.2. My expertise is producing similar docs in MS Word with no discernible difference in the final PDF, except Word is cleaner. I can insert page breaks as needed without issues.
Given these tools now, page breaks occur in the middle of everything, and no one has ever done anything about it. We are supposed to migrate to XMLMind XML Editor soon, so once I get training, I hope future docs will eliminate the widows and orphans issue.

Re: How to create a page break in the text

Posted: Tue Apr 30, 2019 8:09 am
by Radu
Hi,

MS Word has a what you see is what you get approach do editing and publishing. While when using any kind of XML content, the edited content is uncoupled from the publishing. This makes it possible to publish to multiple formats (like HTML) where the concept of page break does not exist. Also when publishing XML to PDF you would usually define general situations in which you do not want page breaks to occur (for example you may not want page breaks between titles and content or you may not want a page break to appear in the middle of a table or of a list). But indeed you lose the 100% control you had when producing PDF from Word. At the same time with DITA XML you have the possibilities to reuse content and publish documentation for similar products from the same XML content, lowering translation costs and increasing consistency.
Anyway, I'm sorry that you are moving away from Oxygen but all the best in your future endeavors.

Regards,
Radu

Re: How to create a page break in the text

Posted: Sun Aug 04, 2019 12:11 pm
by Anne
Hi,

I need to insert page breaks before/after certain topics in a PDF output.
I followed the advice in https://www.oxygenxml.com/doc/versions/ ... e_breaking under How to Force a Page Break Before or After a Topic or Another Element, and tried to insert the outputclass="page-break-before" attribute both in a ditamap and in a topic itself, but neither worked. Used the standard PDF transform.

Is anything else required to make this happen?

Thanks,
Anne

Re: How to create a page break in the text

Posted: Mon Aug 05, 2019 9:58 am
by Costin
Hello,

I have just tested this, by setting an outputclass attribute on the topicref corresponding to the "iris" topic in the flowers.ditamap (Growing Flowers) DITA Map from the oXygen sample project.
More specific, its topic reference in the DITA Map now looks like:
[pre]<topicref href="topics/flowers/iris.dita" outputclass="page-break-after"/>[/pre]
I then published the flowers.ditamap to PDF, using the DITA Map PDF - based on HTML5 and CSS predefined transformation scenario, without any modification.
In the PDF output, a page break was successfully inserted between Iris and Snowdrop topics.

Note that this custom attribute works only with the DITA Map PDF - based on HTML5 and CSS scenario, not also with the one based on XSL-FO.

Therefore, you should make sure that:
- you set the outputclass="page-break-after" attribute on the topicref from the DITA Map, corresponding to the topic that you need to force a page break after
- you are using the DITA Map PDF - based on HTML5 and CSS predefined transformation scenario (without modifying any of its parameters).
- you are not using a customization CSS, as there might be some rules in your customization CSS that override the forced page breaks.

If you still not manage to make that work, even after following my suggestions, you could send us (support@oxygenxml.com) a sample DITA Map hierarchy, in an as minimal form as possible, that reproduces this behavior and we could try take a look at it.

Regards,
Costin

Re: How to create a page break in the text

Posted: Tue Aug 06, 2019 3:11 am
by chrispitude
In our DITA flow, I used my RelaxNG DITA grammar creator (https://github.com/chrispy-snps/DITA-plugin-utilities) to create a specialized pagination attribute constrained to a set of values:

Code: Select all

 <attributedomain filename="paginateAttMod.rng" domain="paginate">
  <specialize attribute="paginate" from="base" model="(keep-with-next|keep-with-previous|top-of-page)*"/>
 </attributedomain>
Oxygen XML Author is clever enough to present only the allowed attribute values to our writers:
paginate.gif
paginate.gif (106.88 KiB) Viewed 2395 times
In Oxygen PDF Chemistry, our CSS file applies the actual pagination controls as follows:

Code: Select all

html:root *[paginate~="keep-with-next"] { page-break-after: avoid; }
html:root *[paginate~="keep-with-previous"] { page-break-before: avoid; }
html:root *[paginate~="top-of-page"] { page-break-before: always; }
We have similar specialized attributes for cross-reference format and table/example/inline style controls:

Code: Select all

 <attributedomain filename="xformatAttMod.rng" domain="xformat">
  <specialize attribute="xformat" from="base" model="(\(equation\)|appendix|chapter|command|endnote|equation|example|figure|footnote|heading|page|partdiv|section|step|table|topic|unknown|_uselabel|_onpage)*"/>
 </attributedomain>

 <attributedomain filename="styleAttMod.rng" domain="style">
  <specialize attribute="style" from="props" model="(bold|italic|wide|smallfonts|tight)*"/>
 </attributedomain>

Re: How to create a page break in the text

Posted: Tue Aug 06, 2019 12:24 pm
by Anne
Hi Costin,

I'm reposting this question.

Thanks for your response. In fact, I am using a customized transform to produce this output, and can't use the DITA Map PDF - based on HTML5 and CSS instead. It would be great if you could tell me what exactly should be changed in my customized CSS to enable page breaks.

Best,
Anne
Costin wrote:
Mon Aug 05, 2019 9:58 am
Hello,

I have just tested this, by setting an outputclass attribute on the topicref corresponding to the "iris" topic in the flowers.ditamap (Growing Flowers) DITA Map from the oXygen sample project.
More specific, its topic reference in the DITA Map now looks like:
[pre]<topicref href="topics/flowers/iris.dita" outputclass="page-break-after"/>[/pre]
I then published the flowers.ditamap to PDF, using the DITA Map PDF - based on HTML5 and CSS predefined transformation scenario, without any modification.
In the PDF output, a page break was successfully inserted between Iris and Snowdrop topics.

Note that this custom attribute works only with the DITA Map PDF - based on HTML5 and CSS scenario, not also with the one based on XSL-FO.

Therefore, you should make sure that:
- you set the outputclass="page-break-after" attribute on the topicref from the DITA Map, corresponding to the topic that you need to force a page break after
- you are using the DITA Map PDF - based on HTML5 and CSS predefined transformation scenario (without modifying any of its parameters).
- you are not using a customization CSS, as there might be some rules in your customization CSS that override the forced page breaks.

If you still not manage to make that work, even after following my suggestions, you could send us (support@oxygenxml.com) a sample DITA Map hierarchy, in an as minimal form as possible, that reproduces this behavior and we could try take a look at it.

Regards,
Costin