PDF from ditamap, force pagebreak between topics

mdslup
Posts: 117
Joined: Tue Mar 06, 2018 1:34 am

PDF from ditamap, force pagebreak between topics

Post by mdslup » Wed Jun 27, 2018 1:25 am

I have a ditamap made up of 8 or so topic files. When I generate a PDF, I'd really like each topic to start a brand new page.

What's the best way to do this?

Costin
Posts: 595
Joined: Mon Dec 05, 2011 6:04 pm

Re: PDF from ditamap, force pagebreak between topics

Post by Costin » Wed Jun 27, 2018 10:17 am

Hi mdslup,

Are you using the predefined general PDF transformation scenario (DITA Map PDF - based on XSL-FO), or one of the predefined CSS-based scenarios?
However, breaking the page before new topics is possible in both cases.

Depending on the specific transformation scenario, you should follow the instructions:
from the User-Guide (for the CSS based)
https://www.oxygenxml.com/doc/versions/ ... aking.html
from Radu's blog post (for the XSL-FO based - DITA Map PDF scenario)
http://blog.oxygenxml.com/2015/04/dita- ... reaks.html

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

mdslup
Posts: 117
Joined: Tue Mar 06, 2018 1:34 am

Re: PDF from ditamap, force pagebreak between topics

Post by mdslup » Thu Jun 28, 2018 11:56 pm

I maintain a custom PDF transformation scenario that is based on the Oxygen out-of-the-box scenario. My custom transformation points to my custom XSL files using the customization.dir parameter. I have successfully implemented many changes to my PDF output using this workflow, such as page rotation, column count, headers, footers, etc. In fact, I produce documents of different column counts nearly every week, so I know these files are properly hooked up.

What you described seemed simple, but I could not get it to work. Can you help me identify my issue, if you have time?

In my ditamap file, I added the processing instruction:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<title>My Map Title</title>
<topicref
href="Cover.dita"/>
<?pagebreak?>
<topicref
href="Installation.dita"/>
...
</map>

I verified that, in author mode, that was in fact a page break processing-instruction. I added the following code to my customization file (customization-directory\fo\xsl\custom.xsl):

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


I ran my transformation and the page break did not apply.

I tried moving the pagebreak into the first topic file itself, both like this:

<reference>
...
<?pagebreak?>
</reference>

and like this:

<reference>
...
</reference>
<?pagebreak?>

But the page break didn't apply. Any thoughts?

Dan
Posts: 403
Joined: Mon Feb 03, 2003 10:56 am

Re: PDF from ditamap, force pagebreak between topics

Post by Dan » Fri Jun 29, 2018 11:25 am

The page break processing instructions should be placed inside the topic files, not in the map between topic references.
Many regards,
Dan

Radu
Posts: 6403
Joined: Fri Jul 09, 2004 5:18 pm

Re: PDF from ditamap, force pagebreak between topics

Post by Radu » Fri Jun 29, 2018 11:41 am

Hi,

If you want to break the page before a topic for the XSL-FO-based PDF output maybe this thread will help:

topic13829.html

You need to override the attributes set for each topic and somehow decide to add a "break-before='page'" attribute on it.
There is a also a book called "DITA For Print" which has lots of PDF customization examples.
And you can also ask around on the Yahoo Groups DITA Users List.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

mdslup
Posts: 117
Joined: Tue Mar 06, 2018 1:34 am

Re: PDF from ditamap, force pagebreak between topics

Post by mdslup » Mon Jul 02, 2018 8:58 pm

Dan, I was able to solve this based on your advice. Thanks.

Quick van Rijt
Posts: 9
Joined: Tue Aug 23, 2016 6:18 pm

Re: PDF from ditamap, force pagebreak between topics

Post by Quick van Rijt » Sun Nov 25, 2018 2:28 am

In DITA 3.x, refer to the use of the following plugin:

https://github.com/dita-community/org.d ... page-break

This plugin enables you to force a new page in a topic body.

Code: Select all

<body>
<p>--- before pagebreak ---</p>
<?pagebreak?>
<p>--- after pagebreak ---</p>
</body>
To implement one (or more) new page insertions before a topic, append to file pageBreak.xsl:

Code: Select all


  <xsl:template match="*" mode="processTopic">
<xsl:for-each select="prolog/process-instruction('pagebreak')">
<fo:block break-before="page"/>
</xsl:for-each>
<xsl:next-match/> <!-- hand-over processing to lower priority (current) matching template -->
</xsl:template>
You can start the concept topic on a new page by inserting:

Code: Select all


  <prolog>
<?pagebreak?>
</prolog>
<conbody>

</conbody>
Regards
Quick van Rijt
Professional user of Oxygen XML and DITA OT

Post Reply