I have a foswiki installation for keeping ISO and other documents. I would like to create a PDF from each page. How can I create a topic template with different headers and footers for each topic template?
More info: When a user creates a new topic, they can choose a template. I've made several templates for Functional and Programming specs. The functional spec and programming spec require different document numbers. I would like for the software engineers to be able to create a new topic, choose the template, then be able to generate a PDF from the wiki page, pulling the appropriate document number, and some other text into the headers and footers. I am not very familiar, and haven't been able to find any examples on doing this. Any help would be appreciated!
This can be a bit difficult to explain without examples. But...
In your Document TemplateTopic, you can insert control information for the PDF generation as well as define Foswiki variables for use in other topics. For example - the template - and root document could contain:
<!-- PDFSTART -->
<!-- HEADER LEFT "%TITLE%" --> <!-- HEADER CENTER "" --> <!-- HEADER RIGHT "%REVINFO{"1.$rev $date"}%" --> <!-- * Set GENPDFADDON_TITLETOPIC = Yourweb.PDFHeaderTopic * Set DCN = 1234 * Set DTITLE = Title of the document * Set DTYPE = Engineering
- ->
Then in your PDFHeaderTopic, you define your standard coverpage. You can reference thinks like the DCN, and DTYPE set in this topic.
<noautolink> <!-- HEADER CENTER "%DTITLE%" --> <!-- FOOTER LEFT "$PAGE(1)" --> <!-- FOOTER CENTER "%REVINFO{"r1.$rev $date " web="%WEB%" topic="%BASETOPIC%"}%" --> <!-- FOOTER RIGHT "%DCN%" --> <!-- AUTHOR "%AUTHOR%" --> </noautolink>
<img ... (document header image)
%DTITLE%
DCN: %DCN%
and so on
If you want more detailed control of boilerplate, etc. you could do custom %INCLUDEs based upon setting of variables. The %INCLUDE could set spreadsheet variables, which can then be incorporated into any of the pages.
For example on header page:
%IF{"defined DCLASS and $ DCLASS = '3'" then="%INCLUDE{"YourConfidentialHeaders"}%
And in that page,
%CALC{$SET(DOC_STMT, COMPANY CONFIDENTIAL: whatever boilerplate)}% %CALC{$SET(DOC_ST, CONFIDENTIAL)}%
Then in any other page you can insert the statement with %CALC{$GET(DOC_STMT)}% and you could insert %CALC{$GET(DOC_FOOT)}% in places like <!-- HEADER CENTER "%CALC{$GET(DOC_ST)}%" -->