CSS-based PDF: Don't need the cover and TOC pages

Post here questions and problems related to editing and publishing DITA content.
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

CSS-based PDF: Don't need the cover and TOC pages

Post by mdslup »

Part of my job is creating procedural documents (between 2-6 pages). These are designed to be printed and used by a technician without access to power or internet.

Oftentimes, the procedure I create is just a single topic file...I don't even need a map.

I notice that the CSS-based PDF transformation scenario applies only to maps. However, forcing something into a map just for the sake of having a map feels wrong. Additionally, the scenario generates a title page and table of contents. I always delete these from my PDF before printing it for a technician. However, doing this causes the pages of my cross-references to be incorrect ("Refer to step 9 on page 3").

Is there a way to SKIP the cover page and TOC?
Costin
Posts: 829
Joined: Mon Dec 05, 2011 6:04 pm

Re: CSS-based PDF: Don't need the cover and TOC pages

Post by Costin »

Hello,

I'll add an improvement request in our internal issue/improvement tracking system so that our developers will analyze the possibility to add a predefined PDF based on CSS transformation also for separate topics, without a DITA Map context.
We will update this thread when / if this functionality will get implemented.

Now for your second problem, regarding the removal of the front page and table of contents from the PDF output.

Which of the two CSS-based transformation scenarios are you using? Is it DITA Map PDF - based on CSS and HTML5 or is it the deprecated DITA Map PDF - based on CSS (WYSIWYG)?

For the first case, you could add some rules in your customization CSS to hide the front page and the TOC from the resulted PDF.
They should look like:

Code: Select all

*[class~="front-page/front-page"] {
display: none;
}

*[class~="toc/toc"]{
display: none !important;
}
If it's the deprecate WYSIWYG scenario (without HTML5) that you're using instead, the CSS rules should look like:

Code: Select all

*[class ~= 'map/map'] > map {
display:none !important;
}
*[class ~= 'map/map'] > front-page{
display:none !important;
}
Even so however, there would still be a blank page before the document content.
If you expressly need to remove also the blank page, this could also be done but it's a bit complicates as you'll have to use an XSLT template of your own either as an extension inside of a publishing template (for the CSS and HTML5 based scenario), or by modifying the out-of-the-box XSL stylesheets from the oXygen installation (for the WYSIWYG scenario based on CSS only). Modifying the files in the oXygen installation is always discouraged and should be performed with caution, only after you create a backup of them.

For more information on how the template should look and how to use it to remove the blank page left at the beginning of the PDF after removing the front page and table of contents, see this forum thread.

We are currently evaluating the possibility to add a (a couple of) transformation scenario parameter(s) to control the TOC/front-page generation in the future, in order to make this even easier. I just added your vote for it.

I hope this helps.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
mdslup
Posts: 167
Joined: Tue Mar 06, 2018 1:34 am

Re: CSS-based PDF: Don't need the cover and TOC pages

Post by mdslup »

Thanks Costin. I couldn't make the XSL solution work, but I suspect it might be that I'm using the jumping off points wrong. I'll keep working on it.

More importantly, I was at least able to fix my links by resetting the "page" target-counter in my CSS file. I still have to remove the blank page manually (ie, in Adobe), but at least the page numbers are correct.
julien_lacour
Posts: 495
Joined: Wed Oct 16, 2019 3:47 pm

Re: CSS-based PDF: Don't need the cover and TOC pages

Post by julien_lacour »

Hello,

The single DITA Topic publishing is available starting with Oxygen 22
Transform Individual DITA Topics to CSS-based PDF Output
A new transformation scenario called DITA PDF - based on HTML5 & CSS can be used to transform a single DITA topic to CSS-based PDF output. It automatically detects the current root map to resolve keys properly and detects the current profiling condition set for proper filtering. Similar to the DITA Map version of this transformation scenario, you can use a publishing template or custom CSS to style the output.
Regards,
Julien
Post Reply