Phase 3 (Organize + robust save) + Phase 4 (Edit content); update docs
Engine: - organize.rs: build_document(plan) core — insert/delete/rotate/crop/extract/merge/split - watermark.rs: watermark + header/footer via PdfPages::watermark, CID Unicode fonts - qpdf.rs: QPDF CLI wrapper — repair corrupt files, re-encrypt after edits, ensure_openable - edit.rs: MOAT — list_objects + apply_edits (SetText VN, Transform, Delete, Add/ReplaceImage) - Tests: organize/watermark/qpdf_safety/edit roundtrip — 43/43 engine tests green UI (Tauri): "Tổ chức trang" mode (grid + drag-reorder + multi-select), "Sửa nội dung" mode (WYSIWYG object overlay, edit-in-place), global undo/redo, robust file open. Corpus: add encrypted.pdf + corrupt-truncated.pdf fixtures. Docs: mark Phase 1-4 done in roadmap; document QPDF setup + engine module layout in 05-dev-setup; add 10-13 phase summaries & user-test checklists; README status.
This commit is contained in:
+20
-4
@@ -7,6 +7,7 @@
|
||||
- **Visual Studio Build Tools** + workload **Desktop development with C++** (cung cấp `cl.exe`/`link.exe` cho linker MSVC).
|
||||
- **WebView2 Runtime** (cho Tauri; Windows 11 thường có sẵn).
|
||||
- **PDFium**: `pdfium.dll` prebuilt — tải bằng `scripts/fetch-pdfium.ps1` (đặt vào gốc workspace + `pdfium/`).
|
||||
- **QPDF** (từ Phase 3): `qpdf.exe` prebuilt — tải bằng `scripts/fetch-qpdf.ps1`. Dùng để sửa file hỏng (repair) trước khi PDFium mở + mã hoá lại file sau khi chỉnh sửa.
|
||||
- (Tauri) Node không bắt buộc: app dùng frontend tĩnh, chạy thẳng bằng `cargo run`.
|
||||
|
||||
## Lấy PDFium
|
||||
@@ -16,16 +17,29 @@ powershell -File scripts/fetch-pdfium.ps1
|
||||
```
|
||||
Engine tìm `pdfium.dll` theo thứ tự: `FOFREEXIT_PDFIUM_PATH` → cwd → `./pdfium` → thư mục exe → thư viện hệ thống.
|
||||
|
||||
## Lấy QPDF
|
||||
```powershell
|
||||
# Tải qpdf.exe (prebuilt) về workspace
|
||||
powershell -File scripts/fetch-qpdf.ps1
|
||||
```
|
||||
Engine tìm `qpdf.exe` theo thứ tự: `FOFREEXIT_QPDF_PATH` → `<cwd>/qpdf/bin/qpdf.exe` → cạnh file exe → `qpdf` trong PATH hệ thống (xem `crates/ff-engine/src/qpdf.rs`).
|
||||
|
||||
## Cấu trúc
|
||||
```
|
||||
crates/ff-cos # COS layer (khung)
|
||||
crates/ff-pdmodel # PD layer (khung)
|
||||
crates/ff-engine # render qua PDFium (Phase 1: render.rs)
|
||||
crates/ff-cli # CLI "ff" (info, render)
|
||||
crates/ff-engine # render + chỉnh sửa qua PDFium/QPDF
|
||||
render.rs # Phase 1: render trang, page_dims, extract_text, search, outline
|
||||
annot.rs # Phase 2: chú thích (highlight/note/shape/free-draw...)
|
||||
organize.rs # Phase 3: tổ chức trang (insert/delete/rotate/crop/merge/split)
|
||||
watermark.rs # Phase 3: watermark + header/footer
|
||||
qpdf.rs # Phase 3: repair file hỏng + mã hoá lại (QPDF CLI)
|
||||
edit.rs # Phase 4: sửa nội dung (text run/object) trực tiếp
|
||||
crates/ff-cli # CLI "ff" (info, render, pages, text, search, outline)
|
||||
app/src # frontend tĩnh (HTML/CSS/JS)
|
||||
app/src-tauri # backend Tauri (crate riêng, workspace tách)
|
||||
corpus/ # PDF mẫu để test
|
||||
scripts/ # tiện ích (fetch-pdfium)
|
||||
scripts/ # tiện ích (fetch-pdfium, fetch-qpdf)
|
||||
```
|
||||
|
||||
## CLI
|
||||
@@ -46,8 +60,10 @@ cargo run -p ff-cli -- outline corpus\sample-multipage.pdf
|
||||
|
||||
## Test
|
||||
```powershell
|
||||
cargo test -p ff-engine # smoke test render (cần pdfium.dll)
|
||||
cargo test -p ff-engine # toàn bộ test engine (cần pdfium.dll + qpdf.exe)
|
||||
```
|
||||
Bao gồm: render smoke, viewer features, big-doc, annot round-trip (Phase 1–2),
|
||||
organize/watermark/qpdf-safety (Phase 3), edit round-trip (Phase 4). Hiện **43/43 xanh**.
|
||||
|
||||
## Chạy app desktop (Tauri)
|
||||
```powershell
|
||||
|
||||
Reference in New Issue
Block a user