v0.3.2 #3
327
README
327
README
@@ -1,327 +0,0 @@
|
||||
# pdf-tools / PDF Workbench
|
||||
|
||||
`pdf-tools` is a self-hostable, browser-only PDF workbench for fast page-level PDF operations. It is built for situations where uploading PDFs to a third-party service is undesirable, but users still need simple, visual tools to split, merge, reorder, rotate, duplicate, delete, extract, and export pages.
|
||||
|
||||
Current hosted version: <https://pdftools.add-ideas.de>
|
||||
|
||||
Current release: **v0.3.2 — Multi-file merge queue release**. See [`CHANGELOG.md`](CHANGELOG.md) for release notes and milestone history.
|
||||
|
||||
The app is a static React/Vite single-page application. There is no backend service, no server-side queue, and no server-side document storage. When hosted correctly, the server only delivers HTML, JavaScript, CSS, and static assets; PDF processing happens in the user's browser.
|
||||
|
||||
## Purpose
|
||||
|
||||
Many everyday PDF tasks are not full document-authoring tasks. They are page-workbench tasks:
|
||||
|
||||
- remove pages before sending a document;
|
||||
- rotate scanned pages;
|
||||
- split a PDF into single-page files and download them individually or as one ZIP archive;
|
||||
- merge one or more PDFs into the current workspace;
|
||||
- extract a subset of pages;
|
||||
- reorder pages visually;
|
||||
- keep a local working state while experimenting;
|
||||
- undo and redo page operations before exporting.
|
||||
|
||||
`pdf-tools` focuses on this page-level workflow. It is intentionally not a full PDF editor, OCR solution, digital-signature workflow, DMS, or Adobe Acrobat replacement.
|
||||
|
||||
## Where the project comes from
|
||||
|
||||
The project started as a pragmatic, browser-only PDF helper for quick administrative and document-preparation tasks. The guiding idea is simple: many users need small PDF operations, but sensitive or internal documents should not have to leave the browser just to remove, rotate, split, or rearrange pages.
|
||||
|
||||
This makes the project especially useful for self-hosted environments, public-sector settings, universities, small organizations, and internal tools where operational simplicity and document locality matter.
|
||||
|
||||
## Distinguishing features
|
||||
|
||||
- **Browser-only processing**: PDF files are processed locally in the browser. The hosting server does not receive the selected PDFs.
|
||||
- **Static self-hosting**: The production build can be served by any static web server or reverse proxy.
|
||||
- **Visual page workspace**: Users work with page thumbnails, drag-and-drop ordering, selection, page preview, and page-level actions.
|
||||
- **Named local workspaces**: Workspaces can be saved in the browser with the PDF binary and editing state stored in IndexedDB.
|
||||
- **Undo/redo command history**: Workspace operations are recorded as commands with label, timestamp, and payload. The history view shows undo and redo states.
|
||||
- **Progressive thumbnails**: Thumbnails are generated progressively so the UI becomes useful before all pages have finished rendering.
|
||||
- **Thumbnail cache by page and rotation**: Rotated thumbnails are cached and only changed thumbnails need to be regenerated.
|
||||
- **Stable page references**: Duplicated pages and reordered pages are tracked as workspace page references rather than only by original page number.
|
||||
- **Multi-file merge queue**: Loading several PDFs opens a queue where users can review, reorder, remove, append, insert, or replace before merging.
|
||||
- **In-app help**: The app includes a Help/Tutorial dialog with keyboard shortcuts and workflow explanations.
|
||||
|
||||
## Current features
|
||||
|
||||
### File and workspace handling
|
||||
|
||||
- Load a local PDF file.
|
||||
- Save a named workspace in the browser.
|
||||
- Restore saved workspaces from IndexedDB.
|
||||
- Reset the active workspace, with a save prompt for unsaved changes.
|
||||
- Delete saved workspaces after confirmation.
|
||||
- Store workspace history and redo history.
|
||||
|
||||
### Page operations
|
||||
|
||||
- Generate page thumbnails in the browser.
|
||||
- Reorder pages with drag and drop.
|
||||
- Select individual pages.
|
||||
- Select page ranges with Shift-click.
|
||||
- Drag a selected page to move the whole selection.
|
||||
- Duplicate/copy selected pages into a chosen position.
|
||||
- Rotate pages clockwise and counter-clockwise.
|
||||
- Delete one page or all selected pages after confirmation.
|
||||
- Preview pages in a modal overlay.
|
||||
- Flip through preview pages with buttons or arrow keys.
|
||||
|
||||
### Export tools
|
||||
|
||||
- Export the current reordered/rotated/duplicated/deleted workspace as a new PDF.
|
||||
- Extract selected pages into a new PDF.
|
||||
- Open selected pages as a new active workspace for continued editing.
|
||||
- Split the source PDF into single-page PDFs.
|
||||
- Download all split results as one ZIP archive.
|
||||
- Merge several PDFs through a queue, then replace, append, or insert them into the current workspace.
|
||||
|
||||
### Keyboard shortcuts
|
||||
|
||||
| Shortcut | Action |
|
||||
| -------------------------- | --------------------------------------------------- |
|
||||
| `F1` / `?` | Open in-app help and tutorial |
|
||||
| `Ctrl`/`⌘` + `A` | Select all pages |
|
||||
| `Delete` / `Backspace` | Delete selected pages after confirmation |
|
||||
| `Esc` | Clear the current selection or close an open dialog |
|
||||
| `Ctrl`/`⌘` + `Z` | Undo |
|
||||
| `Ctrl`/`⌘` + `Shift` + `Z` | Redo |
|
||||
| `Ctrl`/`⌘` + `Y` | Redo |
|
||||
| `←` / `→` in preview | Move to previous / next page |
|
||||
| `Esc` in preview | Close preview |
|
||||
|
||||
Keyboard shortcuts are ignored while typing in form fields.
|
||||
|
||||
## In-app documentation concept
|
||||
|
||||
The app includes a Help/Tutorial dialog reachable from the header via **Help ?**, `F1`, or `?`.
|
||||
|
||||
Recommended structure for in-app documentation:
|
||||
|
||||
1. **Quick tutorial**: short task-oriented steps from loading a PDF to exporting.
|
||||
2. **Keyboard shortcuts**: a compact reference for power users.
|
||||
3. **Concepts**: explain the difference between a PDF file, a workspace, command history, and exported output.
|
||||
4. **Privacy model**: state clearly that processing is browser-local and workspaces are saved in local browser storage.
|
||||
5. **Roadmap hints**: link users to the README or project repository for planned features, instead of overloading the app UI.
|
||||
|
||||
This keeps the app useful for first-time users without turning the main interface into a manual.
|
||||
|
||||
## Administrator notes
|
||||
|
||||
### Deployment model
|
||||
|
||||
`pdf-tools` is deployed as a static web application:
|
||||
|
||||
```text
|
||||
browser <-- HTTPS --> static web server / reverse proxy --> built app assets
|
||||
```
|
||||
|
||||
There is no application server to operate. Administrators only need to host the built files from `dist/`.
|
||||
|
||||
### Build and test from source
|
||||
|
||||
```bash
|
||||
npm ci
|
||||
npm run check
|
||||
```
|
||||
|
||||
`npm run check` runs the main project quality gate:
|
||||
|
||||
```bash
|
||||
npm run typecheck
|
||||
npm run lint
|
||||
npm run test
|
||||
npm run build
|
||||
```
|
||||
|
||||
The production build is written to `dist/`.
|
||||
|
||||
Useful individual development commands:
|
||||
|
||||
```bash
|
||||
npm run dev # start the Vite development server
|
||||
npm run preview # preview the production build locally
|
||||
npm run test # run tests once
|
||||
npm run test:watch # run tests in watch mode
|
||||
npm run typecheck # run TypeScript without emitting files
|
||||
npm run lint # run ESLint
|
||||
npm run format # format the project with Prettier
|
||||
npm run format:check # verify Prettier formatting
|
||||
```
|
||||
|
||||
### Static hosting
|
||||
|
||||
Any static hosting setup should work, for example:
|
||||
|
||||
- nginx;
|
||||
- Apache httpd;
|
||||
- Caddy;
|
||||
- Traefik in front of a static file container;
|
||||
- GitLab Pages or another static publishing target;
|
||||
- a minimal container serving `dist/`.
|
||||
|
||||
A typical nginx location for a single-page app looks like this:
|
||||
|
||||
```nginx
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
```
|
||||
|
||||
### Reverse proxy considerations
|
||||
|
||||
For production, serve the built app via HTTPS. The reverse proxy only sees requests for static app assets. It should not receive the user's PDF files, because the files are opened through browser APIs and processed locally.
|
||||
|
||||
For the Vite development server, `vite.config.ts` can restrict allowed hosts. The current development configuration includes `pdftools.add-ideas.de` as an allowed host for the dev server. This is not required for a normal production static build.
|
||||
|
||||
### Content Security Policy
|
||||
|
||||
A strict CSP is possible, but it must account for browser-local rendering details. Thumbnails use data URLs, downloads use blob URLs, and pdf.js uses a worker.
|
||||
|
||||
A starting point for testing could be:
|
||||
|
||||
```http
|
||||
Content-Security-Policy: default-src 'self'; script-src 'self'; worker-src 'self' blob:; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self'; form-action 'none'
|
||||
```
|
||||
|
||||
Adjust this to your hosting environment and test PDF loading, thumbnail rendering, preview, and downloads before enforcing it broadly.
|
||||
|
||||
### Storage and persistence
|
||||
|
||||
Saved workspaces are stored in the user's browser using IndexedDB. A workspace may include:
|
||||
|
||||
- the source PDF binary;
|
||||
- workspace name and metadata;
|
||||
- page order and duplicated page references;
|
||||
- rotations;
|
||||
- selected pages;
|
||||
- undo and redo command history.
|
||||
|
||||
This has several operational consequences:
|
||||
|
||||
- Workspaces are local to the browser profile and device.
|
||||
- Clearing browser data can delete saved workspaces.
|
||||
- Server backups do not include user workspaces.
|
||||
- Different users on different devices do not share workspaces through the server.
|
||||
- Browser storage quotas apply.
|
||||
|
||||
### Privacy and logging
|
||||
|
||||
The server should only log asset requests for the app itself. It should not log PDF filenames or contents unless the hosting environment adds custom client-side telemetry or upload logic. Avoid adding analytics that could weaken the project's privacy model.
|
||||
|
||||
### Browser support
|
||||
|
||||
The app expects modern browser APIs, including:
|
||||
|
||||
- File API;
|
||||
- Blob and object URLs;
|
||||
- IndexedDB;
|
||||
- Web Workers;
|
||||
- Canvas;
|
||||
- modern JavaScript modules.
|
||||
|
||||
Use current versions of Chromium, Firefox, Safari, or Edge.
|
||||
|
||||
## Versioning and release baseline
|
||||
|
||||
The application version shown in the header is defined in `src/version.ts`. The package version in `package.json` and the displayed app version should be kept in sync for releases.
|
||||
|
||||
The current development baseline is:
|
||||
|
||||
```text
|
||||
v0.3.1 — Split ZIP export release
|
||||
```
|
||||
|
||||
This release preserves the browser-only workspace baseline and adds split-result ZIP downloads on top of the selection-workspace feature. Workspace state, thumbnail handling, generated download URLs, page-grid components, tests, type-checking, linting, and formatting are separated enough to support additional feature work without turning `App.tsx` back into a monolith.
|
||||
|
||||
## Project structure
|
||||
|
||||
```text
|
||||
src/
|
||||
App.tsx Main application orchestration and UI wiring
|
||||
components/
|
||||
ActionDialog.tsx Reusable confirmation/action dialog
|
||||
ActionsPanel.tsx Export, extract, split, and ZIP download actions
|
||||
FileLoader.tsx PDF file loading
|
||||
HelpDialog.tsx In-app tutorial and shortcut reference
|
||||
Layout.tsx Application shell/header
|
||||
PagePreviewModal.tsx Large page preview with navigation
|
||||
ReorderPanel.tsx Page grid, selection, drag/drop, copy/delete/rotate
|
||||
WorkspacePanel.tsx Workspace save/load/reset and undo/redo history
|
||||
pdf/
|
||||
pdfService.ts pdf-lib operations: load, merge, split, export
|
||||
pdfThumbnailService.ts pdf.js thumbnail rendering
|
||||
pdfZipService.ts Browser-side ZIP packaging for split results
|
||||
pdfTypes.ts PDF-related types
|
||||
workspace/
|
||||
workspaceCommands.ts Command model for undo/redo
|
||||
workspaceDb.ts IndexedDB persistence
|
||||
workspaceTypes.ts Workspace data model
|
||||
styles.css Global styles
|
||||
version.ts App version displayed in the header
|
||||
```
|
||||
|
||||
## Roadmap
|
||||
|
||||
### Milestone 1: Fast preview and thumbnails
|
||||
|
||||
- [x] Remove unused legacy page list view.
|
||||
- [x] Bound thumbnail generation by width and height.
|
||||
- [x] Display thumbnails progressively.
|
||||
- [x] Add preview page flipping.
|
||||
- [x] Attach preview controls to the modal container.
|
||||
- [x] Add first keyboard shortcuts.
|
||||
- [x] Cache thumbnails by page and rotation.
|
||||
- [x] Regenerate only changed rotated thumbnails.
|
||||
- [x] Show software version number.
|
||||
|
||||
### Milestone 2: Real page workspace
|
||||
|
||||
- [x] Introduce stable page references instead of only original page indices.
|
||||
- [x] Support duplicate selected pages.
|
||||
- [x] Save and reload the last state from browser storage.
|
||||
- [x] Support named workspaces.
|
||||
- [x] Store PDF binaries directly in IndexedDB.
|
||||
- [x] Reset workspace.
|
||||
- [x] Add command history as a foundation for undo/redo.
|
||||
- [x] Add undo/redo.
|
||||
- [x] Display undo/redo history with redo entries visually separated.
|
||||
- [x] Extract selection as a new active workspace.
|
||||
- [ ] Reduce undo/redo storage footprint if large documents make snapshots too heavy.
|
||||
- [ ] Add grid/list view toggle.
|
||||
|
||||
### Milestone 3: Better merge and mobile handling
|
||||
|
||||
- [x] Add a full multi-file merge queue.
|
||||
- [ ] Support drag-and-drop of PDFs into the page grid at the hovered position.
|
||||
- [ ] Add custom long-press drag on mobile.
|
||||
- [ ] Consolidate frequently used actions into a toolbar.
|
||||
|
||||
### Milestone 4: Structural PDF editing
|
||||
|
||||
- [ ] Metadata editing.
|
||||
- [ ] Crop pages.
|
||||
- [ ] Add tools directly in the preview overlay.
|
||||
- [ ] Read/fill/flatten forms.
|
||||
- [ ] Read bookmarks, then evaluate bookmark editing.
|
||||
- [ ] Read annotations, then evaluate annotation writing.
|
||||
|
||||
### Milestone 5: Export and power tools
|
||||
|
||||
- [ ] Basic text extraction.
|
||||
- [x] ZIP export for split results.
|
||||
- [ ] Optimize/compress MVP.
|
||||
- [ ] Carefully scoped encrypted PDF handling.
|
||||
|
||||
## Non-goals for now
|
||||
|
||||
- Server-side PDF processing.
|
||||
- Collaborative editing.
|
||||
- User accounts.
|
||||
- OCR.
|
||||
- Full content-stream editing.
|
||||
- Digital signature creation/validation workflows.
|
||||
- DMS replacement functionality.
|
||||
|
||||
## License
|
||||
|
||||
GPL-3.0. See `LICENSE`.
|
||||
@@ -4,6 +4,12 @@
|
||||
<meta charset="UTF-8" />
|
||||
<title>Self-hosted PDF Workbench</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<meta name="apple-mobile-web-app-title" content="PDFTools" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
BIN
public/apple-touch-icon.png
Normal file
BIN
public/apple-touch-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
public/favicon-96x96.png
Normal file
BIN
public/favicon-96x96.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
17
public/favicon.svg
Normal file
17
public/favicon.svg
Normal file
@@ -0,0 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="pdftools favicon" width="64" height="64"><metadata><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Description><dc:creator>RealFaviconGenerator</dc:creator><dc:source>https://realfavicongenerator.net</dc:source></rdf:Description></rdf:RDF></metadata><defs>
|
||||
<linearGradient id="pdf-bg" x1="10" y1="4" x2="54" y2="60" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#ff4b3f"></stop>
|
||||
<stop offset="1" stop-color="#c91424"></stop>
|
||||
</linearGradient>
|
||||
<filter id="soft-shadow" x="-20%" y="-20%" width="140%" height="140%">
|
||||
<feDropShadow dx="0" dy="2" stdDeviation="1.25" flood-color="#7a0b12" flood-opacity="0.28"></feDropShadow>
|
||||
</filter>
|
||||
</defs><rect width="64" height="64" rx="14" fill="url(#pdf-bg)"></rect><g filter="url(#soft-shadow)">
|
||||
<path d="M19 11h22l9 9v31a4 4 0 0 1-4 4H19a4 4 0 0 1-4-4V15a4 4 0 0 1 4-4z" fill="#fff"></path>
|
||||
<path d="M41 11v9h9z" fill="#ffd9d6"></path>
|
||||
<path d="M23 24h19" stroke="#d41627" stroke-width="4" stroke-linecap="round"></path>
|
||||
<path d="M23 34h14" stroke="#d41627" stroke-width="4" stroke-linecap="round" opacity="0.82"></path>
|
||||
<path d="M23 44h19" stroke="#d41627" stroke-width="4" stroke-linecap="round" opacity="0.64"></path>
|
||||
</g><style>@media (prefers-color-scheme: light) { :root { filter: none; } }
|
||||
@media (prefers-color-scheme: dark) { :root { filter: none; } }
|
||||
</style></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
21
public/site.webmanifest
Normal file
21
public/site.webmanifest
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "PDFTools",
|
||||
"short_name": "PDFTools",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
BIN
public/web-app-manifest-192x192.png
Normal file
BIN
public/web-app-manifest-192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
public/web-app-manifest-512x512.png
Normal file
BIN
public/web-app-manifest-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
Reference in New Issue
Block a user