doom export
Export documentation to PDF format. Automatically excludes API routes and generates PDFs for each language and configured export scope.Usage
Arguments
Root directory of the documentation. Defaults to current working directory.
Options
Server host name for the temporary preview serverExample:
Server port number for the temporary preview serverExample:
Prerequisites
You must build your documentation before exporting:Behavior
Export Process
- Validation - Checks that built files exist in
outDir - Server Start - Starts a temporary preview server
- Auto-Sidebar - Generates sidebar if not configured
- Page Collection - Collects pages from sidebar
- PDF Generation - Generates PDFs using headless browser
- Cleanup - Removes temporary files and closes server
Auto-Exclusions
These routes are automatically excluded from export:apis/**(unless inapisexport scope)*/apis/**for multi-language setups
Output Files
PDFs are generated with naming:- Full documentation:
{title}-{lang}.pdf - Scoped exports:
{scope-name}-{lang}.pdf
Multi-Language Support
IfthemeConfig.locales is configured, exports are generated for each language.
PDF Configuration
Default PDF settings:Export Scopes
Configure export scopes indoom.config.yaml:
Scope Format
Optional name for the PDF file. If omitted, uses the first sidebar item text.
Glob patterns matching files to include. Can be:
- Single pattern:
"guides/**" - Multiple patterns:
["guides/**", "tutorials/**"]
API Scopes
Scopes starting withapis/ or */apis/ are treated specially:
- API pages are included in the export
- Processed after non-API scopes
Examples
Basic export
Export with custom port
Export from specific directory
Full workflow
Export specific version
Configuration Example
Complete export configuration:user-guide-en.pdfuser-guide-zh.pdfapi-reference-en.pdfapi-reference-zh.pdfDevelopment-en.pdfDevelopment-zh.pdfMy Documentation-en.pdf(full docs)My Documentation-zh.pdf(full docs)
Output
During export:PDF Features
Included Elements
- Full documentation content
- Images and diagrams
- Code blocks with syntax highlighting
- Tables and lists
- Custom MDX components
Excluded Elements
- Navigation sidebar
- Table of contents sidebar
- Header search
- Interactive elements (buttons, forms)
Bookmarks
PDF bookmarks are automatically generated from:- Sidebar structure
- Page headings
- Nested sections
Print Mode
Pages are loaded with?print query parameter that:
- Applies print-specific styles
- Hides interactive elements
- Optimizes for PDF rendering
Advanced Options
Custom Printer Options
Custom Outlines
Bookmarks are generated from sidebar structure, overriding default heading-based outlines.Troubleshooting
”Please build the documentation first”
Run build before export:Port already in use
Specify different port:PDF is incomplete
Ensure sidebar is properly configured:Images not rendering
Check that:- Images exist in
public/directory - Image paths are correct
- Build included all assets
Large file size
- Optimize images before building
- Use appropriate image formats (WebP, optimized PNG)
- Consider splitting into multiple PDFs via export scopes
Export hangs
- Check console for errors
- Verify all pages are accessible
- Increase timeout (requires code modification)
- Check for JavaScript errors in pages
Performance Tips
- Pre-optimize Assets - Compress images before building
- Use Scopes - Generate smaller, focused PDFs
- Exclude APIs - API docs often don’t need PDF export
- Clean Build - Ensure clean build before export
Related Commands
- doom build - Build before exporting
- doom serve - Preview before export