Files
wekan/docs/Features/ImportExport/PDF/PDF.md
T
Lauri Ojansivu 7858d84e12 Import and export many boards at once for every format, and document each format in its own directory.
Import many boards: on the import page of every source, several export
files, or one .zip holding them, each become their own board through the
same path a single import of that file takes, and the page lists what each
file became (models/lib/importManyFiles.js). A .zip that is itself one
export (Vikunja, Notion, Plane, WeKan with attachments) stays one board.
One board per project: for the generalized importer, each swimlane the
import would make - a project, folder or list of the tool - becomes its own
board (models/lib/importSplit.js), so an export of a whole app imports as
many boards, as a Trello .zip does. Kanri's all-data export now reads every
board, not only the first, so it splits into one board per Kanri board.

Export all boards: All Boards sidebar, or Multi-Selection for the selected
boards, downloads every board the user may export in one format, each
checked as its own export is. Excel is one workbook with a sheet per board,
named after the board; every other format is a .zip with one file per board
(server/routes/exportAllBoards.js). The per-format bytes are made in one
place, server/lib/renderExternalExport.js, for the board route and this.

A WeKan .zip export imports as a new board from All Boards, unpacked on the
server with its attachments (it was refused in the browser). api.py gains
importboardsfrom and exportallboards, sends every source in the shape the
import page sends, and fetches Excel, PDF, CSV and TSV exports from their
own routes and writes them as bytes.

Fixed while documenting: a Trello Butler rule's list name kept its case,
so the rule fires; the HTML export fetches the board JSON by URL instead of
a link the export popup no longer has; Tasks.org exports time spent;
Nextcloud Deck's done flag marks the due date done.

docs/Features/ImportExport has a directory per format with the steps to
import and export it, one board and many, and its details, moved from
Format-Coverage.md, which is now the index and the shared contract.
tests/importExportDocsCoverage.test.cjs fails when a format has no page.

Thanks to xet7 !
2026-10-09 10:33:37 +03:00

9.5 KiB

PDF

WeKan exports a board, list, swimlane or single card as an A4 PDF. The related Excel export offers the same card sections. Both formats build their content from the layout in One Card Layout. PDF is export only.

How to import

There is no PDF import. A PDF is a printed page: it holds the text and images as they are laid out, not the lists, cards and fields they came from, so there is nothing WeKan could read back reliably. To move a board between WeKan servers, use the WeKan JSON or .zip export.

How to import many boards at once

There is nothing to import: PDF has no import.

How to export

  1. In WeKan, open the menu of what to export: Board Settings → Export for the board, or the hamburger menu of a swimlane, a list or a card.
  2. Under Select what to include, tick the sections you want.
  3. Choose PDF. The PDF downloads.
  4. Open it in any PDF reader, or print it.

How to export all boards at once

This is not available for PDF. A PDF is a document of one board (or one swimlane, list or card), so Export all boards does not offer it. Export each board from its own menu, or use Export all boards with WeKan JSON or Excel instead.

Format details

From the format coverage audit, for PDF, HTML and SVG:

  • Authoritative shape: export-only rendered views.
  • Required coverage: every selected visible section, Unicode, safe links and images, pagination and deterministic filenames; these are presentations, not lossless re-import formats.

Layout and fonts

The board, swimlane, list and card hamburger menus do not have four PDF templates or a second set for Excel. They all include exportScopeBody from client/components/boards/exportScope.jade; one table in exportScope.js defines both download formats, one URL builder adds the selected scope, and one checkbox selection is sent to both routes.

On the server, scope changes only the hierarchy surrounding the cards. Every card at every scope is converted by buildExportCardDocument, then PDF renders the returned medium-independent blocks as pages. PDF-specific code is limited to page geometry, wrapping, pagination, embedded fonts and image encoding; the meaning and ordering of card fields are shared with Excel.

The distributable includes GNU Unifont 17.0.05 and Unifont Upper under the SIL Open Font License 1.1 in private/fonts/unifont. PDFKit subsets and embeds both fonts, so readers do not have to install them. The main font covers the Basic Multilingual Plane and the upper font supplies glyphs from supplementary Unicode planes. This gives every WeKan language a visible glyph and also covers supplementary characters such as emoji. GNU Unifont is deliberately a last-resort coverage font: complex-script shaping and color emoji can be less polished than a platform's script-specific fonts, but text remains present, searchable and portable.

If loading or rendering the embedded fonts fails, the dependency-free writer in models/lib/pdfDocument.js is retained as a safe fallback. It uses base-14 Courier with WinAnsi encoding, preserves Western European text, transliterates some other Latin characters, and replaces unsupported scripts with ?. Markdown headings, lists, emphasis, quotes and code are rendered as document structure instead of printing their Markdown punctuation.

Images and attachments

