How to exclude some content from PDF export?

Last modified by Vincent Massol on 2022/10/13

It's possible to selectively exclude some content from a PDF export (or any other export) by modifying the content using the Velocity macro.

For example imagine that you have a page with a TOC macro and you'd like that the PDF export doesn't export the TOC since the PDF export already have the option to include a special page for the TOC.

Here's how you could modify your content.

Before:

{{toc/}}

= Heading1 =

Hello world

After change:

{{velocity}}
#if ($xcontext.action != 'export' && $request.format != 'pdf')
  {{toc/}}
#end

= Heading1 =

Hello world
{{/velocity}}

Note: Something similar can be achieved with the LaTeX Export.

Tags:
   

Get Connected