Using Wikibooks/Print versions and PDFs

In a previous chapter we discussed how to print a Wikibook, assuming a "print version" or "PDF" or "collection" has already been set up.

But what do you do when you want to print out a complete Wikibook, but none of them have been set up yet? Be bold and do the setup yourself. Here's how.

Creating a Print Version

edit

Print versions are pages which contain all the pages of the book, as well as any other information that should be added to the print version. Print versions are created by creating a new page for the print version, say book name/print version, and then transcluding every page in the book, in the order in which you want them to appear. So if a book called book had the pages A, B, and C, and you wanted to have the print version contain the pages in that order, then on your table of contents page you would add

{{Print version|book/print version}}

near the top to make it display the print version box on the page. Then you would click on the link to the page and put in

{{:book/A}}
{{:book/B}}
{{:book/C}}

and it should include the pages when you click show preview or save.

See also Help:Print versions

Creating a PDF version

edit

There are a few ways that you can create PDF versions.

Your navigator

edit

From the print Version seen above, click on File, Print (or CTRL + p) and choose to print into a PDF file.

Using wkhtmltopdf

edit

You can save the print version the HTML file and export to PDF, wkhtmltopdf does this directly in one single command.

# basic usage
$ wkhtmltopdf https://en.wikibooks.org/wiki/Using_Wikibooks/Print_version Using_wikibooks.pdf

# with additional setup, eg for margins
$ wkhtmltopdf -B 2.5cm -L 2.5cm -R 2.5cm -T 2.5cm https://en.wikibooks.org/wiki/Using_Wikibooks/Print_version Using_wikibooks.pdf

Using MediaWiki to LaTeX

edit

MediaWiki to LaTeX enables book authors to create high-quality PDFs, see MediaWiki to LaTeX

Using the Collections Extension

edit

Any functionality of the Collection extension to create any downloadable files has been decommissioned. It is not known if or when a replacement might come into place.

Wikibooks now has a special extension for grouping individual pages together into a group called a collection. Once a collection has been created, there are three options available:

  1. Download a PDF version of the collection
  2. Download an ODT (OpenOffice.Org Text Document) file
  3. Publish a copy by PediaPress, and have it mailed to you.

If we replace the word "Collection" with the word "Book" in the sentences above, we can see a very clear way that this extension can be used here at Wikibooks. In addition to creating an ordinary Table of Contents and a print version, a collection can also be created that will enable PDF versions and published versions to be created quickly for your book.

There are two types of collections: Community collections and personal collections. Community Settings are created as subpages of Wikibooks:Collections. Each book should have only one (or a very limited number) of "official" community versions. The community versions can be advertised using the {{collection}} template on the book itself. Sometimes, individual users prefer a slightly different reading order to the material, or like to add additional chapters from a related book, or remove a few chapters, or any number of small modifications. In this case, the user can create their own collection in their user namespace, as a subpage of Special:MyPage/Collections. Private collections can be edited and shared with other users just like a normal wiki page.

Creating a Collection

edit

Creating a collection is easy. There are two ways to do it:

  1. When you find a page you want to add, click "Add wiki page" on the left. This will add the current page to the current collection. Continue for all pages you like. When you are happy with your collection, you can go to Special:Collection to edit, save, download, or print your collection.
  2. You can create a collection on a regular page using regular wiki text. Here's an example:
 
  == Title ==
  === Subtitle ===
  :[[Page1]]
  :[[Page2]]
  ;Chapter 1
  :[[Page3]]
  :[[Page4]]
  ;Chapter 2
  :[[Page5]]
  :[[Page6]]

  [[Category:Collections]]

The [[Category:Collections]] at the bottom is important because it indicates to the software that the page represents an extension. To see a list of all pages in this category (and therefore all extensions) go to Category:Collections.

Here are some things that can be in a collection, and the syntax that's used to save them:

Title and Subtitle
A collection can have both a title and a subtitle. In wikitext, the title can be specified as a level-2 heading, and the subtitle can be specified as a level-3 heading. A collection may only have one of each.
Chapters and Pages
In terms of collections, a "chapter" is a large heading that precedes a group of related pages, and a "Page" is an individual page on the wiki. Chapter names can be specified with a semicolon. Pages in a chapter can be specified as a regular absolute wikilink, with a colon in front like :[[My Book/Page 1]], not a relative link like :[[/Page 1]].
Display Title
If you just use a normal link, the page will be titled "My Book/My Page" in the generated PDF and print-on-demand book. If you use a piped link, the display name of the chapter can be changed. So :[[My Book/My Page|My First Page]] will display "My First Page" as the display name in the generated book or PDF file.

Exporting the Collection

edit

Once a collection is generated, either by loading pages into your collection one at a time or by loading an existing saved collection, it can be used in a number of ways:

Downloading
A collection can be downloaded in PDF by clicking on the "Download as PDF" link on a collection page. It is also possible to download the collection as ODT.
Print on Demand
A collection can be sent to our print-on-demand partner PediaPress and a copy of the book can be mailed to you.

Linking to the PDF

edit

Once a PDF has been created and uploaded, go back to the TOC and add

{{PDF version|filename of PDF}}

which creates the PDF version box on the main page of the book