Skip to content

feat(pdf): PDF studio — merge / split / rotate (stage C item 4) - #77

Merged
TTigger merged 1 commit into
masterfrom
feat/pdf-studio
Jul 13, 2026
Merged

feat(pdf): PDF studio — merge / split / rotate (stage C item 4)#77
TTigger merged 1 commit into
masterfrom
feat/pdf-studio

Conversation

@TTigger

@TTigger TTigger commented Jul 13, 2026

Copy link
Copy Markdown
Owner

摘要

階段 C 第 4 項(範圍已與使用者確認:合併+拆分+旋轉,照 handoff 砍掉壓縮)。pdf-lib(新依賴)純前端處理,檔案不離開瀏覽器,與全站隱私承諾一致。

功能

  • 合併:多檔選取、清單排序(上移/下移/移除)、依序合成下載
  • 拆分:「1-3, 7, 10-12」抽頁成新檔;全形逗號、頓號都容忍;超界或反向整串拒絕並給明確錯誤,不猜使用者意圖
  • 旋轉:90°/180°/270°,可指定頁碼(留空=全部);在原有旋轉角上累加 mod 360(掃描件常已帶角度)

驗證

  • typecheck:api ✓ / 551 unit ✓(+10,pdf-lib 現做 PDF 驗頁數與旋轉角)/ 65 e2e ✓(+3)
  • e2e 的下載檔用 pdf-lib 回讀驗證:合併 3+2 頁 → 5 頁、抽 2,4 → 2 頁、旋轉後每頁 90°
  • OG 卡 74 張重生成、新卡已目測;工具頁已截圖目測(截到按鈕 transition 過渡瞬間,已另行 probe 確認 enabled)
  • 純前端,不碰 api/

🤖 Generated with Claude Code

範圍照 handoff 與使用者確認:合併+拆分+旋轉,砍掉壓縮。
pdf-lib(新依賴)純前端處理,檔案不離開瀏覽器。

- src/lib/pdfPages.ts:頁碼範圍解析(TDD 5 tests)——「1-3, 7, 10-12」,
  全形逗號/頓號容忍,超界或反向整串拒絕不猜意圖。
- src/lib/pdfOps.ts:合併/抽頁/旋轉(TDD 5 tests,用 pdf-lib 現做
  PDF 驗頁數與旋轉角);旋轉在原角度上累加 mod 360。
- src/tools/PdfStudio.tsx:三分頁——合併(多檔排序上移下移)、
  拆分(範圍抽頁)、旋轉(90/180/270,可指定頁);壞檔與加密檔
  有明確錯誤訊息。
- 中英頁面、tools.ts 註冊(實用工具 📄)、OG 卡 74 張。
- e2e:現做 PDF 上傳,下載檔用 pdf-lib 回讀驗證頁數與旋轉角(+3),
  含錯誤頁碼的停用與提示。

測試:typecheck:api ✓ / 551 unit ✓(+10)/ 65 e2e ✓(+3)
純前端,不碰 api/。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tiglet Ready Ready Preview, Comment Jul 13, 2026 2:32pm

@TTigger
TTigger merged commit cb9152e into master Jul 13, 2026
3 checks passed
@TTigger
TTigger deleted the feat/pdf-studio branch July 13, 2026 14:34
TTigger added a commit that referenced this pull request Jul 13, 2026
Scope confirmed with the user (per the handoff plan): merge + split +
rotate, compression dropped. pdf-lib (new dependency) does everything
client-side — files never leave the browser.

- src/lib/pdfPages.ts: page-range parsing (TDD 5 tests) — "1-3, 7,
  10-12", tolerant of full-width and CJK commas; out-of-range or
  reversed ranges reject the whole string instead of guessing intent.
- src/lib/pdfOps.ts: merge / extract / rotate (TDD 5 tests that build
  real PDFs with pdf-lib and assert page counts and rotation angles);
  rotation adds to the existing page angle mod 360, since scans often
  carry one already.
- src/tools/PdfStudio.tsx: three tabs — merge (multi-file with
  up/down reordering), split (range extraction), rotate (90/180/270,
  optional page range); clear errors for broken or password-protected
  files.
- zh/en pages, tools.ts entry (📄), OG cards regenerated (74 total).
- e2e: PDFs built on the fly, downloads re-parsed with pdf-lib to
  assert page counts and angles; invalid ranges disable the button
  with a visible message (+3).

Tests: typecheck:api / 551 unit (+10) / 65 e2e (+3).
Frontend only; api/ untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@TTigger TTigger changed the title feat(pdf): PDF 工具 — 合併/拆分/旋轉 (stage C item 4) feat(pdf): PDF studio — merge / split / rotate (stage C item 4) Jul 13, 2026
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