PDF Export

Export lessons and courses to professional PDF documents


PDF Export 📄

Export your markdown lessons and entire courses to professionally formatted, print-ready PDF documents. Perfect for handouts, offline reading, and archival.

Features

  • Professional Formatting: Print-optimized layout with proper page breaks
  • Syntax Highlighting: Code blocks maintain their syntax highlighting
  • Interactive Component Transformation: Tabs, spoilers, galleries automatically optimized for print
  • Rich Document Structure: Cover pages, table of contents, headers/footers
  • Configurable Options: Paper size, margins, orientation
  • All Extensions Supported: Works with all 22+ CommonMark extensions

Quick Start: Print This Page Now! 🚀

The easiest way to get a PDF of this lesson:

  1. Click the 📄 Print to PDF button at the top of this page
  2. Or press Ctrl+P (Windows/Linux) or Cmd+P (Mac)
  3. In the print dialog, select "Save as PDF" as your destination
  4. Click "Save" and choose where to save the file

That's it! No installation needed. Your browser does all the work.

Export Options

Option 1: Print to PDF (Client-Side) ⭐

Recommended for quick exports

Use the print button at the top of any lesson page. This uses your browser's native print functionality with optimized print styles.

Benefits:

  • ✅ Works immediately
  • ✅ No server setup required
  • ✅ Perfect rendering
  • ✅ Uses your browser's PDF engine

Option 2: Server-Side Export (Advanced)

For automated exports and batch operations

Export the current lesson to PDF via server:

GET /courses/markdown-features/21-pdf-export/export/pdf

Download This Lesson as PDF

Note: This requires Browsershot and Puppeteer to be installed on the server.

Export Entire Course

Export all lessons in this course as a single PDF:

GET /courses/markdown-features/export/pdf

Download Full Course as PDF

Configuration

Customize your PDF export with query parameters:

Paper Size

?paperSize=A4      # A4 (default) - 210 × 297 mm
?paperSize=LETTER  # US Letter - 8.5 × 11 inches
?paperSize=LEGAL   # US Legal - 8.5 × 14 inches

Example: Export as US Letter

Orientation

?landscape=true    # Landscape orientation
?landscape=false   # Portrait (default)

Example: Export in Landscape

Margins

Control page margins in millimeters:

?marginTop=20      # Top margin (default: 20mm)
?marginRight=15    # Right margin (default: 15mm)
?marginBottom=20   # Bottom margin (default: 20mm)
?marginLeft=15     # Left margin (default: 15mm)

Example: Export with Large Margins

Cover & Table of Contents

For course exports, control cover page and TOC:

?includeCover=true   # Include cover page (default)
?includeCover=false  # Skip cover page

?includeTOC=true     # Include table of contents (default)
?includeTOC=false    # Skip TOC

Example: Export Course without Cover

Combined Options

Combine multiple options:

?paperSize=LETTER&marginTop=25&marginBottom=25&landscape=false

Custom Export Example

How Components Transform

Tabs → All Content Visible