Page 1 of 1

PDF from ditamap, force pagebreak between topics

Posted: Wed Jun 27, 2018 1:25 am
by mdslup
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?

Re: PDF from ditamap, force pagebreak between topics

Posted: Wed Jun 27, 2018 10:17 am
by Costin
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

Re: PDF from ditamap, force pagebreak between topics

Posted: Thu Jun 28, 2018 11:56 pm
by mdslup
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?

Re: PDF from ditamap, force pagebreak between topics

Posted: Fri Jun 29, 2018 11:25 am
by Dan
The page break processing instructions should be placed inside the topic files, not in the map between topic references.
Many regards,
Dan

Re: PDF from ditamap, force pagebreak between topics

Posted: Fri Jun 29, 2018 11:41 am
by Radu
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

Re: PDF from ditamap, force pagebreak between topics

Posted: Mon Jul 02, 2018 8:58 pm
by mdslup
Dan, I was able to solve this based on your advice. Thanks.

Re: PDF from ditamap, force pagebreak between topics

Posted: Sun Nov 25, 2018 2:28 am
by Quick van Rijt
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>