Skip to content

Export the open document as PDF - #41

Merged
sorenwacker merged 2 commits into
mainfrom
feature/pdf-export
Sep 18, 2026
Merged

sorenwacker merged 2 commits into
mainfrom
feature/pdf-export

Conversation

@sorenwacker

Copy link
Copy Markdown
Owner

Summary

  • Export PDF button in the header, and Cmd/Ctrl+P, for the active document.
  • The save dialog suggests <document>.pdf next to the document.
  • A4 pages, always light regardless of the app's dark mode, with mermaid diagrams rendered as vectors, plus tables, code blocks, images and clickable links. The app's interface is not part of the export.
  • The export renders the tab's current text, so unsaved edits are included even when typed a moment before exporting.
  • A failed write is reported in a dismissible banner; cancelling the dialog does nothing.

The app window is not printed. A hidden window loads print.html, which renders the document with the same stylesheet and the same DOMPurify sanitizer as the main window, draws diagrams, and reports back before printToPDF runs. Behavior is specified in docs/exporting.md.

Test plan

  • npm test: 113 passed (10 new export tests)
  • Export tests read the produced PDF with pdfjs-dist and assert its text, including mermaid node labels; a diagram left unrendered would leave flowchart LR in the file instead
  • npm run lint clean
  • Exported a document with a table, diagram and code block from dark mode and checked the rendered page

OpenDocument export was considered and dropped; only PDF is implemented.

🤖 Generated with Claude Code

@sorenwacker
sorenwacker merged commit fcd6ca6 into main Sep 18, 2026
4 checks passed
@sorenwacker
sorenwacker deleted the feature/pdf-export branch September 18, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant