Recent Changes · Search:

Support the Project

Wikipublisher

PmWiki

edit SideBar

 

In some environments, wiki users prefer a simplified “one click” interface for generating a PDF. This recipe provides a “PDF” link which, when clicked, bypasses the “Download” page and returns the PDF directly. It does this by building a link equivalent to that generated by the download form.

Download pdf.php Δ and install it in the pmwiki/cookbook/ directory. Then add the following code to local/config.php, after loading the wikipublisher extensions:


    include_once("$FarmD/cookbook/pdf.php");

The simplest form of the directive is (:pdf:), which produces PDF and generates a PDF of the current page. Other options are:

  • (:pdf-page:) — same as (:pdf:)
  • (:pdf-letter:) — formats the current page as a letter, assuming letter markup has been used
  • (:pdf-book:) — on a trail page, produces a book
  • (:pdf-report:) — on a trail page, produces a report
  • (:pdf-article:) — on a trail page, produces an article

The starred form, e.g., (:pdf*:) produces an additional, unobtrusive link to the PDF options page: PDF ¤.

An administrator can use the $ServeWikibookOptions array to set up named lists of predefined print metadata values. These can then be invoked by adding the name to the pdf directive. For example, (:pdf plain:) sets the following values:

  • cover=none (suppresses header and footer)
  • parasep=space (spaces between paragraphs)
  • floathere=on (turn off floating figures and tables)
  • colophon=off (suppress the end of document colophon)

This example produces: PDF (plain). Click the link to see the result.

Read the source code for examples of how to set up additional named lists. The full markup syntax is:


    (:pdf[-<kind>] [<option>]["<option text>"]:)

The recipe also introduces a new global variable, $SimplifyPDFInterface. If an administrator sets $SimplifyPDFInterface = 1 before loading the one click PDF recipe, the following settings are turned off:

  • PDF icon and options button on every page
  • View XML button on the “Download” page
  • PDF debug button
  • raw LATEX download option

Finally, (:book TrailPageName | link text:) lets an author typeset a book from a page other than the trail page.

“How to Produce a Book” book

Contributor: John Rankin, Friday, 23 July 2010, based on suggestions from Frank.

« Links Between Books | Cookbook | PmWiki Draw »

Creative Commons License
Edit · History · Print · Recent Changes · Search · Links
Page last modified on 15 September 2010 at 05:58 AM