Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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)}%" -->

share|improve this answer
    
Well that didn't format correctly. If you ask a support question on foswiki.org, I'll try to make some example topics for you in Sandbox. Unfortunately they won't be functional as genpdf is not enabled there. –  George Clark Mar 30 '10 at 2:25
    
I think I understand, and thanks a bunch for your help! I am going to give this a shot later this week. –  Mica Mar 30 '10 at 17:18
    
This helped out a ton, thanks again! exactly what I wanted. –  Mica Apr 5 '10 at 20:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.