Skip to content

PDF

The options of PDF documents, under formats.pdf.

formats.pdf

The options of PDF documents (formats.pdf).

enabled = c.Type(bool, default=True)

Are PDF documents generated (e.g. !ENV [MKDOCS_EXPORTER_PDF, true])?

serve = c.Type(bool, default=False)

Should documents be generated while serving the website (mkdocs serve)?

explicit = c.Type(bool, default=False)

Should pages specify explicitly that they should be rendered as PDF?

title = c.Type(bool, default=False)

Should the page's title be inserted at the top of documents lacking a h1?

concurrency = c.Optional(PositiveInteger())

The number of documents rendered at once (twice the number of CPUs, up to 8, by default).

stylesheets = c.ListOfItems(Stylesheet(exists=True), default=[])

Stylesheets applied to documents only (plain CSS), relative to the configuration file.

scripts = c.ListOfItems(c.File(exists=True), default=[])

Scripts run in documents only, relative to the configuration file.

covers = c.SubConfig(CoversConfig)

The cover pages of documents.

header = c.SubConfig(MarginsConfig)

The header of pages ({site_name}, {page_title}, {section}, {page}, {pages}).

footer = c.SubConfig(MarginsConfig)

The footer of pages (same placeholders as the header).

browser = c.SubConfig(BrowserConfig)

The browser's configuration.

cache = c.SubConfig(CacheConfig)

The cache of documents.

url = c.Optional(c.Type(str))

The URL replacing the website's root in links (defaults to site_url).

toc = c.SubConfig(TocConfig)

The table of contents of each document (its headings).

books = c.ListOfItems(c.SubConfig(BookConfig), default=[])

Books: pages combined into single documents.

aggregator = c.SubConfig(AggregatorConfig)

A single book (deprecated: use books).

formats.pdf.covers

The cover pages of documents (formats.pdf.covers).

front = c.Optional(c.File(exists=True))

The template of front covers (relative to the configuration file).

back = c.Optional(c.File(exists=True))

The template of back covers (relative to the configuration file).

formats.pdf.header, formats.pdf.footer

A header or a footer (formats.pdf.header, formats.pdf.footer): texts with placeholders such as {page} and {pages}.

left = c.Optional(MarginText())

The text on the left.

center = c.Optional(MarginText())

The text in the center.

right = c.Optional(MarginText())

The text on the right.

formats.pdf.toc, formats.pdf.books[].toc

A table of contents: of the headings of each page's document (formats.pdf.toc), or of a book (formats.pdf.books[].toc).

enabled = c.Type(bool, default=False)

Should a table of contents be inserted after the (first) front cover?

title = c.Type(str, default='Table of contents')

The title of the table of contents.

depth = PositiveInteger(default=2)

The deepest level of headings listed (in books, 1 lists pages only).

template = c.Optional(c.File(exists=True))

A Jinja template replacing the default one (variables: title, entries).

formats.pdf.books[]

A book: pages of the website combined into a single document (formats.pdf.books[]).

enabled = c.Type(bool, default=True)

Is the book generated?

output = c.Type(str, default='book.pdf')

The path of the document, relative to the website's root.

metadata = c.Type(dict, default={})

Information about the document (title, author, subject, keywords).

covers = c.Choice(COVER_MODES, default='all')

The cover pages kept (all, none, limits, book, front or back).

include = c.ListOfItems(c.Type(str), default=['*'])

Patterns of the source paths of the pages to combine (* matches any text).

exclude = c.ListOfItems(c.Type(str), default=[])

Patterns of the source paths of the pages to leave out.

start = c.Choice(START_MODES, default='any')

odd to start each page of the website on a right-hand (odd) page of the book, inserting blank pages.

outline = c.Type(int, default=3)

The depth of bookmarks: 0 for none, 1 for pages, 2 to add their h2 headings...

tagged = c.Type(bool, default=True)

Is the document tagged (its structure described, for screen readers)? Tagging makes documents about 50 % larger.

toc = c.SubConfig(TocConfig)

The table of contents.

formats.pdf.cache

The cache of documents (formats.pdf.cache).

enabled = c.Type(bool, default=True)

Should documents be reused while their page and resources are unchanged?

directory = c.Type(str, default='.cache/plugin/exporter')

The cache's directory (relative to the configuration file).

formats.pdf.browser

The browser printing documents (formats.pdf.browser).

debug = c.Type(bool, default=False)

Should console messages sent to the browser be logged?

headless = c.Type(bool, default=True)

Should the browser start in headless mode?

timeout = PositiveInteger(default=60000)

The time (in milliseconds) given to each document to render.

delay = c.Type(int, default=0)

Extra time (in milliseconds) given to scripts before paginating documents.

channel = c.Optional(c.Type(str))

The browser distribution channel (e.g. chrome, msedge), Chromium by default.

args = c.ListOfItems(c.Type(str), default=[])

Extra arguments to pass to the browser.