JPEG attachments are embedded using their original /DCTDecode stream. PNG scanlines are decoded, PNG filters are removed, transparency is composited onto white, and the RGB pixels are embedded with /FlateDecode. Images are scaled down without being enlarged. Up to three previews share an A4 PDF row, and only the filename appears below each image. Excel can fit six previews across its six worksheet columns. The whole PDF preview row moves to the next page when it does not fit. A corrupt, unavailable or unsupported image cannot make the PDF export fail.

Before the previews, the attachment detail table includes every attachment and the same six fields as Excel: row number, filename, human-readable size, media type, upload date/time and uploader. Image details therefore remain complete without repeating size or other metadata in the preview caption.

Order and metadata

Metadata uses three columns like the printable Excel card. A translated label and its value wrap onto additional lines inside that column instead of being shortened with an ellipsis, so complete date and time values remain visible.

Board PDFs are ordered as board name, members, created and modified metadata, then each swimlane, each list within that swimlane, and each card within that list. Smaller exports begin at their selected level: swimlane then lists and cards, list then cards, or the single card. The only visible swimlane is still named, so the hierarchy does not change merely because a board currently has one. Detailed Excel exports use the same order.

Because every scope uses the shared card document, PDF carries the same complete opened-card fields as detailed Excel, including stickers, dependencies, numeric sort position, and every location's place name, address, latitude and longitude. Legacy single-location fields remain visible too.

Current progress

Completed:

  • board, list, swimlane and single-card PDF routes;
  • the same field selection and card-document layout as Excel;
  • one shared hamburger-menu template and one raw-record adapter across board, swimlane, list and card PDF/Excel exports;
  • localized labels, user-timezone dates and rendered Markdown;
  • the logged-in user's saved language, falling back to the current browser language when no language is saved;
  • the date format displayed by the opened card;
  • card metadata, custom fields, checklists, subtasks, comments, attachments, voting and planning poker;
  • JPEG and PNG attachment previews in card and detailed board PDFs;
  • three previews per row with filename-only captions below and atomic pagination;
  • the same six-column attachment details table, colored labels and segmented checklist progress as the printable Excel card;
  • wrapped metadata columns that preserve complete date/time values;
  • binary-safe object offsets and regression tests that inspect the resulting image XObjects and PDF cross-reference table;
  • embedded Unicode-plane fonts, their OFL license, font subsetting and tests that verify PDFKit can parse and embed both shipped fonts.

Remaining: add GIF and BMP decoding if parity with Excel's preview formats is needed.

The former TODO item said PDF still listed images only by name. That step is now implemented and guarded by positive and negative tests.

What is kept

The PDF shows every ticked section of each card in scope:

WeKan PDF
Board, swimlane, list Headings, in board order
Board name, members, created and modified dates The board's opening block
Card title, labels, stickers, locations, people, dates, time tracking The card's metadata columns
Description, comments, checklist items, custom fields Rendered Markdown text
Checklists, subtasks, dependencies, voting, planning poker Their own sections
Attachments A six-column detail table, and previews of JPEG and PNG images

What is not kept

  • GIF and BMP images are listed in the attachment table but not previewed.
  • When the embedded fonts cannot be used, the fallback writer replaces scripts it cannot show with ?.
  • A PDF cannot be imported, so nothing in it comes back into WeKan.

REST API

python3 api.py exportboardformat BOARDID pdf board.pdf  # GET /api/boards/BOARDID/exportPDF
curl -o board.pdf "https://WEKAN-SERVER/api/boards/BOARDID/exportPDF?authToken=TOKEN"
  • GET /api/boards/BOARDID/exportPDF?authToken=TOKEN exports a board, with fields (the ticked parts), swimlaneId or listId to narrow it.
  • GET /api/boards/BOARDID/lists/LISTID/cards/CARDID/exportPDF?authToken=TOKEN exports one card.

There is no import route and no mass export route for PDF.

How it is built and tested

  • models/exportPDF.js authenticates and scopes the HTTP routes.
  • models/server/ExporterCardPDF.js loads board/card data, resolves users and custom fields and reads attachment images.
  • models/lib/cardExportDocument.js maps those records into the shared card document. Excel calls exactly the same adapter, so people, dates, checklist items, comments, attachment details, sizes, voting and poker cannot be mapped differently by the two formats.
  • models/lib/cardDocument.js decides which blocks exist and omits empty or unselected sections.
  • models/lib/pdfDocument.js renders those blocks, paginates them, writes the fallback PDF objects and embeds images.
  • models/server/buildUnicodePdf.js uses PDFKit to subset and embed the bundled GNU Unifont fonts for the normal export path.
  • Unit tests: tests/pdfExport.test.cjs, tests/pdfDrawsTheDocument.test.cjs, tests/pdfkitEntryPatch.test.cjs.
  • Playwright: tests/playwright/specs/25-excel-pdf.e2e.js (a board PDF export returns a PDF document) and tests/playwright/specs/export-access.e2e.js (an assigned-only member cannot export the whole board, or an unassigned card).

Sources

See also: format coverage, all formats.