From ef73d73152bd1afebcece755e5856dcbba50ffdc Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 3 Jun 2026 17:16:56 -0400 Subject: [PATCH] book(E2): PDF export modal with bleed / crop marks / range / split MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces the one-click "Export PDF…" with a dedicated modal that exposes the options the pipeline now supports. Options: - Page range — All / 1-based from–to. Editing either input flips the radio so the user doesn't have to click it first. - Include cover spread (default = on when the book has a cover). - Include bleed margin — pages export at trim + 2×bleed, with the trim canvas centered inside; the surrounding strip is the page bg. - Crop marks — _drawCropMarks emits L-shaped marks outside each trim corner via pdf-lib's drawLine (printer guidance for cutting). - Output: single PDF (interior + cover) or split (interior + cover as two files). - Filename pattern: .pdf, or -interior.pdf + -cover.pdf for split mode. Default = title-slug. Pipeline: - exportBookToPdf now accepts {dpi, includeCover, includeBleed, cropMarks, range:{from,to}, split}. Range filters enumerateBookPhysicalPages. Bleed-inclusive pages are sized trimW+2×bleed and place the trim canvas at the bleed offset, so artwork extends past the trim edge only when bleed-aware layers on the page actually do — for v1 the strip stays the page bg. - Cover spread honours includeBleed too: when off, the bleed- inclusive canvas draws at a negative offset so only the trim area lands on the (smaller) page. Cover crop marks position at the spread's trim corners. - Split output returns { split: true, interior, cover, warnings }; single output keeps the existing { blob, warnings } shape. Modal lifecycle: - openBookExportModal seeds totals + sensible defaults. - runBookExportFromModal reads inputs, calls exportBookToPdf, and triggers the download(s). Auto-closes on success after 800 ms; surfaces warnings inline. - Click-outside + ESC close behave like other modals. Co-Authored-By: Claude Opus 4.7 --- src/index.html | 332 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 278 insertions(+), 54 deletions(-) diff --git a/src/index.html b/src/index.html index 7230f07..8966f3f 100644 --- a/src/index.html +++ b/src/index.html @@ -5314,6 +5314,69 @@ + +