3. Core flag translation (page size, orientation, margins) #5

Closed
opened 2026-05-20 15:30:29 -06:00 by ppreeper · 0 comments
Owner

Description

Map wkhtmltopdf page/layout flags to Chrome --print-to-pdf arguments.

Tasks

  • Map --page-size to Chrome paper sizes:
    • A4, Letter, Legal, Tabloid, A3, A5, B4, B5
  • Map --page-width + --page-height to custom dimensions (mm → inches)
  • Map --orientation to landscape/portrait
  • Map margins (--margin-top, --margin-bottom, --margin-left, --margin-right) from mm to inches
  • Conversion: inches = mm / 25.4
  • Build Chrome --print-to-pdf argument string with all mapped values

Acceptance Criteria

  • --page-size A4--print-to-pdf=paperSize=A4
  • --orientation landscape--print-to-pdf=landscape=true
  • --margin-top 20 → top margin = 0.787 inches in Chrome args
  • --page-width 210 --page-height 297 → custom paper size in inches
  • Combined flags produce correct composite Chrome argument string

Notes

  • Chrome --print-to-pdf accepts key=value pairs
  • Relates to PRD #2
## Description Map wkhtmltopdf page/layout flags to Chrome `--print-to-pdf` arguments. ## Tasks - [ ] Map `--page-size` to Chrome paper sizes: - A4, Letter, Legal, Tabloid, A3, A5, B4, B5 - [ ] Map `--page-width` + `--page-height` to custom dimensions (mm → inches) - [ ] Map `--orientation` to `landscape`/`portrait` - [ ] Map margins (`--margin-top`, `--margin-bottom`, `--margin-left`, `--margin-right`) from mm to inches - [ ] Conversion: inches = mm / 25.4 - [ ] Build Chrome `--print-to-pdf` argument string with all mapped values ## Acceptance Criteria - `--page-size A4` → `--print-to-pdf=paperSize=A4` - `--orientation landscape` → `--print-to-pdf=landscape=true` - `--margin-top 20` → top margin = 0.787 inches in Chrome args - `--page-width 210 --page-height 297` → custom paper size in inches - Combined flags produce correct composite Chrome argument string ## Notes - Chrome `--print-to-pdf` accepts key=value pairs - Relates to PRD #2
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ppreeper/wkhtmltopdf#5
No description provided.