This question about Using an extension: Answered

Does PublishPlugin support hierarchical topics in PDF generation?


it looks like PublishPlugin only generates pdf files in alphabetical order. it would be really useful to support topic metainformation for a hierarchical page order, based on the mother/child relationship. or is this possible?

another question: is it possible to generate an index, like the --book funktion in htmldoc?

-- MaZe - 25 Feb 2010

I don't know about PublishPlugin, but GenPDFAddOn supports recursive generation of hierarchical topics as well as TOC generation.

-- MartinKaufmann - 26 Feb 2010

No. PDF generation in PublishPlugin was really added as an afterthought - it's primary purpose is the generation of static HTML. You do have some limited control over meta-information int he publish topic, and you can structure your web to "look" like a book and have a book-like index, but if GenPDFAddOn does a better job, then I'd use that.

-- CrawfordCurrie - 03 Mar 2010

The latest version of GenPDFAddOn Released for testing as Sandbox/Beta.GenPDFAddOn, has an improved hierarchical topic generation that will provide an indented TOC as well.

-- GeorgeClark - 05 Mar 2010

thanks for your help! so i wonder if i can run both plugins installed, or do i have to disable or even uninstall PublishPlugin to run GenPDFAddOn?

-- MaZe - 11 Mar 2010

You can have them both installed in parallel. As they only run on demand, they don't interfere with each other. I also have both of them installed but I only use PublishPlugin to generate HTML files.

-- MartinKaufmann - 11 Mar 2010

GenPDFAddOn seems to work great. but now i try for an hour to create a pdf link in the toolbar, so every page can be generated. it only returns the WebLeftBar as PDF, not the actual page...

How did you create the link in the toolbar? Did you use the %GENPDF% macro or one of the other examples in the System/GenPDFAddOn topic? Because the WebLeftBar is an include, topic references need to specifiy %BASETOPIC% instead of %TOPIC% For example:
%GENPDF{"%BASETOPIC%" link="Generate PDF"}%

-- GeorgeClark - 20 Mar 2010

i did use the examples and, as you said, they didnt work because the webleftbar is an include, and i only get the contents of webleftbar published. i tried
%GENPDF{"%BASETOPIC%" link="Generate PDF"}%

but now it generates empty pdf files, only filled with header and footer.

when i use the example

<a href="/bin/genpdf/Support/Question444?pdftitle=Question444">PDF</a

inside a topic, it works fine.

-- MaZe - 20 Mar 2010

TBH, I have no idea why it's generating empty pdf files - could you post what is generated as the actual URL when the GENPDF expands in the WebLeftBar? I've tried it on my system and it seems to work fine. If you put the link that you pasted above in the WebLeftBar - substituting BASEWEB and BASETOPIC, does that work?

-- GeorgeClark - 20 Mar 2010

many thanks for your help, this seems to work. i will fiddle around with this solution.

now there is an include, which i don't need in the pdf. is there a simple way to exclude it? <!-- PDFSTART --><!-- PDFSTOP -->won't help, because then i have to edit every topic around the include.

it would be great to have something like:


-- MaZe - 20 Mar 2010

the fine manual says yes:

-- WillNorris - 20 Mar 2010

sorry, maybe this topic is misleading: my question was focused on GenPDFAddOn. or does it work with it, either? will try..

-- MaZe - 20 Mar 2010

GenPDFAddOn's fine manual also says yes:

-- WillNorris - 20 Mar 2010

which i have read, see my post wink

the problem is: it shows only a way to include parts to get others excluded. it would be more helpful to mark parts to exclude, like:


Unfortunately that would be a pretty significant change to the PDF rendering code. And the next question will be what happens if someone uses a mixture of the "inclusion" code and the "exclusion" code. If you want the %include section always excluded, instead of editing all the including topics, you could edit the include itself. If you started it with the the PDFSTOP and ended with the PDFSTART - it would preserve the start/stop ordering and exclude the include wherever it is used. I think you would still need at least a PDFSTART and PDFSTOP in the including topic.

-- GeorgeClark - 21 Mar 2010

thanks for the information, i expected that. i tried the stop/start version already. my idea is to put a stop in the start of the include, which is always the page end. now if i put a start in the view template, it would result in a valid start/stop szenario. but which template would be the right one to put the start in?

-- MaZe -

There are two standard template definitions that render at the start and stop of the page content - contentheader and contentfooter. Foswiki by default doesn't provide any content in these locations, so they only expand the deprecated beforetext and aftertext templates for packwards compatibility:


So you could create your own custom view template - for example, view.mypdf.tmpl
<!-- PDFSTART -->;

See for details on using these templates.

-- GeorgeClark - 21 Mar 2010

to bad, doesnt work. the start and stop comments are viewable in source code, but the start tag dont trigger. then i edited the view template more, to be shure, the start comment is exactly at the same position as when pasted in the topic editor. in the end they were side by side. but only the pasted version works. if i delete the second one in topic editor, the one in the template dont fire...
<div class="foswikiTopic"><!-- PDFSTART --><!-- PDFSTART -->

Try adding the skin= or cover= urlparam to pick up your custom skin in GenPDFAddOn. If this works, then you can make it permanent by setting GENPDFADDON_SKIN=myskin,pattern - or COVER - whichever works for you - in your SitePreferences.

-- GeorgeClark - 22 Mar 2010

i have an url like this:

but the include in the pdf is still there. the start and stop comments are physically there. it works, when i add another start comment in the topic editor.

ccskin is the custom skin of our wiki. i added the "contentheader" stuff there. GenPDF works so nice, and i'm so close, but the include is a big problem, because it adds a subcategory to every single topic.

i don't understand the cover suggestion.

-- MaZe - 29 Mar 2010

I'm not sure what is going on with this - I suspect it will take some considerable effort of tracing calls internal to the GenPDF rendering. It appears to apply the skin prior to removing the PDF sections. So I believe it should work, but I'm probably missing something in the code. Unfortunately I don't think that the plugin was ever written to intend that the rendering templates could provide the STOP/START sections. They were intended to be put into the topic content. Unfortunately I don't have the time right now to tackle this one.

(BTW - it would be helpful in a threaded discussion like this, if you paste your signature after each addition - it makes it much easier to follow the thread. - thanks)

-- GeorgeClark - 22 Mar 2010

thank you very much for our time. i will try out your suggestions. i hope you will find some time to evaluate this further, because my skills are limited wink

-- MaZe - 29 Mar 2010

QuestionForm edit

Subject Using an extension
Extension GenPDFAddOn, PublishPlugin
Status Answered
Topic revision: r23 - 29 Mar 2010, MaZe - This page was cached on 18 Oct 2018 - 02:46.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy