diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 00000000..aafea82d --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,16 @@ +{ + "permissions": { + "allow": [ + "Bash(npm run docusaurus:*)", + "Bash(cat:*)", + "Bash(tree:*)", + "Bash(find:*)", + "Bash(timeout 3 grep:*)" + ], + "deny": [], + "ask": [], + "additionalDirectories": [ + "/mnt/c/Users/systo/git/Stirling-PDFNew/" + ] + } +} diff --git a/docs/Analytics-and-telemetry.md b/docs/Analytics-and-telemetry.md index a9aaaa4a..03628b45 100644 --- a/docs/Analytics-and-telemetry.md +++ b/docs/Analytics-and-telemetry.md @@ -82,7 +82,7 @@ PostHog analytics help us: ### What is Scarf? -[Scarf](https://scarf.sh) provides a simple tracking pixel (`pixel.stirlingpdf.com`) that collects basic, non‑personally identifiable information about Stirling‑PDF usage. +[Scarf](https://scarf.sh) provides a simple tracking pixel (`pixel.stirling.com`) that collects basic, non‑personally identifiable information about Stirling‑PDF usage. ### Data collected by Scarf @@ -259,7 +259,7 @@ If you're running Stirling‑PDF on your own infrastructure: If you have questions or concerns about analytics: -- Check our [Privacy Policy](https://www.stirlingpdf.com/privacy-policy) +- Check our [Privacy Policy](https://www.stirling.com/privacy-policy) - Review the [source code](https://github.com/Stirling-Tools/Stirling-PDF) - Ask questions on [Discord](https://discord.gg/HYmhKj45pU) - Open an issue on [GitHub](https://github.com/Stirling-Tools/Stirling-PDF/issues) diff --git a/docs/Configuration/Configuration.md b/docs/Configuration/Configuration.md new file mode 100644 index 00000000..a84cc2ad --- /dev/null +++ b/docs/Configuration/Configuration.md @@ -0,0 +1,237 @@ +--- +sidebar_position: 0 +slug: /Configuration +title: Configuration Guide +description: Configure Stirling-PDF using environment variables, settings files, or in-app settings +--- + +# Configuration Guide + +Stirling-PDF can be configured in three ways, depending on your deployment and preferences. + +## Configuration Methods + +### 1. In-App Settings (Recommended) + +If you have login enabled, admins can configure everything through the Settings menu in the application. + +**To use:** +1. Set `SECURITY_ENABLELOGIN=true` +2. Log in as admin +3. Go to Settings → configure through UI +4. Changes apply immediately, no restart needed + +**Best for:** Production deployments with admin users + +--- + +### 2. Environment Variables + +Configure via Docker environment variables or system environment variables. + +**To use:** +```bash +docker run -d \ + -e SECURITY_ENABLELOGIN=true \ + -e LANGS=en_GB \ + stirlingtools/stirling-pdf:latest +``` + +**Best for:** Docker deployments, infrastructure-as-code, initial setup + +--- + +### 3. Settings File (settings.yml) + +Edit `/configs/settings.yml` directly for advanced configuration. + +**To use:** +```yaml +security: + enableLogin: true +system: + defaultLocale: en-GB +``` + +**Best for:** Complex configurations, when you prefer file-based config + +--- + +## Common Settings + +### Authentication + +Enable user login: +```bash +SECURITY_ENABLELOGIN=true +SECURITY_INITIALLOGIN_USERNAME=admin +SECURITY_INITIALLOGIN_PASSWORD=changeme123 +``` + +Default credentials: `admin` / `stirling` (change immediately after first login) + +### Language & Localization + +```bash +LANGS=en_GB # Available languages +SYSTEM_DEFAULTLOCALE=en-GB # Default language +``` + +### Deployment Mode + +```bash +MODE=BOTH # Options: BOTH, FRONTEND, BACKEND +``` + +### File Upload Limits + +```bash +SYSTEM_MAXFILESIZE=2000 # MB +SPRING_SERVLET_MULTIPART_MAX_FILE_SIZE=2000MB +SPRING_SERVLET_MULTIPART_MAX_REQUEST_SIZE=2000MB +``` + +### Memory Management + +```bash +JAVA_TOOL_OPTIONS="-Xms512m -Xmx4g" # Min 512MB, Max 4GB RAM +``` + +--- + +## Specialized Configuration Guides + +For advanced features and specific use cases, see these detailed guides: + +### Authentication & Security + +**[Single Sign-On (SSO)](./Single%20Sign-On%20Configuration.md)** +- OAuth2 (Google, GitHub, Keycloak, OIDC) +- SAML2 (Okta, Azure AD) - Pro/Enterprise only +- Complete configuration examples + +**[System and Security](./System%20and%20Security.md)** +- Split deployment (frontend/backend separation) +- CORS configuration +- Server certificates +- JWT configuration + +**[Fail2Ban Integration](./Fail2Ban.md)** +- Protect against brute-force attacks +- Auto-ban after failed login attempts + +--- + +### Features & Customization + +**[UI Customization](./UI%20Customisation.md)** +- Branding and logos +- Theme customization +- Custom styling + +**[Endpoint/Feature Control](./Endpoint%20or%20Feature%20Customisation.md)** +- Enable/disable specific tools +- Control feature availability by user/role + +**[Pipeline (Automation)](./Pipeline.md)** +- Automated workflows +- Folder scanning +- Batch processing +- Multi-step operations + +--- + +### Integration & Storage + +**[External Database](./External%20Database.md)** +- PostgreSQL configuration (Pro/Enterprise) +- Database migration +- Backup strategies + +**[Google Drive File Picker](./Google%20Drive%20File%20Picker.md)** +- Direct Google Drive integration +- OAuth setup + +**[OCR Configuration](./OCR.md)** +- Tesseract language packs +- OCR optimization + +**[Usage Monitoring](./Usage%20Monitoring.md)** +- Prometheus metrics (Pro/Enterprise) +- Application monitoring +- Performance tracking + +--- + +### Other Configuration + +**[Folder Scanning](./FolderScanning.md)** +- Watch folders for automatic processing + +**[Custom Signature Files](./Sign%20with%20custom%20files.md)** +- Pre-loaded signatures for quick signing + +**[Extra Settings](./Extra-Settings.md)** +- Logging configuration +- Server settings (port, SSL/TLS) +- Advanced Spring Boot settings + +--- + +## Configuration Priority + +When the same setting is defined in multiple places, this is the order of precedence (highest to lowest): + +1. **Environment Variables** +2. **settings.yml / In-App Settings** +3. **Default values** + +--- + +## Environment Variable Format + +Convert YAML paths to environment variables: + +```yaml +# settings.yml +security: + enableLogin: true +``` + +Becomes: +```bash +SECURITY_ENABLELOGIN=true +``` + +**Rules:** +- Uppercase everything +- Replace `.` with `_` +- Nested properties become `PARENT_CHILD` + +--- + +## Troubleshooting + +### Settings Not Applied + +1. Check configuration priority (env vars override settings.yml) +2. Restart container after changing environment variables +3. Check logs: `docker logs stirling-pdf | grep ERROR` +4. Verify file permissions on `/configs` volume + +### Database Issues + +Default database location: `/configs/stirling-pdf-DB.mv.db` + +If missing: +- Ensure `/configs` volume is mounted +- Check write permissions +- Review startup logs + +--- + +## Next Steps + +- **Production Deployment:** See [Production Deployment Guide](../Server-Admin-Onboarding.md) +- **API Usage:** See [API Documentation](../API.md) +- **Tool Reference:** See [Functionality](../Functionality/Functionality.md) diff --git a/docs/Advanced Configuration/DATABASE.md b/docs/Configuration/DATABASE.md similarity index 100% rename from docs/Advanced Configuration/DATABASE.md rename to docs/Configuration/DATABASE.md diff --git a/docs/Configuration/Endpoint or Feature Customisation.md b/docs/Configuration/Endpoint or Feature Customisation.md new file mode 100644 index 00000000..7e800226 --- /dev/null +++ b/docs/Configuration/Endpoint or Feature Customisation.md @@ -0,0 +1,146 @@ +--- +sidebar_position: 6 +--- +# Endpoints Customisation + +You can selectively disable and remove endpoints and functionalities from Stirling PDF as per your requirements. +There are many use-cases for this such as +- Avoid confusion for users for functionality you/your business don't use. +- Running a reduced version of Stirling-PDF that doesn't have the necessary server power to support the more advanced features. +- Cleanup interface for features you don't use + + +To do this `ENDPOINTS_TOREMOVE` and `ENDPOINTS_GROUPSTOREMOVE` have been set up. +They can include comma-separated lists of endpoints and groups to disable. For example, `ENDPOINTS_TOREMOVE=merge,removePages` would disable both the "merge PDFs" and "remove pages" functionalities. +`ENDPOINTS_GROUPSTOREMOVE=LibreOffice` Would disable a group of endpoints, in this case all endpoints which use LibreOffice in the backend. + +## Available Endpoint Groups + +You can disable entire groups of related endpoints using `ENDPOINTS_GROUPSTOREMOVE`: + +| Group Name | What It Disables | Example | +|------------|------------------|---------| +| `LibreOffice` | All office document conversions (DOCX, XLSX, PPTX to/from PDF) | `ENDPOINTS_GROUPSTOREMOVE=LibreOffice` | +| `Python` | Python-based image processing features | `ENDPOINTS_GROUPSTOREMOVE=Python` | +| `OpenCV` | Advanced image processing operations | `ENDPOINTS_GROUPSTOREMOVE=OpenCV` | +| `OCRmyPDF` | OCR (Optical Character Recognition) features | `ENDPOINTS_GROUPSTOREMOVE=OCRmyPDF` | +| `Weasyprint` | HTML to PDF conversion | `ENDPOINTS_GROUPSTOREMOVE=Weasyprint` | +| `Calibre` | E-book format conversions | `ENDPOINTS_GROUPSTOREMOVE=Calibre` | +| `QPDF` | Various PDF operations powered by QPDF | `ENDPOINTS_GROUPSTOREMOVE=QPDF` | +| `Ghostscript` | PDF/A conversion and compression operations | `ENDPOINTS_GROUPSTOREMOVE=Ghostscript` | + +**Example - Disable multiple groups:** +```bash +ENDPOINTS_GROUPSTOREMOVE=LibreOffice,Calibre,Weasyprint +``` + +## Complete Tool ID Reference + +Use these exact tool IDs with `ENDPOINTS_TOREMOVE` to disable specific features: + +### Recommended Tools +- `multiTool` - Multi-tool workbench +- `merge` - Merge PDFs +- `compare` - Compare PDFs +- `compress` - Compress PDFs +- `convert` - Convert to/from PDF +- `ocr` - OCR processing +- `redact` - Redact information + +### Signing +- `certSign` - Certificate-based signing +- `sign` - Draw/text/image signature + +### Document Security +- `addPassword` - Add password protection +- `removePassword` - Remove password +- `watermark` - Add watermark +- `addStamp` - Add stamp +- `sanitize` - Remove harmful elements +- `flatten` - Flatten form fields +- `unlockPDFForms` - Unlock PDF forms +- `changePermissions` - Change document permissions + +### Verification +- `getPdfInfo` - Get PDF information +- `validateSignature` - Validate digital signature + +### Document Review +- `read` - PDF viewer and annotation +- `changeMetadata` - Change metadata +- `editTableOfContents` - Edit table of contents + +### Page Formatting +- `crop` - Crop pages +- `rotate` - Rotate pages +- `split` - Split PDFs +- `reorganizePages` - Reorganize pages +- `scalePages` - Scale pages +- `addPageNumbers` - Add page numbers +- `pageLayout` - Multi-page layout +- `bookletImposition` - Booklet imposition +- `pdfToSinglePage` - PDF to single page +- `addAttachments` - Add file attachments + +### Extraction +- `extractPages` - Extract pages +- `extractImages` - Extract images + +### Removal +- `removePages` - Remove pages +- `removeBlanks` - Remove blank pages +- `removeAnnotations` - Remove annotations +- `removeImage` - Remove images +- `removeCertSign` - Remove certificate signature + +### Automation +- `automate` - Automation workflows (Pipeline) +- `autoRename` - Auto-rename PDFs + +### Advanced Formatting +- `adjustContrast` - Adjust colors/contrast +- `repair` - Repair corrupted PDFs +- `scannerImageSplit` - Detect & split scanned photos +- `overlayPdfs` - Overlay PDFs +- `replaceColor` - Replace & invert colors +- `addImage` - Add image to PDF +- `scannerEffect` - Apply scanner effect + +### Developer Tools +- `showJS` - Show JavaScript in PDF +- `devApi` - API documentation link +- `devFolderScanning` - Folder scanning guide link +- `devSsoGuide` - SSO guide link +- `devAirgapped` - Air-gapped setup guide link + +## Usage Examples + +**Disable specific tools:** +```bash +# Docker Run +docker run -e ENDPOINTS_TOREMOVE=sign,watermark,addStamp stirlingtools/stirling-pdf:latest + +# Docker Compose +environment: + - ENDPOINTS_TOREMOVE=sign,watermark,addStamp +``` + +**Disable entire groups:** +```bash +# Disable all office conversions and OCR +ENDPOINTS_GROUPSTOREMOVE=LibreOffice,OCRmyPDF +``` + +**Combine both methods:** +```bash +# Disable groups AND specific tools +ENDPOINTS_GROUPSTOREMOVE=LibreOffice,Calibre +ENDPOINTS_TOREMOVE=sign,compare,multiTool +``` + +## Notes + +- Tool IDs are case-sensitive (use exact names from the reference above) +- Disabling a tool removes it completely from the UI and API +- Some tools may depend on others - test your configuration +- Changes require container restart to take effect diff --git a/docs/Advanced Configuration/External Database.md b/docs/Configuration/External Database.md similarity index 100% rename from docs/Advanced Configuration/External Database.md rename to docs/Configuration/External Database.md diff --git a/docs/Advanced Configuration/Extra-Settings.md b/docs/Configuration/Extra-Settings.md similarity index 100% rename from docs/Advanced Configuration/Extra-Settings.md rename to docs/Configuration/Extra-Settings.md diff --git a/docs/Advanced Configuration/Fail2Ban.md b/docs/Configuration/Fail2Ban.md similarity index 97% rename from docs/Advanced Configuration/Fail2Ban.md rename to docs/Configuration/Fail2Ban.md index 6670f6fd..464a91e6 100644 --- a/docs/Advanced Configuration/Fail2Ban.md +++ b/docs/Configuration/Fail2Ban.md @@ -27,7 +27,7 @@ Stirling-PDF logs failed authentication attempts to a log file which Fail2Ban mo ### Important Configuration Notes - The `enableLogin` setting must be set to `true` as Fail2Ban integration requires authentication to be active - When using Fail2Ban, set `loginAttemptCount` to `-1` to disable the built-in account locking mechanism and let Fail2Ban handle login attempt management -- For more details on security configuration options, refer to the [System and Security](/Advanced%20Configuration/System%20and%20Security) documentation +- For more details on security configuration options, refer to the [System and Security](./System%20and%20Security.md) documentation ## Configuration diff --git a/docs/Advanced Configuration/FolderScanning.md b/docs/Configuration/FolderScanning.md similarity index 94% rename from docs/Advanced Configuration/FolderScanning.md rename to docs/Configuration/FolderScanning.md index 61a3aee7..337a155f 100644 --- a/docs/Advanced Configuration/FolderScanning.md +++ b/docs/Configuration/FolderScanning.md @@ -6,7 +6,7 @@ title: Folder Scanning ## User Guide for Local Directory Scanning and File Processing -Folder scanning uses settings configured from our pipeline tool, it is advised you first read the [Pipeline Guide](/Advanced%20Configuration/Pipeline) +Folder scanning uses settings configured from our pipeline tool, it is advised you first read the [Pipeline Guide](./Pipeline.md) ### Setting Up Watched Folders - Create a folder where you want your files to be monitored. This is your 'watched folder'. @@ -16,7 +16,7 @@ Folder scanning uses settings configured from our pipeline tool, it is advised y ### Configuring Processing with JSON Files - In each directory you want processed (e.g., `./pipeline/watchedFolders/officePrinter`), include a JSON configuration file. -- This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them). This can be made, configured, and downloaded from the Stirling-PDF Pipeline interface. For JSON creation guide please see [Pipeline setup](/Advanced%20Configuration/Pipeline) +- This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them). This can be made, configured, and downloaded from the Stirling-PDF Pipeline interface. For JSON creation guide please see [Pipeline setup](./Pipeline.md) ### Automatic Scanning and Processing diff --git a/docs/Advanced Configuration/Google Drive File Picker.md b/docs/Configuration/Google Drive File Picker.md similarity index 100% rename from docs/Advanced Configuration/Google Drive File Picker.md rename to docs/Configuration/Google Drive File Picker.md diff --git a/docs/Advanced Configuration/OCR.md b/docs/Configuration/OCR.md similarity index 100% rename from docs/Advanced Configuration/OCR.md rename to docs/Configuration/OCR.md diff --git a/docs/Configuration/Other Customisations.md b/docs/Configuration/Other Customisations.md new file mode 100644 index 00000000..c2556f9d --- /dev/null +++ b/docs/Configuration/Other Customisations.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 13 +--- +# Other Customisations + +Stirling PDF offers various other customisation options, such as: + +### Defaulting Language +Default language selection via the `SYSTEM_DEFAULTLOCALE` environment variable. Accepted values include `de-DE`, `fr-FR`, `ar-AR` and all other languages codes that are within Stirling-PDFs current list. + +### Google Search Visibility (robots.txt) +Enable or disable search engine visibility with the `ALLOW_GOOGLE_VISIBILITY` variable. + +### Custom Root path +Redirect the root path of the application using `APP_ROOT_PATH`. +This is for changing websites like stirlingtools.com to instead host the interface at stirlingtools.com/`APP_ROOT_PATH` like stirlingtools.com/demo + +### Enable/Disable Analytics +Analytics can be enabled/disabled with ``SYSTEM_ENABLEANALYTICS`` or +```yaml +system: + enableAnalytics: 'true' +``` +In configs/Settings.yml diff --git a/docs/Configuration/Pipeline.md b/docs/Configuration/Pipeline.md new file mode 100644 index 00000000..c6fa4d39 --- /dev/null +++ b/docs/Configuration/Pipeline.md @@ -0,0 +1,592 @@ +--- +sidebar_position: 11 +id: Pipeline +title: Pipeline Automation (Automate) +description: Create automated multi-step PDF workflows with the Automate tool +--- + +# Pipeline Automation (Automate) + +**Tool ID:** `automate` + +Create powerful automated workflows that combine multiple PDF operations into sequential processes. The Automate tool (formerly called "Pipeline") lets you build, save, and reuse complex PDF processing workflows. + +:::info V2.0 Update - New "Automate" Feature +In V2.0, the pipeline frontend interface has been redesigned as the **"Automate"** feature with an improved user experience for creating and managing automation workflows. The backend pipeline system (JSON configuration and folder scanning) continues to work the same way. + +**What changed:** +- ✅ Backend pipeline processing - **No changes** +- ✅ JSON pipeline configurations - **Still work exactly the same** +- ✅ Folder scanning with pipelines - **Still works the same** +- 🆕 Frontend interface - **Now called "Automate" with better UX** + +If you have existing pipeline JSON files, they continue to work in V2.0's Automate feature. +::: + +--- + +## What is Pipeline Automation? + +Pipeline automation allows you to: +- **Chain operations** - Combine multiple PDF tools in sequence +- **Save workflows** - Reuse common operation sequences +- **Automate processing** - Process files automatically with folder scanning +- **Standardize procedures** - Ensure consistent processing across teams +- **Batch process** - Apply same workflow to multiple files + +Think of it as **"macros for PDFs"** - record your steps once, replay them unlimited times. + +--- + +## Why Use Pipelines? + +### Without Pipelines: +1. Upload PDF to Split tool → Download split files +2. Upload each split file to Watermark tool → Download watermarked files +3. Upload each watermarked file to Compress tool → Download final files +4. Repeat for every batch of documents 😫 + +### With Pipelines: +1. Create "Split-Watermark-Compress" pipeline once +2. Upload PDFs → Automatic processing → Download results +3. Reuse same pipeline for all future batches 🎉 + +**Time saved:** Minutes per file, hours per day! + +--- + +## Key Concepts + +### Operations +Individual PDF tools that perform specific tasks: +- Split, Merge, Compress, Watermark, etc. +- Each operation has configurable parameters +- Operations execute in the order you define + +### Pipeline +A sequence of operations with saved configurations: +- Named workflow (e.g., "Invoice Processing") +- Ordered list of operations +- Pre-configured settings for each operation +- Reusable across multiple files + +### Pipeline Configuration (JSON) +Text file that defines your pipeline: +- Lists operations in order +- Specifies parameters for each operation +- Can be shared, versioned, and backed up +- Human-readable and editable + +### Folder Scanning +Automated processing mode: +- Watch a folder for new files +- Automatically apply pipeline to new files +- Move processed files to output folder +- Unattended batch processing + +--- + +## Getting Started with Automate + +### Accessing the Automate Tool + +1. **From Home Page** + - Click "Automate" in Advanced Tools section + - Or search for "automate" or "pipeline" + +2. **Open Configuration Builder** + - Click "Configure Pipeline" button + - Pipeline builder interface opens + +--- + +## Building Your First Pipeline + +## Steps to Configure and Use Your Pipeline + +1. **Access Configuration** + - Upon entering the screen, click on the **Configure** button. + +2. **Enter Pipeline Name** + - Provide a name for your pipeline in the designated field. + +3. **Select Operations** + - Choose the operations for your pipeline (e.g., **Split Pages**), then click **Add Operation**. + +4. **Configure Operation Settings** + - Input the necessary settings for each added operation. Settings are highlighted in yellow if customization is needed. + +5. **Add More Operations** + - You can add and adjust the order of multiple operations. Ensure each operation's settings are customized. + +6. **Save Settings** + - Click **Save Operation Settings** after customizing settings for each operation. + +7. **Validate Pipeline** + - Use the **Validation** button to check your pipeline. A green indicator signifies correct setup; a pop-out error indicates issues. + +8. **Download Pipeline Configuration** + - To use the configuration for [folder scanning](./FolderScanning.md) (or save it for future use and re-upload it), download a JSON file in this menu. You can also pre-load it for future use by placing it in `/pipeline/defaultWebUIConfigs/`. It will then appear in the dropdown menu for all users to use. + +9. **Submit Files for Processing** + - If your pipeline is correctly set up, close the configure menu, input the files, and hit **Submit**. + +10. **Note on Web UI Limitations** + - The current web UI version does not support operations that require multiple different types of inputs, such as adding a separate image to a PDF. + +### Current Limitations + +- Cannot have more than one of the same operation. +- Cannot input additional files via UI. +- All files and operations run in serial mode. + +--- + +## Example Pipelines + +### Example 1: Invoice Processing +**Goal:** Process scanned invoices for archival + +**Pipeline Steps:** +1. **OCR** - Make invoices searchable + - Language: English + - Preserve formatting: Yes +2. **Crop** - Remove scanner edges + - Margins: 0.5 inches all sides +3. **Add Watermark** - Mark as processed + - Text: "PROCESSED [DATE]" + - Position: Bottom right + - Opacity: 50% +4. **Compress** - Reduce file size + - Level: Medium +5. **Add Password** - Secure documents + - Password: [configured per run] + +**Use Case:** Accounting department processing hundreds of invoices monthly + +--- + +### Example 2: Report Distribution +**Goal:** Prepare reports for external sharing + +**Pipeline Steps:** +1. **Remove Pages** - Remove internal pages + - Pages: 2,3 (remove cover sheets) +2. **Add Page Numbers** - Number all pages + - Position: Bottom center + - Format: "Page X of Y" +3. **Add Stamp** - Add "CONFIDENTIAL" stamp + - Position: Top right + - Color: Red +4. **Change Permissions** - Restrict editing + - Allow printing: Yes + - Allow editing: No +5. **Compress** - Optimize for email + - Level: High + +**Use Case:** Monthly reports sent to clients + +--- + +### Example 3: Document Standardization +**Goal:** Standardize format of received documents + +**Pipeline Steps:** +1. **Rotate** - Fix orientation + - Mode: Auto-detect +2. **Scale Pages** - Standardize to Letter size + - Target: 8.5 x 11 inches +3. **Add Metadata** - Tag documents + - Title: [Auto-extracted] + - Author: "Company Name" + - Keywords: "Standardized, Processed" +4. **Remove Annotations** - Clean markup +5. **Flatten** - Remove form fields + +**Use Case:** HR department standardizing employee submissions + +--- + +### Example 4: Batch Conversion +**Goal:** Convert and optimize image scans + +**Pipeline Steps:** +1. **Convert** - Images to PDF + - Source: JPG, PNG +2. **OCR** - Add text layer + - Language: Multiple +3. **Remove Blanks** - Delete empty pages + - Threshold: 95% +4. **Compress** - Optimize size + - Level: Medium +5. **PDF/A** - Convert for archival + - Version: PDF/A-2b + +**Use Case:** Digitization project for paper archives + +--- + +## Common Pipeline Patterns + +### Quality Enhancement Pipeline +**Pattern:** Improve scanned document quality +``` +OCR → Remove Blanks → Adjust Contrast → Compress → Add Metadata +``` + +### Security Pipeline +**Pattern:** Secure documents for distribution +``` +Remove Metadata → Add Watermark → Add Password → Change Permissions +``` + +### Compression Pipeline +**Pattern:** Reduce file sizes for storage/email +``` +Remove Annotations → Remove Images (optional) → Compress → Validate +``` + +### Branding Pipeline +**Pattern:** Add company branding to documents +``` +Add Watermark → Add Stamp → Add Page Numbers → Add Metadata +``` + +### Preparation Pipeline +**Pattern:** Prepare documents for printing +``` +Rotate → Scale Pages → Booklet Imposition → Remove Annotations +``` + +--- + +## Configuration + +### JSON Pipeline Format + +Basic structure of a pipeline configuration: + +```json +{ + "name": "My Pipeline", + "pipeline": [ + { + "operation": "split-pages", + "parameters": { + "splitType": "EVERY_N_PAGES", + "numberOfPagesPerSplit": 2 + } + }, + { + "operation": "compress-pdf", + "parameters": { + "compressionLevel": "MEDIUM" + } + } + ] +} +``` + +### Operation Names +Use these exact operation names in JSON: +- `split-pages`, `merge-pdfs`, `rotate-pdf` +- `compress-pdf`, `add-watermark`, `add-stamp` +- `ocr-pdf`, `add-password`, `remove-password` +- `crop`, `scale-pages`, `add-page-numbers` +- See [Endpoint Customisation](./Endpoint%20or%20Feature%20Customisation.md) for complete list + +### Parameter Configuration +Each operation has specific parameters: + +**Split Pages:** +```json +{ + "splitType": "EVERY_N_PAGES", // or "SPLIT_BY_SIZE", "BY_SECTIONS" + "numberOfPagesPerSplit": 5 +} +``` + +**Add Watermark:** +```json +{ + "watermarkText": "CONFIDENTIAL", + "fontSize": 36, + "opacity": 0.5, + "rotation": 45, + "position": "CENTER" +} +``` + +**Compress:** +```json +{ + "compressionLevel": "MEDIUM", // "LOW", "MEDIUM", "HIGH" + "optimizeImages": true +} +``` + +--- + +## Folder Scanning Setup + +Automate processing of files placed in watched folders. + +### How Folder Scanning Works + +1. **Watch Input Folder** - Monitor for new files +2. **Detect New Files** - Identify PDFs added to folder +3. **Apply Pipeline** - Process with configured pipeline +4. **Output Results** - Save to output folder +5. **Archive Originals** - Move processed files (optional) + +### Directory Structure + +``` +/pipeline/ + ├── watchedFolders/ + │ ├── invoice-processing/ + │ │ ├── input/ # Drop files here + │ │ ├── output/ # Results appear here + │ │ └── config.json # Pipeline configuration + │ └── report-prep/ + │ ├── input/ + │ ├── output/ + │ └── config.json + └── defaultWebUIConfigs/ # Pre-loaded pipelines for UI + ├── invoice.json + └── reports.json +``` + +### Configuration File + +Create `config.json` in each watched folder: + +```json +{ + "name": "Invoice Processing", + "pipeline": [...], // Your pipeline operations + "watchSchedule": "*/5 * * * *", // Every 5 minutes (cron format) + "deleteOriginal": false, // Keep original files + "archiveFolder": "./processed/" // Move originals here +} +``` + +### Cron Schedule Format + +``` +* * * * * +│ │ │ │ │ +│ │ │ │ └─ Day of week (0-7, 0 and 7 = Sunday) +│ │ │ └─── Month (1-12) +│ │ └───── Day of month (1-31) +│ └─────── Hour (0-23) +└───────── Minute (0-59) +``` + +**Examples:** +- `*/5 * * * *` - Every 5 minutes +- `0 * * * *` - Every hour +- `0 9 * * *` - Daily at 9 AM +- `0 9 * * 1` - Every Monday at 9 AM + +**Learn more:** [Folder Scanning Guide](./FolderScanning.md) + +--- + +## Best Practices + +### Pipeline Design + +1. **Test Incrementally** + - Build pipeline one operation at a time + - Test each step before adding the next + - Verify output at each stage + +2. **Order Operations Logically** + - Do OCR before text-based operations + - Remove pages before processing remaining pages + - Compress last to optimize final output + +3. **Use Descriptive Names** + - Name pipelines clearly: "Invoice-OCR-Watermark-Archive" + - Add descriptions in comments + - Version your pipeline files + +4. **Handle Errors Gracefully** + - Test with various file types + - Consider edge cases (empty PDFs, locked files) + - Monitor logs for errors + +### Performance Optimization + +1. **Minimize Operations** + - Combine similar operations when possible + - Remove unnecessary steps + - Don't duplicate efforts + +2. **Optimize Compression** + - Compress once at the end, not multiple times + - Choose appropriate compression level + - Balance quality vs. file size + +3. **Batch Intelligently** + - Group similar files together + - Process during off-peak hours + - Monitor system resources + +### Maintenance + +1. **Version Control** + - Keep pipeline JSONs in git repository + - Track changes over time + - Document modifications + +2. **Regular Review** + - Audit pipelines quarterly + - Remove unused pipelines + - Update for new requirements + +3. **Monitor Performance** + - Check processing times + - Review error logs + - Optimize slow operations + +--- + +## Troubleshooting + +### Pipeline Fails to Execute + +**Symptoms:** Pipeline starts but doesn't complete + +**Common Causes:** +- Invalid parameter values +- Unsupported file format +- Missing dependencies (OCR languages, fonts) +- File permissions issues + +**Solutions:** +1. Validate JSON configuration +2. Test each operation individually +3. Check server logs for errors +4. Verify required dependencies installed + +--- + +### Folder Scanning Not Working + +**Symptoms:** Files not processed automatically + +**Possible Issues:** +- Folder permissions incorrect +- Cron schedule not configured +- Pipeline configuration invalid +- Folder scanning not enabled + +**Solutions:** +1. Check folder permissions (read/write access) +2. Verify cron schedule format +3. Test pipeline manually first +4. Check `docker logs` for errors +5. Ensure folder scanning feature enabled + +--- + +### Operation Parameters Not Applying + +**Symptoms:** Pipeline runs but doesn't use specified settings + +**Causes:** +- Incorrect parameter names +- Wrong parameter data types +- Parameters not supported in operation + +**Solutions:** +1. Check parameter names match documentation +2. Verify parameter value types (string, number, boolean) +3. Review operation's available parameters +4. Test parameters manually first + +--- + +### Results Not as Expected + +**Symptoms:** Pipeline completes but output incorrect + +**Debugging Steps:** +1. Test each operation individually +2. Check intermediate outputs +3. Verify operation order makes sense +4. Review parameter values +5. Test with simpler input files + +--- + +## Pipeline vs. Multi-Tool vs. Manual + +### Use Pipeline/Automate When: +✅ Same workflow repeated frequently +✅ Predictable, consistent operations +✅ Automated folder processing needed +✅ No manual intervention required +✅ Standardizing team processes +✅ Large batch processing +✅ Scheduled/unattended processing + +### Use Multi-Tool When: +✅ Workflow varies per file +✅ Need visual feedback at each step +✅ Experimenting with different settings +✅ Manual decision points in workflow +✅ One-time complex tasks + +### Use Individual Tools When: +✅ Single, simple operation +✅ Quick one-off task +✅ Learning how operations work +✅ No need for automation + +--- + +## Security Considerations + +### Pipeline Files +- **Protect JSON configs** - May contain passwords or sensitive settings +- **Restrict folder access** - Limit who can create/modify pipelines +- **Review before deploying** - Audit pipelines for security issues + +### Folder Scanning +- **Isolate watched folders** - Don't expose to untrusted users +- **Monitor activity** - Log all processing for audit trail +- **Secure output folders** - Protect processed documents appropriately + +### Automated Processing +- **Validate inputs** - Ensure only expected files processed +- **Error handling** - Don't expose sensitive error messages +- **Resource limits** - Prevent resource exhaustion attacks + +--- + +## Related Documentation + +- **[Folder Scanning Setup](./FolderScanning.md)** - Detailed folder scanning guide +- **[Multi-Tool](../Functionality/Multi-Tool.md)** - Interactive multi-operation tool +- **[Endpoint Customisation](./Endpoint%20or%20Feature%20Customisation.md)** - Operation names and IDs +- **[API Documentation](../API.md)** - Programmatic pipeline execution +- **[Advanced Tools](../Functionality/Advanced-Tools.md)** - Other automation features + +--- + +## Summary + +Pipeline automation (Automate tool) transforms Stirling-PDF into a workflow engine: + +- 🔗 **Chain operations** - Combine multiple PDF tools sequentially +- 💾 **Save workflows** - Reusable pipeline configurations +- 📁 **Folder scanning** - Automated unattended processing +- 🎯 **Standardization** - Consistent processing across teams +- ⚡ **Efficiency** - Minutes saved per file, hours per day + +**Perfect for:** Repetitive workflows, batch processing, automated document preparation, and standardized procedures. + +Ready to automate? Create your first pipeline and transform how you process PDFs! diff --git a/docs/Advanced Configuration/Sign with custom files.md b/docs/Configuration/Sign with custom files.md similarity index 100% rename from docs/Advanced Configuration/Sign with custom files.md rename to docs/Configuration/Sign with custom files.md diff --git a/docs/Advanced Configuration/Single Sign-On Configuration.md b/docs/Configuration/Single Sign-On Configuration.md similarity index 100% rename from docs/Advanced Configuration/Single Sign-On Configuration.md rename to docs/Configuration/Single Sign-On Configuration.md diff --git a/docs/Configuration/System and Security.md b/docs/Configuration/System and Security.md new file mode 100644 index 00000000..dfefe771 --- /dev/null +++ b/docs/Configuration/System and Security.md @@ -0,0 +1,459 @@ +--- +sidebar_position: 2 +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Login, System and Security + +Stirling PDF allows customization of system and security settings. For security features to be enabled, you must use the security jar. For Docker users, this means setting `DISABLE_ADDITIONAL_FEATURES` to `false` via an environment variable. + +## Basic Security Settings + +- `enableLogin`: Enables or disables the login functionality +- `csrfDisabled`: Set to 'true' to disable CSRF protection (not recommended for production) +- `defaultLocale`: Set the default language (e.g. 'de-DE', 'fr-FR', etc) +- `googlevisibility`: 'true' to allow Google visibility (via robots.txt), 'false' to disallow + +## Authentication Setup + +### Prerequisites +1. Ensure the `/configs` directory is mounted as a volume in Docker for persistence across updates +2. For Docker users: Set `DISABLE_ADDITIONAL_FEATURES=false` in environment variables +3. Enable login either via `settings.yml` or set `SECURITY_ENABLELOGIN=true` + +### Initial Login Credentials +- Default Username: `admin` +- Default Password: `stirling` +- Note: Users will be forced to change their password on first login +- Custom initial credentials can be set using: + - `SECURITY_INITIALLOGIN_USERNAME` + - `SECURITY_INITIALLOGIN_PASSWORD` + +### Database Location +Upon successful setup, a new `stirling-pdf-DB-2.3.232.mv.db` file will be created in your configured storage location. This file contains user data and should be backed up regularly. + +### Account Management +1. Access Account Settings: + - Click the settings cog menu in the top right navbar + - Select "Account Settings" + - Here you can manage your profile and find your API key + +2. Adding New Users: + - Navigate to Account Settings + - Scroll to bottom and click 'Admin Settings' + - Use the user management interface to add new users + +### Role-Based Access Control +Currently, roles are primarily used for rate limiting purposes. The role system is under active development and will be expanded with additional features in future updates. + +### API Authentication +When using the API: +- Each user has a unique API key found in their Account Settings +- Include the API key in requests using the `X-API-KEY` header +- Example: + ``` + X-API-KEY: your-api-key-here + ``` + + +--- + +## Split Deployment Configuration + +Stirling-PDF supports separating frontend and backend for better scalability and deployment flexibility. + +### Deployment Modes + +Configure deployment mode via the `MODE` environment variable: + +| Mode | Description | Use Case | +|------|-------------|----------| +| `BOTH` | Frontend + Backend (default) | Single container deployment | +| `BACKEND` | Backend only | API service, split deployment | +| `FRONTEND` | Frontend only | Static frontend serving | + +### Frontend URL Configuration + +When using split deployment or load balancers, configure the frontend URL for generating links: + +```yaml +system: + frontendUrl: 'https://pdf.example.com' +``` + +**Environment Variable:** +```bash +SYSTEM_FRONTENDURL=https://pdf.example.com +``` + +**Use Cases:** +- Email invite links point to correct frontend +- Download links reference proper URL +- API responses include frontend URLs + +### CORS Configuration + +When frontend and backend are on different domains, enable CORS: + +```yaml +system: + corsAllowedOrigins: + - 'https://pdf.example.com' + - 'https://pdf-staging.example.com' +``` + +**Environment Variable:** +```bash +SYSTEM_CORSALLOWEDORIGINS=https://pdf.example.com,https://pdf-staging.example.com +``` + +**Security Best Practices:** +- Only specify trusted origins +- Never use wildcard (`*`) in production +- Always use HTTPS in production +- Keep list minimal + +**Learn more:** [Security - CORS](../Functionality/Security/Security.md#cors-configuration) + +--- + +## Server Certificates + +Stirling-PDF can auto-generate certificates for the "Sign with Stirling-PDF" feature. + +### Configuration + +```yaml +system: + serverCertificate: + enabled: true # Enable auto-generation + organizationName: Stirling-PDF # Certificate organization name + validity: 365 # Days until expiration + regenerateOnStartup: false # Keep same cert across restarts +``` + +**Environment Variables:** +```bash +SYSTEM_SERVERCERTIFICATE_ENABLED=true +SYSTEM_SERVERCERTIFICATE_ORGANIZATIONNAME="My Company" +SYSTEM_SERVERCERTIFICATE_VALIDITY=365 +SYSTEM_SERVERCERTIFICATE_REGENERATEONSTARTUP=false +``` + +### How It Works + +1. **First Startup:** Server generates self-signed certificate, stored in `/configs` directory +2. **Subsequent Startups:** Reuses existing certificate (unless `regenerateOnStartup: true`) +3. **User Signs:** PDFs signed using this certificate via "Sign with Stirling-PDF" option + +### Custom Certificates + +To use your own certificate instead: + +1. Place certificate in `/configs/keystore.p12` +2. Set `serverCertificate.enabled: false` +3. Provide password via `KEYSTORE_PASSWORD` environment variable + +**Learn more:** [Certificate Signing Guide](../Functionality/Security/Certificate-Signing.md) + +--- + +## Signature Validation + +Configure how PDF certificate signatures are validated. + +### Trust Sources + +```yaml +security: + validation: + trust: + serverAsAnchor: true # Trust server-generated certificates + useSystemTrust: true # Use OS certificate store + useMozillaBundle: true # Mozilla CA bundle + useAATL: false # Adobe Approved Trust List + useEUTL: false # EU Trusted List (eIDAS) +``` + +**Environment Variables:** +```bash +SECURITY_VALIDATION_TRUST_SERVERASANCHOR=true +SECURITY_VALIDATION_TRUST_USESYSTEMTRUST=true +SECURITY_VALIDATION_TRUST_USEMOZILLABUNDLE=true +SECURITY_VALIDATION_TRUST_USEAATL=false +SECURITY_VALIDATION_TRUST_USEEUTL=false +``` + +### Trust List URLs + +Configure external trust list locations: + +```yaml +security: + validation: + aatl: + url: https://trustlist.adobe.com/tl.pdf + eutl: + lotlUrl: https://ec.europa.eu/tools/lotl/eu-lotl.xml + acceptTransitional: false +``` + +### Revocation Checking + +Verify certificates haven't been revoked: + +```yaml +security: + validation: + revocation: + mode: none # Options: none, ocsp, crl, ocsp+crl + hardFail: false # Fail validation if revocation check fails +``` + +**Revocation Modes:** +- `none`: No revocation checking (not recommended for production) +- `ocsp`: Online Certificate Status Protocol (fast, requires network) +- `crl`: Certificate Revocation Lists (slower, works offline) +- `ocsp+crl`: Try OCSP first, fall back to CRL (recommended) + +**Environment Variables:** +```bash +SECURITY_VALIDATION_REVOCATION_MODE=ocsp+crl +SECURITY_VALIDATION_REVOCATION_HARDFAIL=false +``` + +### Authority Information Access (AIA) + +Allow automatic fetching of intermediate certificates: + +```yaml +security: + validation: + allowAIA: false # Set true to enable (requires network access) +``` + +**⚠️ Security Note:** Disabled by default. Only enable in controlled environments where outbound HTTPS is secure. + +**Learn more:** [Certificate Signing - Validation](../Functionality/Security/Certificate-Signing.md#validating-signatures) + +--- + +## JWT Authentication + +Configure JSON Web Token authentication for sessions. + +### JWT Settings + +```yaml +security: + jwt: + persistence: true # Store keys across restarts + enableKeyRotation: true # Rotate signing keys periodically + enableKeyCleanup: true # Auto-delete old keys + keyRetentionDays: 7 # How long to keep old keys +``` + +**Environment Variables:** +```bash +SECURITY_JWT_PERSISTENCE=true +SECURITY_JWT_ENABLEKEYROTATION=true +SECURITY_JWT_ENABLEKEYCLEANUP=true +SECURITY_JWT_KEYRETENTIONDAYS=7 +``` + +### What These Settings Do + +- **`persistence`**: Store JWT signing keys in database, survive container restarts +- **`enableKeyRotation`**: Periodically generate new signing keys for security +- **`enableKeyCleanup`**: Automatically delete old keys after retention period +- **`keyRetentionDays`**: Grace period where old keys still work (prevents immediate logout) + +### Migration from V1 + +If migrating from V1, note these setting name changes: +- `jwt.enabled` → `jwt.persistence` +- `jwt.keyCleanup` → `jwt.enableKeyCleanup` +- `jwt.secureCookie` → Removed (always secure in production) + +**Learn more:** [Migration - JWT Changes](../Migration/Settings-Changes.md#enhanced-jwt-configuration) + +--- + +## Email Configuration + +Configure SMTP for sending email invitations and notifications. + +### Email Invites + +Enable email-based user invitations: + +```yaml +mail: + enabled: true + enableInvites: true # Enable email invitations + smtp: + host: smtp.example.com + port: 587 + username: noreply@example.com + password: ${MAIL_PASSWORD} + tls: + enabled: true +``` + +**Environment Variables:** +```bash +MAIL_ENABLED=true +MAIL_ENABLEINVITES=true +MAIL_SMTP_HOST=smtp.gmail.com +MAIL_SMTP_PORT=587 +MAIL_SMTP_USERNAME=your-email@gmail.com +MAIL_SMTP_PASSWORD=your-app-password +MAIL_SMTP_TLS_ENABLED=true +``` + +**Requirements:** +- `mail.enabled: true` +- `security.enableLogin: true` +- Valid SMTP configuration +- `system.frontendUrl` configured (for invite links) + +--- + +## UI Customization + +### Logo Style + +Choose between logo styles: + +```yaml +ui: + logoStyle: classic # Options: 'classic' or 'modern' +``` + +**Environment Variable:** +```bash +UI_LOGOSTYLE=modern +``` + +**Styles:** +- `classic`: Traditional "S" icon logo +- `modern`: Minimalist design + +### Custom Logo + +You can also provide a custom logo file: + +```bash +customFiles/ + └── static/ + └── logo.svg # Your custom logo +``` + +**Learn more:** [UI Customisation](./UI%20Customisation.md) + +--- + +# Configuration Examples + + + + ```yaml + security: + enableLogin: false # set to 'true' to enable login + csrfDisabled: true + jwt: + persistence: true + enableKeyRotation: true + enableKeyCleanup: true + keyRetentionDays: 7 + validation: + trust: + serverAsAnchor: true + useSystemTrust: true + useMozillaBundle: true + revocation: + mode: ocsp + hardFail: false + + system: + defaultLocale: 'en-US' # Set the default language (e.g. 'de-DE', 'fr-FR', etc) + googlevisibility: false # 'true' to allow Google visibility (via robots.txt), 'false' to disallow + corsAllowedOrigins: [] # Add frontend URLs for split deployment + frontendUrl: '' # Set for split deployment + serverCertificate: + enabled: true + organizationName: Stirling-PDF + validity: 365 + + mail: + enabled: false + enableInvites: false + + ui: + logoStyle: classic + ``` + + + You can configure these settings in two ways when running locally: + + **Option 1: Using Java Properties** + ```bash + java -jar Stirling-PDF.jar -DDISABLE_ADDITIONAL_FEATURES=false -DSECURITY_ENABLELOGIN=true + ``` + + **Option 2: Using Environment Variables** + ```bash + export DISABLE_ADDITIONAL_FEATURES=false + export SECURITY_ENABLELOGIN=true + ``` + + + ```bash + -e DISABLE_ADDITIONAL_FEATURES=false \ + -e SECURITY_ENABLELOGIN=true \ + -e SYSTEM_CORSALLOWEDORIGINS=https://pdf.example.com \ + -e SYSTEM_FRONTENDURL=https://pdf.example.com \ + -e SECURITY_JWT_PERSISTENCE=true \ + ``` + + + ```yaml + environment: + DISABLE_ADDITIONAL_FEATURES: false + SECURITY_ENABLELOGIN: true + SYSTEM_CORSALLOWEDORIGINS: https://pdf.example.com + SYSTEM_FRONTENDURL: https://pdf.example.com + SECURITY_JWT_PERSISTENCE: true + SYSTEM_SERVERCERTIFICATE_ENABLED: true + ``` + + + **Backend Container:** + ```yaml + environment: + MODE: BACKEND + DISABLE_ADDITIONAL_FEATURES: false + SECURITY_ENABLELOGIN: true + SYSTEM_CORSALLOWEDORIGINS: https://pdf.example.com + SYSTEM_FRONTENDURL: https://pdf.example.com + ``` + + **Frontend Container:** + ```yaml + environment: + MODE: FRONTEND + VITE_API_BASE_URL: http://backend:8080 + ``` + + + +--- + +## Related Documentation + +- **[Security Features](../Functionality/Security/Security.md)** - PDF security tools, CORS, signature validation +- **[Certificate Signing](../Functionality/Security/Certificate-Signing.md)** - Comprehensive signing and validation guide +- **[Single Sign-On](./Single%20Sign-On%20Configuration.md)** - Enterprise authentication +- **[UI Customisation](./UI%20Customisation.md)** - Branding and appearance +- **[Migration Guide](../Migration/Settings-Changes.md)** - Upgrading from V1 diff --git a/docs/Configuration/UI Customisation.md b/docs/Configuration/UI Customisation.md new file mode 100644 index 00000000..bdf3b7e7 --- /dev/null +++ b/docs/Configuration/UI Customisation.md @@ -0,0 +1,121 @@ +--- +sidebar_position: 4 +tags: [UI, customisation, feature, advanced feature] +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# UI Customisation + +Stirling PDF allows straightforward customization of the application name and appearance to make Stirling-PDF your own. + +## Application Name Settings +These settings control the visible application name: +- `appName` - Defines the visible application name shown in the window name and navbar if navbar is not defined separately +- `homeDescription` - The description displayed on the homepage under the navbar that first greets the user +- `appNameNavbar` - The app name shown within the navbar for all pages + +## Show update notifications +These settings (in Settings.yml) control system behavior and customization capabilities: +- `showUpdate` - Controls whether update notifications are displayed +- `showUpdateOnlyAdmin` - When true, restricts update notifications to admin users only (requires `showUpdate: true`) + +## V2.0 UI Customization Notes + +### In-App Settings Management (V2.0+) + +**New in V2.0**: If you have login enabled and are logged in as an admin, you can now configure all settings directly in the application through the **Settings** menu. No need to edit `settings.yml` manually! + +**How to access:** +1. Enable login: `SECURITY_ENABLELOGIN=true` +2. Log in as an admin user +3. Navigate to **Settings** in the application +4. Configure all options through the UI +5. Changes apply immediately + +This is the recommended way to manage settings in V2.0 for production deployments. + +### Template Customization Changes + +**Important**: The V1 `customFiles/` folder system for overriding templates has been replaced with a new customization approach due to the UI framework change in V2.0. + +For advanced UI customization in V2.0: +1. Clone or download the repository +2. Modify the React components in the `frontend/src` directory +3. Build the frontend: `cd frontend && npm install && npm run build` +4. Volume mount the `frontend/dist` folder into your Docker container to replace the built-in frontend files + +Example docker-compose with custom frontend: +```yaml +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest + ports: + - '8080:8080' + volumes: + - ./frontend/dist:/app/frontend/dist # Mount your custom frontend + environment: + - MODE=BOTH +``` + +The following customizations work without rebuilding: +- Application name and branding (via environment variables or in-app settings) +- Update notification settings (via in-app settings if admin) +- Language settings (via in-app settings) +- Theme preferences (via in-app settings) + +## Configuration Examples + + + + ```yaml + ui: + appName: exampleAppName # Application's visible name + homeDescription: I am a description # Short description or tagline shown on homepage + appNameNavbar: navbarName # Name displayed on the navigation bar + + system: + showUpdate: false # Control update notification visibility + showUpdateOnlyAdmin: false # Restrict update notifications to admins + ``` + + + You can configure the UI and system settings in two ways when running locally: + + **Option 1: Using Java Properties** + ```bash + java -jar Stirling-PDF.jar \ + -DAPP_HOME_NAME="New Application Name" \ + -DSHOW_UPDATE=false \ + -DSHOW_UPDATE_ONLY_ADMIN=false + ``` + + **Option 2: Using Environment Variables** + ```bash + export UI_APPNAME="Stirling PDF" + export UI_HOMEDESCRIPTION="Your locally hosted one-stop-shop for all your PDF needs." + export UI_APPNAVBARNAME="Stirling PDF" + export SYSTEM_SHOWUPDATE=false + export SYSTEM_SHOWUPDATEONLYADMIN=false + ``` + + + ```bash + -e UI_APPNAME=Stirling PDF \ + -e UI_HOMEDESCRIPTION=Your locally hosted one-stop-shop for all your PDF needs. \ + -e UI_APPNAVBARNAME=Stirling PDF \ + -e SYSTEM_SHOWUPDATE=false \ + -e SYSTEM_SHOWUPDATEONLYADMIN=false + ``` + + + ```yaml + environment: + UI_APPNAME: Stirling PDF + UI_HOMEDESCRIPTION: Your locally hosted one-stop-shop for all your PDF needs. + UI_APPNAVBARNAME: Stirling PDF + SYSTEM_SHOWUPDATE: "false" + SYSTEM_SHOWUPDATEONLYADMIN: "false" + ``` + + diff --git a/docs/Configuration/Usage Monitoring.md b/docs/Configuration/Usage Monitoring.md new file mode 100644 index 00000000..119710e5 --- /dev/null +++ b/docs/Configuration/Usage Monitoring.md @@ -0,0 +1,123 @@ +--- +sidebar_position: 5 +title: Usage Monitoring +tags: [pro, enterprise, management, feature, advanced feature] +--- + +# Usage Monitoring +> **Tier**: Pro, Enterprise + +Stirling-PDF provides robust usage monitoring capabilities through its API, allowing you to track application usage patterns and performance metrics. + +## Non-Persistent Usage Monitoring API + +The following API endpoints are available to all users to monitor usage statistics. These endpoints provide non-persistent usage data that can be queried on demand. + +| Endpoint | Description | +|----------|-------------| +| `GET /api/v1/info/status` | Application status and version information | +| `GET /api/v1/info/requests` | Total count of POST requests for a specific endpoint (optional query parameter: `endpoint`) | +| `GET /api/v1/info/requests/unique` | Count of unique users for POST requests for a specific endpoint | +| `GET /api/v1/info/requests/all` | POST requests count for all endpoints | +| `GET /api/v1/info/requests/all/unique` | Unique users count for POST requests for all endpoints | +| `GET /api/v1/info/load` | Total count of GET requests for a specific endpoint (optional query parameter: `endpoint`) | +| `GET /api/v1/info/load/unique` | Count of unique users for GET requests for a specific endpoint | +| `GET /api/v1/info/load/all` | GET requests count for all endpoints | +| `GET /api/v1/info/load/all/unique` | Unique users count for GET requests for all endpoints | + +All endpoints return a JSON response with the requested statistics. + +## Enterprise Usage Monitoring + +> #### ⚠️ Enterprise Feature +> The `/usage` endpoint with graphical displays and the Prometheus integration are enterprise-only features. These features require both an enterprise license (`enterpriseEnabled: true`) and must be explicitly enabled in your configuration. + +### Usage Dashboard + +Enterprise license holders can access the enhanced usage monitoring dashboard at: + +``` +/usage +``` + +This dashboard provides graphical representations and detailed tables of the usage data, similar to the Endpoint Statistics interface shown in the documentation. + +## Prometheus Monitoring Configuration + +Stirling-PDF supports application metrics monitoring using Prometheus. This feature allows you to track application performance, usage patterns, and health metrics. + +### Prerequisites + +1. A valid Stirling-PDF enterprise license +2. Enterprise mode enabled in your configuration +3. Running with additional features enabled (DISABLE_ADDITIONAL_FEATURES=false) + +### Settings + +Stirling-PDF can be configured to use Prometheus monitoring by setting the `JAVA_CUSTOM_OPTS` environment variable. The application uses this variable to add custom Java options at runtime. + +Set the following environment variable in your deployment environment: + +```bash +JAVA_CUSTOM_OPTS="-Dmanagement.endpoints.web.exposure.include=prometheus,health,info -Dmanagement.endpoint.health.show-details=always -Dmanagement.metrics.export.prometheus.enabled=true -Denterprisemanagement.metrics.enabled=true" +``` + +This configures: +- Prometheus metrics endpoint exposure +- Health and info endpoints for basic monitoring +- Detailed health information +- Prometheus metrics export +- Enterprise metrics collection + +### Configuration in custom_settings.yml + +Alternatively, you can configure these settings in your `/configs/custom_settings.yml` file: + +```yaml +management: + endpoints: + web: + exposure: + include: prometheus,health,info + endpoint: + health: + show-details: always + metrics: + export: + prometheus: + enabled: true +enterprisemanagement: + metrics: + enabled: true +``` + +### Accessing Metrics + +Once configured, Prometheus metrics are available at the following endpoint: + +``` +https://your-stirling-pdf-instance/actuator/prometheus +``` + +This endpoint provides metrics in a format that can be scraped by a Prometheus server. + +### Configuring Prometheus Server + +Add the following job configuration to your Prometheus server's configuration file (`prometheus.yml`): + +```yaml +scrape_configs: + - job_name: 'stirling-pdf' + metrics_path: '/actuator/prometheus' + scrape_interval: 15s + static_configs: + - targets: ['your-stirling-pdf-host:port'] +``` + +### Available Metrics + +With Prometheus integration enabled, Stirling-PDF exposes the following types of metrics: +- **JVM metrics**: Memory usage, garbage collection, thread utilization +- **System metrics**: CPU usage, file descriptors +- **Application metrics**: Request rates, processing times +- **PDF processing metrics**: Document operations, conversion statistics \ No newline at end of file diff --git a/docs/Configuration/_category_.json b/docs/Configuration/_category_.json new file mode 100644 index 00000000..1369e116 --- /dev/null +++ b/docs/Configuration/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Configuration", + "position": 5 +} diff --git a/docs/Contribute.md b/docs/Contribute.md index 57e2955e..8c37925e 100644 --- a/docs/Contribute.md +++ b/docs/Contribute.md @@ -4,12 +4,71 @@ id: Contribute --- # Contribution guidelines -Thanks for taking a look at how to contribute to Stirling PDFs open-source codebase -Please checkout our GitHub documentation +Thanks for taking a look at how to contribute to Stirling PDFs open-source codebase! -## Adding/Update translations -See [How To Add New Language guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) +## Development Setup -## Wanting to contribute to our codebase +### Prerequisites +- Java 21 or later +- Node.js 18+ +- Docker (for testing) +- Gradle (included in repository) -See our [CONTRIBUTING guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) +### Getting Started + +1. **Clone the repository** + ```bash + git clone https://github.com/Stirling-Tools/Stirling-PDF.git + cd Stirling-PDF + ``` + +2. **Backend Development** + ```bash + # Build and run the Spring Boot backend + ./gradlew bootRun + # Backend runs on localhost:8080 + ``` + +3. **Frontend Development (V2.0+)** + ```bash + # Navigate to frontend directory + cd frontend + + # Install dependencies + npm install + + # Run development server + npm run dev + # Frontend runs on localhost:5173, proxies API calls to backend (localhost:8080) + ``` + +## Contributing to Code + +### Backend Contributions +- See our [CONTRIBUTING guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) +- Backend uses Spring Boot + Java +- Code formatting: Run `./gradlew spotlessApply` before committing + +### Frontend Contributions (V2.0+) +- Frontend is a React + TypeScript application +- Uses Vite for build tooling +- UI components: Mantine UI + TailwindCSS +- Adding new tools: See [ADDING_TOOLS.md](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/ADDING_TOOLS.md) +- Tool architecture: Uses `useToolOperation` hook pattern + +## Translation Contributions + +### V2.0 Translations (JSON) +Translation files are located in `frontend/public/locales/` +- **CRITICAL**: Always update translations in `en-GB` only, never `en-US` +- Files are organized by feature (e.g., `common.json`, `tools.json`) +- Use standard JSON format + +### Legacy Translations (Properties) +For V1.5 and backend translations: +- See [How To Add New Language guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) + +## Development Resources +- **API Documentation**: Access at `/swagger-ui/index.html` on your local instance +- **Developer Guide**: See `DeveloperGuide.md` in the repository +- **Claude Code Guide**: See `CLAUDE.md` for detailed architecture and patterns diff --git a/docs/FAQ.md b/docs/FAQ.md index 0fe60c58..549cde92 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -8,7 +8,7 @@ title: FAQ This is often caused by your NGINX configuration. NGINX's default file upload size is 1MB, and any file larger than this will cause an .htm file to be downloaded instead. To fix this issue, you should modify your NGINX configuration to increase the maximum file upload size. ### Q2: Can I customize the appearance and language of the Stirling PDF application? -Yes, Stirling PDF provides several environment variables to allow customization of the application, custom HTML, CSS and other settings such as the visibility to search engines. Please refer to the [UI Customisation](/Advanced%20Configuration/UI%20Customisation) section for more details. +Yes, Stirling PDF provides several environment variables to allow customization of the application, custom HTML, CSS and other settings such as the visibility to search engines. Please refer to the [UI Customisation](./Configuration/UI%20Customisation.md) section for more details. ### Q3: I want to add a new feature to Stirling PDF. How can I contribute? We welcome contributions from the community! Please open an issue on our GitHub page to discuss any large features before making any changes. Any small changes are fully welcome without discussion! After the feature has been discussed and approved, you can make the changes and submit a pull request. @@ -23,15 +23,20 @@ Please report any bugs or issues you encounter through our GitHub Issues page. B ### Q6: My Stirling-PDF Using high RAM at idle, How can I optimize memory usage? Stirling-PDF's memory usage can be optimized in several ways: -Disable security features: Set DOCKER_ENABLE_SECURITY=false to reduce RAM consumption. This can significantly lower memory usage, especially during idle periods. +Disable additional features: Set DISABLE_ADDITIONAL_FEATURES=true to reduce RAM consumption. This can significantly lower memory usage, especially during idle periods. Use the Ultra Lite version: Pull the latest-ultra-lite tag from Docker Hub or GitHub, which is specifically designed for lower-end hardware. -### Q7: I'm experiencing connection errors when pulling from docker.stirlingpdf.com +### Q7: I'm experiencing connection errors when pulling from docker.stirling.com If you experience connection issues, use these alternative endpoints: - Docker Hub: `docker pull stirlingtools/stirling-pdf:latest` - GitHub: `docker pull ghcr.io/stirling-tools/stirling-pdf:latest` -All endpoints provide the same functionality. \ No newline at end of file +All endpoints provide the same functionality. + +### Q8: Does Stirling-PDF track my data? + +No, we track no data without your explicit consent. You can see how, when, and why at our [Analytics and Telemetry](./analytics-telemetry) page. + diff --git a/docs/Functionality/Advanced-Tools.md b/docs/Functionality/Advanced-Tools.md new file mode 100644 index 00000000..8bf1b8b1 --- /dev/null +++ b/docs/Functionality/Advanced-Tools.md @@ -0,0 +1,386 @@ +--- +sidebar_position: 6 +id: Advanced-Tools +title: Advanced Tools +description: Power user features for automation and complex PDF operations +--- + +# Advanced Tools + +Advanced tools for power users, automation workflows, and complex PDF operations. These tools provide enhanced capabilities beyond standard PDF manipulation. + +--- + +## Automation Tools + +### Automate (Pipeline) + +**Tool ID:** `automate` + +Create sophisticated multi-step workflows that combine multiple PDF operations into automated sequences. + +#### What it does +- Chain multiple operations into automated workflows +- Save and reuse pipeline configurations +- Process files automatically with predefined steps +- Support for folder watching and automatic processing +- JSON-based configuration for advanced users + +#### Perfect for +- Repetitive multi-step PDF processing +- Automated document workflows +- Batch processing with consistent steps +- Integration with folder scanning +- Team workflow standardization + +#### Example Workflows +- **Document Processing:** Split → Add watermark → Compress → Archive +- **Invoice Processing:** OCR → Extract pages → Add metadata → Save +- **Report Generation:** Merge → Add page numbers → Add stamp → Export +- **Bulk Conversion:** Convert → Compress → Add password → Organize + +**📖 [Read the complete Pipeline Automation Guide →](../Configuration/Pipeline.md)** for detailed examples, JSON configuration, folder scanning setup, and best practices. + +--- + +### Auto Rename + +**Tool ID:** `autoRename` + +Automatically rename PDF files based on their content analysis. + +#### What it does +- Analyze PDF content to determine appropriate filename +- Extract title, header, or prominent text +- Use largest font text as filename +- Batch rename multiple PDFs at once +- Configurable naming rules + +#### Perfect for +- Organizing scanned documents +- Renaming downloaded PDFs with generic names +- Batch organizing document libraries +- Creating descriptive filenames automatically + +#### How it works +1. Upload one or more PDFs +2. Algorithm analyzes each PDF for: + - Document title in metadata + - Largest font text (likely the header/title) + - First prominent text on page 1 +3. Suggests filename based on findings +4. Option to review and modify suggestions +5. Batch rename and download + +#### Naming Strategy +The tool uses this priority order: +1. **PDF Metadata Title** (if present and meaningful) +2. **Largest Font Text** on first page +3. **First Heading** or prominent text +4. **First Line** of readable text + +#### Tips +- Works best with documents that have clear titles +- Scanned documents may need OCR first for better results +- Review suggestions before batch renaming +- Combine with OCR for scanned documents + +--- + +## Advanced Formatting Tools + +### Adjust Contrast + +**Tool ID:** `adjustContrast` + +Fine-tune brightness, contrast, and saturation of PDF content. + +#### What it does +- Adjust brightness levels +- Modify contrast for better readability +- Change saturation (color intensity) +- Apply adjustments to all pages or specific ranges +- Preview changes before applying + +#### Perfect for +- Improving readability of faded scans +- Enhancing poor quality scanned documents +- Adjusting over/under-exposed photos in PDFs +- Creating high-contrast versions for accessibility +- Fixing washed-out images + +--- + +### Repair + +**Tool ID:** `repair` + +Attempt to repair corrupted or damaged PDF files. + +#### What it does +- Fix structural PDF errors +- Recover content from damaged files +- Repair broken PDF streams +- Reconstruct missing elements +- Salvage readable content from corrupted PDFs + +#### Perfect for +- Opening PDFs that won't load +- Recovering important documents +- Fixing corrupted downloads +- Repairing files from failing storage +- Salvaging partially damaged files + +#### What it can fix +- Broken cross-reference tables +- Corrupted object streams +- Missing or damaged headers +- Truncated files +- Encoding errors + +#### Limitations +- Cannot recover physically deleted data +- May not work with heavily encrypted files +- Success depends on extent of corruption +- Some formatting may be lost in recovery + +--- + +### Scanner Image Split + +**Tool ID:** `scannerImageSplit` + +Automatically detect and split individual scanned photos from multi-image PDF scans. + +#### What it does +- Detect individual images/photos on pages +- Automatically separate them into individual files +- Useful for batch-scanned photo collections +- Crop and extract each image separately +- Support for various scan layouts + +#### Perfect for +- Separating batch-scanned photos +- Extracting individual images from collection scans +- Processing multi-photo scanner output +- Organizing photo digitization projects + +--- + +### Overlay PDFs + +**Tool ID:** `overlayPdfs` + +Merge multiple PDFs by layering them on top of each other. + +#### What it does +- Layer one PDF on top of another +- Position overlay precisely +- Control opacity/transparency +- Place content on foreground or background +- Apply to specific pages or all pages + +#### Perfect for +- Adding letterheads to documents +- Applying template backgrounds +- Watermarking with complex designs +- Creating layered composite documents +- Merging forms with filled data + +#### Overlay Options +- **Position:** Top, bottom, centered, custom coordinates +- **Mode:** Foreground or background +- **Opacity:** Full or partial transparency +- **Pages:** All pages, specific ranges, or alternating + +--- + +### Replace Color + +**Tool ID:** `replaceColor` + +Replace specific colors in a PDF or invert all colors. + +#### What it does +- Replace one color with another +- Invert all colors (create negative) +- Adjust color schemes +- Make PDFs printer-friendly +- Create dark mode versions + +#### Perfect for +- Creating negative images +- Changing color schemes for printing +- Making dark backgrounds light (and vice versa) +- Correcting color issues +- Accessibility improvements + +#### Options +- **Invert All:** Complete color negative +- **Replace Color:** Specify source and target colors +- **Threshold:** Control color matching sensitivity + +--- + +### Add Image + +**Tool ID:** `addImage` + +Add or overlay images onto PDF pages. + +#### What it does +- Insert images into PDFs +- Position images precisely +- Resize and scale images +- Add images to specific pages +- Support for various image formats + +#### Perfect for +- Adding logos to documents +- Inserting photos into reports +- Creating visual composites +- Adding signatures or stamps as images +- Enhancing documents with graphics + +--- + +### Scanner Effect + +**Tool ID:** `scannerEffect` + +Apply realistic scanner-like effects to PDFs to make them appear scanned. + +#### What it does +- Add authentic scan appearance +- Slight rotation/skew effects +- Simulate scanner artifacts +- Adjust for realistic paper texture +- Make digital documents look scanned + +#### Perfect for +- Making digital documents appear scanned +- Adding authenticity to digital forms +- Creating realistic-looking scans from digital content + +--- + +## Developer Tools + +These tools provide access to technical documentation and setup guides. + +### Show JavaScript + +**Tool ID:** `showJS` + +Display any embedded JavaScript code within a PDF document. + +#### What it does +- Extract and display all JavaScript from PDF +- Security analysis of PDF scripts +- Identify potentially harmful code +- Review PDF automation scripts +- Debug PDF form behaviors + +#### Perfect for +- Security auditing of PDFs +- Identifying malicious scripts +- Understanding PDF form logic +- Debugging interactive PDFs +- Compliance review + +--- + +### API Documentation + +**Tool ID:** `devApi` + +Quick link to complete API documentation for integrating Stirling-PDF into your applications. + +**Access:** [API Documentation](../API.md) + +--- + +### Folder Scanning Guide + +**Tool ID:** `devFolderScanning` + +Link to comprehensive guide for setting up automated folder scanning with pipelines. + +**Access:** [Folder Scanning Setup](../Configuration/FolderScanning.md) + +--- + +### SSO Configuration + +**Tool ID:** `devSsoGuide` + +Link to Single Sign-On (SSO) configuration guide for enterprise deployments. + +**Access:** [SSO Guide](../Configuration/Single%20Sign-On%20Configuration.md) + +--- + +### Air-gapped Setup + +**Tool ID:** `devAirgapped` + +Link to guide for deploying Stirling-PDF in offline/air-gapped environments. + +**Access:** [Configuration](../Configuration/Configuration.md) + +--- + +## When to Use Advanced Tools + +Use advanced tools when you need to: +- ✅ Automate repetitive multi-step PDF operations +- ✅ Fix corrupted or damaged PDF files +- ✅ Perform complex color or image manipulations +- ✅ Organize large document collections automatically +- ✅ Integrate PDF operations into existing workflows +- ✅ Audit PDFs for security concerns +- ✅ Create sophisticated document processing pipelines + +--- + +## Automation Best Practices + +### For Automate/Pipeline: +1. **Start simple** - Test with one operation, then add more +2. **Use test files** - Verify pipelines work before production use +3. **Save configurations** - Reuse successful workflows +4. **Document workflows** - Add descriptions to saved pipelines +5. **Monitor folder scanning** - Check logs for errors + +### For Auto Rename: +1. **Test first** - Run on small batches to verify naming +2. **Use OCR first** - For scanned documents without text layer +3. **Review suggestions** - Check names before batch applying +4. **Backup originals** - Keep copies with original names + +### For Advanced Formatting: +1. **Preview changes** - Always preview before applying +2. **Test on copies** - Work with duplicates of important files +3. **Incremental adjustments** - Make small changes and iterate +4. **Document settings** - Note successful parameters for reuse + +--- + +## Related Documentation + +- **[Recommended Tools](./Recommended-Tools.md)** - Most common operations +- **[Complete Tool Reference](./Functionality.md)** - All 60+ tools +- **[Pipeline Configuration](./Features%20Pipeline.md)** - Automation workflows +- **[API Documentation](../API.md)** - Programmatic access +- **[Configuration](../Configuration/Configuration.md)** - System setup + +--- + +## Tips for Power Users + +1. **Combine tools strategically** - Use Automate to chain operations +2. **Leverage folder scanning** - Set up watch folders for automatic processing +3. **Use API for integration** - Integrate with your existing systems +4. **Save pipeline configs** - Reuse proven workflows +5. **Monitor and optimize** - Review performance and adjust settings +6. **Share configurations** - Pre-load pipelines for team use diff --git a/docs/Functionality/Compare.md b/docs/Functionality/Compare.md new file mode 100644 index 00000000..af786497 --- /dev/null +++ b/docs/Functionality/Compare.md @@ -0,0 +1,423 @@ +--- +sidebar_position: 3 +id: Compare +title: Compare PDFs +description: Compare two PDF documents and highlight differences +--- + +# Compare PDFs + +**Tool ID:** `compare` + +Compare two PDF documents side-by-side and visually highlight the differences between them. Perfect for reviewing document revisions, finding changes in contracts, and quality assurance workflows. + +--- + +## What is PDF Comparison? + +PDF comparison analyzes two versions of a document and highlights: +- **Added content** - New text or elements in the newer version +- **Removed content** - Text or elements deleted from the original +- **Modified content** - Changes to existing text or formatting +- **Visual differences** - Layout or structural changes + +This is essential for document review, version control, and change tracking. + +--- + +## How to Use Compare + +1. **Upload Original PDF** - Select the original/older version +2. **Upload Modified PDF** - Select the new/revised version +3. **Configure Comparison** - Adjust comparison settings (optional) +4. **Compare** - Process the documents +5. **Review Differences** - View highlighted changes side-by-side +6. **Navigate Changes** - Jump between differences +7. **Export Results** - Download comparison report (optional) + +--- + +## Comparison Features + +### Side-by-Side View + +View both documents simultaneously: +- **Original on left** - The base document +- **Modified on right** - The revised document +- **Synchronized scrolling** - Both pages move together +- **Aligned pages** - Easy comparison of corresponding pages + +### Difference Highlighting + +Visual indicators for changes: +- **Green highlighting** - Added content +- **Red highlighting** - Removed content +- **Yellow highlighting** - Modified content +- **Color-coded markers** - Quick identification of change types + +### Navigation Tools + +Efficiently review changes: +- **Next/Previous buttons** - Jump between differences +- **Change counter** - See total number of changes +- **Page navigation** - Move through document pages +- **Zoom controls** - Examine details closely + +--- + +## Comparison Settings + +### Comparison Mode + +**Text Comparison:** +- Compare text content only +- Ignore formatting changes +- Focus on wording differences +- Fast and efficient + +**Visual Comparison:** +- Compare entire page appearance +- Detect layout changes +- Include images and graphics +- More comprehensive + +**Hybrid Mode:** +- Combine text and visual comparison +- Best of both approaches +- Recommended for most use cases + +### Sensitivity Settings + +**Strict Mode:** +- Highlight every small change +- Include whitespace differences +- Detect minor formatting +- Most detailed comparison + +**Normal Mode:** +- Ignore minor formatting +- Focus on content changes +- Skip insignificant whitespace +- Balanced approach (recommended) + +**Lenient Mode:** +- Only major differences +- Ignore styling changes +- Focus on substantial edits +- Quick overview + +### Ignore Options + +Customize what to ignore: +- **Whitespace** - Spaces, tabs, line breaks +- **Case sensitivity** - Uppercase vs lowercase +- **Formatting** - Font, size, color +- **Metadata** - Author, dates, properties + +--- + +## Use Cases + +### Contract Review + +**Before signing:** +1. Compare original contract with revised version +2. Verify all requested changes were made +3. Check for unexpected modifications +4. Document all differences + +**Best Practices:** +- Always compare final version before signing +- Save comparison report for records +- Review every highlighted change +- Consult legal counsel on significant changes + +### Document Versioning + +**Version control:** +1. Compare current version with previous +2. Track changes over time +3. Identify who changed what +4. Maintain change history + +**Workflow:** +- Version 1 → Version 2 comparison +- Document all revisions +- Create audit trail +- Archive comparison results + +### Quality Assurance + +**Proofreading workflow:** +1. Compare draft with edited version +2. Verify all edits were applied +3. Check for unintended changes +4. Ensure consistency + +**Use For:** +- Editorial review +- Translation verification +- Compliance checking +- Final approval process + +### Compliance & Legal + +**Regulatory requirements:** +1. Compare submitted documents +2. Verify no unauthorized changes +3. Create audit trail +4. Meet compliance standards + +**Legal Discovery:** +- Document tampering detection +- Change authentication +- Evidence preservation +- Forensic analysis + +--- + +## Comparison Report + +### Report Contents + +Generated comparison report includes: +- **Summary statistics** - Total changes, added, removed, modified +- **Change list** - Detailed list of all differences +- **Location references** - Page and position of each change +- **Timestamp** - When comparison was performed +- **Document metadata** - File names, versions, dates + +### Export Options + +**PDF Report:** +- Highlighted differences embedded +- Side-by-side or overlay view +- Annotations for each change +- Shareable document + +**JSON Export:** +- Machine-readable format +- Automation-friendly +- Complete difference data +- Integration with other tools + +**Text Summary:** +- Human-readable list +- Quick overview +- Copy/paste friendly +- Email-ready format + +--- + +## Best Practices + +### Before Comparing + +1. **Verify file names** - Ensure you have the correct versions +2. **Check file dates** - Confirm which is newer +3. **Review context** - Understand what changes to expect +4. **Choose settings** - Select appropriate comparison mode + +### During Comparison + +1. **Review systematically** - Check every highlighted change +2. **Take notes** - Document important differences +3. **Verify intent** - Ensure changes match expectations +4. **Check thoroughly** - Don't miss subtle changes + +### After Comparison + +1. **Save report** - Keep record of differences +2. **Document findings** - Note any concerns +3. **Take action** - Address unexpected changes +4. **Archive results** - Maintain audit trail + +--- + +## Common Comparison Scenarios + +### Scenario 1: Contract Negotiation + +**Context:** Client returned contract with changes + +**Process:** +1. Upload original contract +2. Upload client's version +3. Use "Text Comparison" mode +4. Review all red/green highlights +5. Verify each change is acceptable +6. Generate comparison report for records + +### Scenario 2: Translation Verification + +**Context:** Verify translated document matches original + +**Process:** +1. Upload original language version +2. Upload translation +3. Use "Visual Comparison" mode +4. Check layout consistency +5. Verify images and graphics match +6. Ensure no content was lost + +### Scenario 3: Revision Tracking + +**Context:** Multiple editors worked on document + +**Process:** +1. Compare Version 1 → Version 2 +2. Compare Version 2 → Version 3 +3. Track cumulative changes +4. Document all modifications +5. Create comprehensive change log + +--- + +## Tips & Tricks + +### Comparison Accuracy + +**For Best Results:** +- Use digital PDFs (not scanned) for text comparison +- Ensure both PDFs are same page size +- Use consistent PDF versions +- Avoid heavily compressed files + +**For Scanned Documents:** +- Run [OCR](./OCR.md) on both documents first +- Use visual comparison mode +- Expect some false positives +- Manually verify important changes + +### Handling Large Documents + +**Performance Tips:** +- Compare section by section if very large +- Use text mode for faster processing +- Close other applications +- Consider using desktop app for big files + +### False Positives + +**Common causes:** +- Different PDF generators +- Font embedding differences +- Compression variations +- Metadata changes + +**Solutions:** +- Use "Normal" sensitivity mode +- Ignore formatting differences +- Focus on content changes +- Manually verify ambiguous changes + +--- + +## Technical Details + +### Comparison Algorithm + +Stirling-PDF uses advanced comparison algorithms: +- **Text extraction** - Extract text from both PDFs +- **Diff algorithm** - Compute differences +- **Visual rendering** - Highlight changes +- **Alignment** - Match corresponding pages + +### Supported PDF Types + +**Works Best With:** +- ✅ Digital PDFs (not scanned) +- ✅ Text-based content +- ✅ Standard fonts +- ✅ Similar page layouts + +**Challenging Cases:** +- ⚠️ Scanned documents (use OCR first) +- ⚠️ Complex layouts +- ⚠️ Heavy graphics +- ⚠️ Different page sizes + +### Performance + +**Processing Time:** +- Text comparison: Fast (seconds) +- Visual comparison: Moderate (1-2 min) +- Large documents: May take longer + +**File Size Limits:** +- Browser: ~100-500 pages +- Desktop app: No practical limit + +--- + +## Limitations + +### What Comparison Can't Do + +**Not Detected:** +- Semantic changes (same words, different meaning) +- Subtle formatting that doesn't render differently +- Changes in embedded media +- Metadata-only changes (unless specifically enabled) + +**False Positives:** +- Different PDF generators may show differences +- Font rendering variations +- Compression artifacts +- Trivial whitespace changes + +### Workarounds + +**For Better Comparison:** +- Use same PDF generator when possible +- Standardize fonts across versions +- Use "Normal" sensitivity to reduce noise +- Manually verify critical sections + +--- + +## API Usage + +Compare PDFs programmatically via API: + +```bash +curl -X POST http://stirling-pdf:8080/api/v1/compare \ + -F "file1=@original.pdf" \ + -F "file2=@modified.pdf" \ + -F "mode=text" \ + -F "sensitivity=normal" \ + -o comparison-report.pdf +``` + +**Parameters:** +- `file1` - Original/older document +- `file2` - Modified/newer document +- `mode` - `text`, `visual`, or `hybrid` +- `sensitivity` - `strict`, `normal`, or `lenient` +- `outputFormat` - `pdf`, `json`, or `text` + +See [API Documentation](../API.md) for complete endpoint reference. + +--- + +## Related Tools + +- **[OCR](./OCR.md)** - Make scanned PDFs searchable before comparing +- **[Multi-Tool](./Multi-Tool.md)** - Compare as part of a workflow +- **[Redact](./Page-Operations/redact.md)** - Remove sensitive differences before sharing comparison +- **[Merge](./Page-Operations/Page-Operations.md)** - Combine comparison results with originals + +--- + +## Summary + +Stirling-PDF's Compare tool provides: + +✅ **Side-by-side comparison** - View both documents simultaneously +✅ **Visual highlighting** - Color-coded difference markers +✅ **Multiple modes** - Text, visual, or hybrid comparison +✅ **Customizable sensitivity** - Control detail level +✅ **Comparison reports** - Export results in multiple formats +✅ **Navigation tools** - Jump between changes efficiently + +Perfect for contract review, version control, quality assurance, and compliance workflows! diff --git a/docs/Functionality/Compress.md b/docs/Functionality/Compress.md new file mode 100644 index 00000000..88ff673e --- /dev/null +++ b/docs/Functionality/Compress.md @@ -0,0 +1,369 @@ +--- +sidebar_position: 4 +id: Compress +title: Compress PDF +description: Reduce PDF file size while maintaining quality +--- + +# Compress PDF + +**Tool ID:** `compress-pdf` + +Reduce PDF file size while maintaining acceptable quality for your needs. Stirling-PDF's compression tool optimizes images, removes unnecessary data, and applies various compression techniques to significantly reduce file sizes. + +--- + +## What is PDF Compression? + +PDF compression reduces file size by: +- Compressing embedded images +- Removing duplicate resources +- Optimizing fonts and content streams +- Removing unused or redundant data +- Downsampling high-resolution images + +**Important:** Compression is permanent. Always keep a backup of the original if you might need maximum quality later. + +--- + +## How to Use Compress + +1. **Upload Your PDF** - Select one or more PDFs to compress +2. **Choose Compression Level** - Select quality vs. size balance +3. **Configure Options** - Adjust advanced settings (optional) +4. **Compress** - Process the files +5. **Download** - Get your compressed PDFs + +--- + +## Compression Levels + +### Low Compression +- **Size Reduction:** ~10-30% +- **Quality:** Excellent - minimal quality loss +- **Best For:** + - Documents with important images + - Professional presentations + - Photos that need high quality + - Documents for printing + +**Use When:** You need smaller files but can't compromise on quality. + +### Medium Compression (Recommended) +- **Size Reduction:** ~30-60% +- **Quality:** Good - balanced quality/size tradeoff +- **Best For:** + - General documents + - Email attachments + - Web publishing + - Most use cases + +**Use When:** You want good file size reduction with acceptable quality. + +### High Compression +- **Size Reduction:** ~60-90% +- **Quality:** Fair - noticeable quality reduction +- **Best For:** + - Text-heavy documents + - Documents with simple graphics + - Archival storage where quality is secondary + - Very large documents that must be smaller + +**Use When:** File size is critical and quality is less important. + +### Custom Compression +- **Manual Control:** Set exact compression parameters +- **Advanced Users:** Fine-tune image DPI, quality, color depth +- **Testing:** Experiment to find optimal settings + +--- + +## Compression Options + +### Image Quality + +**Image DPI (Resolution):** +- **300 DPI** - High quality, suitable for printing +- **150 DPI** - Standard quality, good for screen viewing +- **72 DPI** - Low quality, very small files + +**Image Quality Percentage:** +- **90-100%** - Minimal compression, excellent quality +- **70-90%** - Balanced compression (recommended) +- **50-70%** - Aggressive compression, visible artifacts + +### Color Depth + +**Options:** +- **Full Color (24-bit)** - All colors preserved +- **Grayscale (8-bit)** - Convert to black/white shades +- **Monochrome (1-bit)** - Pure black and white only + +**Tip:** Convert color documents to grayscale if color isn't needed - can reduce size by 50%+. + +### Advanced Options + +**Optimize Images:** +- Compress and optimize all embedded images +- Downsample high-resolution images +- Remove image metadata + +**Remove Duplicate Resources:** +- Detect and remove duplicate images/fonts +- Significant savings for documents with repeated elements + +**Compress Content Streams:** +- Apply advanced compression to PDF content +- Optimize internal PDF structure + +**Remove Unused Objects:** +- Clean up leftover objects from editing +- Remove orphaned resources + +--- + +## What Gets Compressed? + +### Images +- JPEG images re-compressed at lower quality +- PNG images optimized and potentially converted +- High-resolution images downsampled +- Duplicate images removed + +### Fonts +- Subset fonts (include only used characters) +- Remove unused font data +- Optimize font embedding + +### Content +- Compress content streams with ZLIB/DEFLATE +- Optimize PDF structure +- Remove redundant data + +### Metadata +- Optionally remove or reduce metadata +- Remove thumbnail previews +- Strip editing history + +--- + +## Tips & Best Practices + +### Before Compressing + +1. **Keep a backup** - Compression is permanent +2. **Test on a copy** - Try different settings first +3. **Check file size** - Already compressed? May not reduce much +4. **Identify content type** - Text vs. images requires different approaches + +### Choosing Compression Level + +**For Text-Heavy Documents:** +- ✅ High compression works well +- ✅ Text quality remains excellent +- ✅ 70-90% size reduction common + +**For Image-Heavy Documents:** +- ⚠️ Start with medium compression +- ⚠️ Test before applying to batch +- ⚠️ 30-60% size reduction typical + +**For Mixed Content:** +- ✅ Medium compression (recommended) +- ✅ Test on sample pages +- ✅ 40-70% size reduction expected + +### After Compressing + +1. **Verify quality** - Open and review compressed PDF +2. **Check images** - Zoom in on important images +3. **Test printing** - If document will be printed +4. **Compare file sizes** - Ensure compression worked + +--- + +## Common Issues + +### "File not compressing much" + +**Possible Causes:** +- PDF already compressed +- Mostly text with few images +- Images already optimized + +**Solutions:** +- Try higher compression level +- Check if file is already compressed +- Some PDFs have minimal compression potential + +### "Quality too poor after compression" + +**Possible Causes:** +- Compression level too high +- Source images low quality +- DPI set too low + +**Solutions:** +- Reduce compression level +- Increase image DPI setting +- Use "Medium" or "Low" compression +- Keep original for high-quality needs + +### "Compression failed" + +**Possible Causes:** +- Corrupted PDF +- Encrypted/password-protected PDF +- Unusual PDF structure + +**Solutions:** +- Try repairing PDF first +- Remove password protection +- Try different compression settings + +--- + +## Batch Compression + +Compress multiple PDFs at once with consistent settings: + +1. **Upload Multiple Files** - Select multiple PDFs +2. **Choose Settings** - Apply same settings to all +3. **Process Batch** - Compress all files +4. **Download ZIP** - Get all compressed PDFs in one archive + +**Tip:** Test settings on one file first, then apply to batch. + +--- + +## Compression vs. File Size + +### Expected Results + +| Original Size | Compression Level | Expected Result | Typical Output | +|--------------|-------------------|-----------------|----------------| +| 50 MB | Low | ~10-30% | 35-45 MB | +| 50 MB | Medium | ~30-60% | 20-35 MB | +| 50 MB | High | ~60-90% | 5-20 MB | + +**Note:** Actual results vary based on content type (text vs. images) and whether file is already compressed. + +### Document Type Comparison + +**Scanned Documents (Image-heavy):** +- Excellent compression potential +- 60-90% reduction common with high compression +- Most benefit from compression + +**Digital PDFs (Text-heavy):** +- Moderate compression potential +- 20-40% reduction typical +- Already relatively small + +**Mixed Content:** +- Good compression potential +- 40-70% reduction expected +- Varies by image/text ratio + +--- + +## Technical Details + +### Compression Methods + +Stirling-PDF uses multiple compression techniques: + +**Image Compression:** +- JPEG compression for photos +- FLATE compression for graphics +- Downsampling for high-resolution images + +**Content Stream Compression:** +- ZLIB/DEFLATE algorithms +- Object stream compression +- Cross-reference stream compression + +**Structure Optimization:** +- Remove unused objects +- Deduplicate resources +- Optimize PDF structure + +### Processing Engine + +Uses **Apache PDFBox** and **ImageMagick** for compression: +- Industry-standard tools +- Proven reliability +- Wide format support + +--- + +## Use with Other Tools + +### Common Workflows + +**Scan → OCR → Compress** +1. Scan documents to PDF +2. [OCR](./OCR.md) to make searchable +3. Compress to reduce file size + +**Merge → Compress** +1. [Merge](./Page-Operations/Page-Operations.md) multiple PDFs +2. Compress combined document +3. Share smaller file + +**Convert → Compress** +1. [Convert](./Convert/Convert.md) images to PDF +2. Compress to optimize size +3. Email or upload + +**Edit → Compress → Archive** +1. Edit and modify PDFs +2. Compress for storage +3. Archive with smaller footprint + +--- + +## API Usage + +Compress PDFs programmatically via API: + +```bash +curl -X POST http://stirling-pdf:8080/api/v1/compress/pdf \ + -F "fileInput=@document.pdf" \ + -F "optimizeLevel=2" \ + -F "imageQuality=70" \ + -F "imageDpi=150" \ + -o compressed.pdf +``` + +**Parameters:** +- `optimizeLevel` - 0 (low), 1 (medium), 2 (high) +- `imageQuality` - 1-100 (percentage) +- `imageDpi` - Target DPI for images +- `fastWebView` - Optimize for web streaming + +See [API Documentation](../API.md) for complete endpoint reference. + +--- + +## Related Tools + +- **[OCR](./OCR.md)** - Make searchable before compressing +- **[Convert](./Convert/Convert.md)** - Convert formats before compressing +- **[Multi-Tool](./Multi-Tool.md)** - Chain compression with other operations +- **[Merge](./Page-Operations/Page-Operations.md)** - Combine then compress + +--- + +## Summary + +Stirling-PDF's Compress tool provides: + +✅ **Significant size reduction** - 10-90% smaller files +✅ **Quality control** - Choose your size/quality balance +✅ **Batch processing** - Compress multiple files at once +✅ **Smart optimization** - Multiple compression techniques +✅ **Flexible options** - Fine-tune for your needs +✅ **API access** - Automate compression workflows + +Perfect for reducing email attachment sizes, optimizing storage, and speeding up file transfers! diff --git a/docs/Functionality/Content-Editing/Content-Editing.md b/docs/Functionality/Content-Editing/Content-Editing.md new file mode 100644 index 00000000..1a77761e --- /dev/null +++ b/docs/Functionality/Content-Editing/Content-Editing.md @@ -0,0 +1,112 @@ +--- +sidebar_position: 5 +id: Content-Editing +title: Content & Editing +description: Add, extract, and modify PDF content +--- +# Features - Content & Editing + +Tools for adding, extracting, and modifying content within PDF documents. + +--- + +## Images + +- `add-image`: Add image files to your PDF documents. Insert logos, photos, or graphics with customizable position, size, and opacity. + +- `extract-images`: Extract all images from a PDF document. Saves each image as a separate file in common formats (PNG, JPG, etc). + +- `extract-image-scans`: Extract scanned images from PDF files. Specifically designed for PDFs containing scanned documents or photos. + +--- + +## Stamps & Annotations + +- `add-stamp`: Add user-defined text or image stamps to PDF pages with customizable position, size, rotation, and opacity. Can be applied to specific pages or all pages. Perfect for approval stamps, confidential markings, or custom branding. + +- `remove-annotations`: Remove all annotations, comments, and markup from a PDF document while preserving the original content. Useful for creating clean versions of reviewed documents. + +--- + +## Visual Editing + +- `replace-color`: Replace specific colors in a PDF or invert all colors. Useful for creating negative images, changing color schemes, or making documents printer-friendly. + +--- + +## Metadata & Information + +- `change-metadata`: Change the metadata of a PDF, including author name, title, subject, keywords, creation date, and more. Essential for document organization and compliance. + +- `get-info-on-pdf`: Extract and display comprehensive information about a PDF including: + - PDF version and file size + - Page count and dimensions + - Fonts used + - Security settings and permissions + - Complete metadata + - Export all information in JSON format for automation + +--- + +## Tips & Use Cases + +### Working with Images + +**Adding Images:** +- Use for logos, signatures, or decorative elements +- Position precisely with drag-and-drop +- Adjust transparency to blend with document + +**Extracting Images:** +- Pull images from PDFs for reuse +- Extract scanned photos +- Batch extract from multiple documents + +### Stamps & Branding + +**Common Stamp Uses:** +- "APPROVED" / "CONFIDENTIAL" markers +- Company logos on every page +- Date/time stamps +- Custom approval workflows + +**Pre-configured Stamps:** +- Configure common stamps for quick access +- Team-wide stamp templates +- Consistent branding across documents + +### Color Management + +**Replace Color Uses:** +- Convert dark backgrounds to white (printer-friendly) +- Create negative images +- Change brand colors +- Fix color issues in scanned documents + +**Invert Colors:** +- Create dark mode versions +- Photography negative effects +- Improve readability + +### Metadata Management + +**Why Metadata Matters:** +- Document organization and searchability +- Compliance requirements (author, date) +- Version tracking +- Legal discovery + +**Metadata Best Practices:** +- Set author/title for all documents +- Use keywords for searchability +- Include creation date +- Remove sensitive metadata before sharing + +--- + +## Related Tools + +- **[OCR](../OCR.md)** - Make scanned images searchable before extracting text +- **[Compress](../Compress.md)** - Reduce file size after adding images +- **[Security](../Security/Security.md)** - Add watermarks or sanitize metadata +- **[Multi-Tool](../Multi-Tool.md)** - Chain content editing with other operations diff --git a/docs/Functionality/Content-Editing/_category_.json b/docs/Functionality/Content-Editing/_category_.json new file mode 100644 index 00000000..3904dbfb --- /dev/null +++ b/docs/Functionality/Content-Editing/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Content & Editing", + "position": 5, + "link": { + "type": "doc", + "id": "Functionality/Content-Editing/Content-Editing" + } +} diff --git a/docs/Functionality/Convert/Convert.md b/docs/Functionality/Convert/Convert.md index d839c273..a1da4468 100644 --- a/docs/Functionality/Convert/Convert.md +++ b/docs/Functionality/Convert/Convert.md @@ -1,34 +1,289 @@ --- sidebar_position: 2 -description: List of all conversion related features +description: Convert files to and from PDF format --- -# Features - Convert -## To PDF +# Convert -- `img-to-pdf`: This functionality allows users to convert images into PDF documents. +Stirling-PDF's Convert tool provides powerful file format conversion with support for 50+ file types. Convert documents, images, web pages, and more to PDF, or export PDFs to other formats. -- `file-to-pdf`: This feature converts various file formats (like DOCX, XLSX, etc.) into PDF. +--- + +## How to Use Convert + +1. **Select Source Format** - Choose what you're converting from (e.g., Word, Image, PDF) +2. **Select Target Format** - Choose what you're converting to (e.g., PDF, JPG, DOCX) +3. **Upload Files** - Add one or multiple files depending on the conversion +4. **Configure Options** - Adjust settings like image quality, color mode, layout +5. **Convert** - Process and download your converted files + +--- + +## Supported Conversions + +### Convert TO PDF + +#### Office Documents +- **Word** - DOCX, DOC, ODT → PDF +- **Excel** - XLSX, XLS, ODS → PDF +- **PowerPoint** - PPTX, PPT, ODP → PDF +- **Text** - TXT, RTF → PDF + +#### Images +- **Formats** - JPG, JPEG, PNG, GIF, BMP, TIFF, WEBP, SVG → PDF +- **Multiple Images** - Combine multiple images into one PDF +- **Options:** + - Color mode (color, grayscale, black & white) + - Fit to page or maintain aspect ratio + - Single PDF or separate files + +#### Web Content +- **HTML to PDF** - Convert HTML files (with CSS and images via ZIP) +- **URL to PDF** - Render and save web pages as PDF +- **Markdown to PDF** - Convert Markdown (.md) files to formatted PDF + +#### Email +- **EML to PDF** - Convert email files (.eml format) into PDF +- Preserves email content, formatting, and metadata + +#### Comic Book Archives +- **CBZ to PDF** - Convert Comic Book Zip files to PDF +- **CBR to PDF** - Convert Comic Book RAR files to PDF + +--- + +### Convert FROM PDF + +#### Office Formats +- **PDF to Word** - PDF → DOCX, ODT + - Editable documents with preserved layout + - Best for text-heavy PDFs + - Works better with digital PDFs than scanned ones + +- **PDF to PowerPoint** - PDF → PPTX, ODP + - Each page becomes a slide + - Useful for presentations + +- **PDF to Text** - PDF → TXT, RTF, MD (Markdown) + - Extract plain text + - Remove formatting + - Easy to edit and search -- `html-to-pdf`: Converts HTML files (And their includes css and images if provided via zip) into a PDF file +#### Images +- **PDF to Image** - PDF → PNG, JPG, GIF, TIFF, BMP, WEBP +- **Options:** + - Image format and quality + - DPI (resolution) + - Color mode (color, grayscale, black & white) + - Single image or one per page -- `url-to-pdf`: Renders a URL and converts it to PDF +#### Data Formats +- **PDF to CSV** - Extract tables from PDF to CSV + - ⚠️ Works best with digital PDFs (not scanned) + - Attempts to detect tables automatically + - Work in progress feature due to complexity -- `markdown-to-pdf`: Converts a markdown (.md) file to PDF +- **PDF to HTML** - Convert PDF to web format + - Preserves structure and formatting + - Can be edited with HTML editors -## From PDF -- `pdf-to-img`: This feature converts PDF documents into image files. +- **PDF to XML** - Convert PDF to XML structure + - For data processing and analysis -- `pdf-to-word`: This feature allows users to convert PDF documents into Word files. +#### Archival Format +- **PDF to PDF/A** - Convert to long-term archival format + - PDF/A is ISO standardized + - Ensures long-term readability + - Required for compliance in many industries -- `pdf-to-presentation`: With this feature, users can convert PDFs into presentation formats like PPT. +#### Comic Book Archives +- **PDF to CBZ** - Convert PDF to Comic Book Zip +- **PDF to CBR** - Convert PDF to Comic Book RAR + +--- + +## Conversion Options + +### Image Quality Settings + +**When converting to images:** +- **DPI (Resolution)** + - 72 DPI - Screen viewing, small file size + - 150 DPI - Standard quality, balanced + - 300 DPI - High quality, printing, large file size + - Custom - Specify exact DPI + +- **Color Mode** + - **Color** - Full color, best quality + - **Grayscale** - Black and white shades, smaller file + - **Black & White** - 1-bit, smallest file, sharp text + +### Layout Options + +**When converting images to PDF:** +- **Fit to Page** - Resize image to fit PDF page +- **Maintain Aspect Ratio** - Keep original proportions +- **Fill Page** - Stretch to fill entire page + +**Output Mode:** +- **Single PDF** - All files into one PDF +- **Separate PDFs** - One PDF per input file + +--- + +## Batch Conversion + +Convert multiple files at once: + +1. Select conversion type (e.g., Images to PDF) +2. Upload multiple files +3. Choose "Single PDF" or "Separate PDFs" +4. Convert all at once +5. Download as single file or ZIP + +**Supported for:** +- Multiple images to PDF +- Multiple Office documents to PDF +- PDF to multiple images (one per page) + +--- -- `pdf-to-text`: This feature enables users to extract text from a PDF by converting it to a text file. +## Tips & Best Practices + +### For Best Results + +**Office to PDF:** +- Use original source files (DOCX, not scanned) +- Check fonts are embedded +- Verify hyperlinks work +- Test on sample first for large documents + +**PDF to Office:** +- Works best with digital PDFs (not scanned images) +- For scanned PDFs, use OCR first +- Complex layouts may need manual adjustment +- Check formatting after conversion + +**Image Conversions:** +- Higher DPI = better quality but larger files +- Use PNG for screenshots (lossless) +- Use JPG for photos (smaller) +- Grayscale reduces file size significantly + +**Web to PDF:** +- URLs must be publicly accessible +- For HTML files, include CSS/images in ZIP +- Test with simple pages first +- May timeout on very heavy pages + +### Common Issues + +**"Conversion failed"** +- Check file isn't corrupted +- Try smaller file first +- Ensure format is supported +- Check file isn't password-protected + +**"Poor quality output"** +- Increase DPI for image exports +- Use color mode instead of black/white +- Check source file quality +- Try different output format + +**"Tables not detected" (PDF to CSV)** +- Feature works best with simple tables +- Only works with digital PDFs, not scanned +- Consider extracting as text first +- Manual cleanup may be needed + +--- + +## Technical Details + +### Processing Engine + +Stirling-PDF uses industry-standard tools for conversions: + +- **Office Conversions** - LibreOffice (document fidelity) +- **Image Processing** - ImageMagick, OpenCV +- **PDF Operations** - Apache PDFBox +- **OCR** - Tesseract (when needed) + +### Supported Formats + +**Input Formats (Convert TO PDF):** +``` +Documents: DOCX, DOC, ODT, XLSX, XLS, ODS, PPTX, PPT, ODP, TXT, RTF +Images: JPG, JPEG, PNG, GIF, BMP, TIFF, WEBP, SVG +Web: HTML, ZIP (HTML bundle), Markdown (MD), URL +Email: EML +Archives: CBZ, CBR +``` + +**Output Formats (Convert FROM PDF):** +``` +Documents: DOCX, ODT, PPTX, ODP, TXT, RTF, MD +Images: PNG, JPG, GIF, TIFF, BMP, WEBP +Data: CSV, HTML, XML +Archive: PDF/A, CBZ, CBR +``` + +### File Size Limits + +- **Web Version** - Depends on browser storage (typically ~1-10GB) +- **Desktop App** - No practical limit (disk space) +- **Server Deployment** - Configurable in settings + +**For large files:** +- Use Desktop app for unlimited storage +- Split large PDFs before converting +- Process in batches +- Consider compression after conversion + +--- + +## Related Tools + +- **[Compress](../Compress.md)** - Reduce file size after conversion +- **[OCR](../OCR.md)** - Make scanned PDFs searchable before converting to text +- **[Merge](../Page-Operations/Page-Operations.md)** - Combine multiple converted PDFs +- **[Multi-Tool](../Multi-Tool.md)** - Chain conversions with other operations + +--- + +## API Usage + +Convert files programmatically via API: + +**Example: Image to PDF** +```bash +curl -X POST http://stirling-pdf:8080/api/v1/convert/img/pdf \ + -F "fileInput=@image.jpg" \ + -F "colorType=color" \ + -F "fitOption=maintainAspectRatio" \ + -o output.pdf +``` + +**Example: PDF to Word** +```bash +curl -X POST http://stirling-pdf:8080/api/v1/convert/pdf/word \ + -F "fileInput=@document.pdf" \ + -o output.docx +``` + +See [API Documentation](../../API.md) for complete endpoint reference. + +--- -- `pdf-to-html`: This functionality allows users to convert PDFs into HTML format. +## Summary -- `pdf-to-xml`: This feature enables users to convert PDFs into XML files. +Stirling-PDF's Convert tool provides: -- `pdf-to-pdfa`: This feature transforms PDF files into PDF/A format for long-term archiving. +✅ **50+ file format conversions** +✅ **Batch processing** - Convert multiple files at once +✅ **Quality control** - Adjust DPI, color mode, layout +✅ **Professional results** - Industry-standard conversion engines +✅ **No size limits** - Desktop app handles any file size +✅ **API access** - Automate conversions -- `pdf-to-csv`: This feature Tries to detect tables within a PDF which can be exported, This only works with digital PDFs not scanned and is a Work in progress feature due to its complexity +Perfect for document management, archiving, sharing, and workflow automation! diff --git a/docs/Functionality/Features Pipeline.md b/docs/Functionality/Features Pipeline.md index 7b77dd2b..02341151 100644 --- a/docs/Functionality/Features Pipeline.md +++ b/docs/Functionality/Features Pipeline.md @@ -1,11 +1,15 @@ --- sidebar_position: 5 -description: Pipeline Feature overview +description: Pipeline and Automate Feature overview --- -# Features - Pipeline +# Features - Pipeline / Automate -The Pipeline feature in Stirling PDF enables automated, sequential processing of PDFs through multiple operations. This powerful automation tool allows you to: +:::info V2.0 Update +In V2.0, the pipeline feature's frontend interface has been renamed to **"Automate"** with an improved user experience. All backend functionality remains the same - existing pipeline JSON files work without changes. +::: + +The Pipeline/Automate feature in Stirling PDF enables automated, sequential processing of PDFs through multiple operations. This powerful automation tool allows you to: - `create-pipeline`: Create custom workflows combining multiple PDF operations into a single automated process. For example, you could create a pipeline that: - Splits a PDF @@ -27,8 +31,8 @@ The Pipeline feature in Stirling PDF enables automated, sequential processing of - Ability to save and load pipeline configurations For detailed information on setting up and using pipelines, see: -- [Pipeline Configuration Guide](/Advanced%20Configuration/Pipeline) -- [Folder Scanning Guide](/Advanced%20Configuration/Folder%20Scanning) +- [Pipeline Configuration Guide](../Configuration/Pipeline.md) +- [Folder Scanning Guide](../Configuration/FolderScanning.md) ## Current Limitations diff --git a/docs/Functionality/Functionality.md b/docs/Functionality/Functionality.md new file mode 100644 index 00000000..11646e43 --- /dev/null +++ b/docs/Functionality/Functionality.md @@ -0,0 +1,117 @@ +--- +sidebar_position: 0 +slug: /functionality +id: Functionality +title: PDF Tools +description: Explore 60+ PDF tools for all your document needs +--- + +# PDF Tools + +Stirling-PDF provides **60+ powerful PDF tools** organized by category. Find the tool you need below. + +--- + +## 🌟 Most Popular + +The tools you'll use most often: + +- **[Multi-Tool](./Multi-Tool.md)** - Upload once, chain unlimited operations +- **[Read & Annotate](./Read-and-Annotate.md)** - PDF viewer with annotations +- **Merge** - Combine multiple PDFs +- **[Convert](./Convert/Convert.md)** - 50+ format conversions +- **[Compress](./Compress.md)** - Reduce file size +- **[OCR](./OCR.md)** - Make scanned PDFs searchable +- **[Compare](./Compare.md)** - See differences between PDFs +- **Redact** - Remove sensitive content + +**[View Recommended Tools Guide →](./Recommended-Tools.md)** + +--- + +## 📚 Tools by Category + +### 🔐 [Security](./Security/Security.md) +Password protection, signatures, permissions, watermarks + +- Add/Remove Password +- Change Permissions +- **[Sign](./Security/Sign.md)** - Handwritten signatures +- **[Certificate Sign](./Security/Certificate-Signing.md)** - Digital signatures +- Validate Signature +- Add Watermark +- Sanitize PDF +- Auto-Redact + +--- + +### 📑 [Page Operations](./Page-Operations/Page-Operations.md) +Split, merge, rotate, extract, reorganize pages + +- Split PDF +- Merge PDFs +- Rotate Pages +- Extract Pages +- Reorganize Pages +- Add Page Numbers +- Remove Pages/Blank Pages + +**Detailed Guide:** [Redaction](./Page-Operations/redact.md) + +--- + +### 🔄 [Convert](./Convert/Convert.md) +Convert to/from PDF - 50+ file formats supported + +**To PDF:** Word, Excel, PowerPoint, Images, HTML, Markdown, Email, and more + +**From PDF:** Word, PowerPoint, Text, Images, CSV, HTML, XML, PDF/A, and more + +--- + +### 🎨 [Content & Editing](./Content-Editing/Content-Editing.md) +Add, extract, and modify PDF content + +- Add/Extract Images +- Add Stamp +- Edit Metadata +- Remove Annotations +- Replace Colors +- Get PDF Info + +--- + +## ⚡ Advanced Features + +### 🎨 Super Tools +- **[Multi-Tool](./Multi-Tool.md)** - Workbench for chaining operations +- **[Read & Annotate](./Read-and-Annotate.md)** - PDF viewer with annotations +- **[OCR](./OCR.md)** - Make scanned PDFs searchable +- **[Compress](./Compress.md)** - Reduce file size +- **[Automate (Pipeline)](../Configuration/Pipeline.md)** - Workflow automation + +### 🔧 [Advanced Tools](./Advanced-Tools.md) +- Add Background/Stamp +- Booklet Imposition +- Overlay PDFs +- Multi-Page Layout +- Scale Pages +- Show JavaScript +- PDF Info (JSON) + +--- + +## 🔍 Quick Tool Finder + +**I want to...** +- Reduce file size → **[Compress](./Compress.md)** +- Make searchable → **[OCR](./OCR.md)** +- Combine files → **Merge** +- Split into parts → **Split** +- Convert format → **[Convert](./Convert/Convert.md)** +- Add signature → **[Sign](./Security/Sign.md)** or **[Certificate Sign](./Security/Certificate-Signing.md)** +- Remove content → **Redact** or **Sanitize** +- Edit pages → **Reorganize Pages** or **[Multi-Tool](./Multi-Tool.md)** +- Chain operations → **[Multi-Tool](./Multi-Tool.md)** +- Automate workflow → **[Automate](../Configuration/Pipeline.md)** + diff --git a/docs/Functionality/Multi-Tool.md b/docs/Functionality/Multi-Tool.md new file mode 100644 index 00000000..d74d39bb --- /dev/null +++ b/docs/Functionality/Multi-Tool.md @@ -0,0 +1,439 @@ +--- +sidebar_position: 7 +id: Multi-Tool +title: Multi-Tool Workbench +description: Chain multiple PDF operations together without re-uploading files +--- + +# Multi-Tool Workbench + +**Tool ID:** `multiTool` + +Multi-Tool is Stirling-PDF's page editor workspace. Upload your PDFs and manipulate pages visually - rotate, reorder, delete, and split pages with an intuitive interface. + +:::tip V2.0 Feature +Multi-Tool takes advantage of browser file storage, allowing you to upload files once and work with them across multiple page operations without re-uploading. +::: + +--- + +## What is Multi-Tool? + +Multi-Tool is a page manipulation workspace where you can: +- Upload PDFs and see thumbnail previews of every page +- Rotate pages individually or in batches +- Reorder pages by dragging them into position +- Delete unwanted pages +- Split PDFs by marking page breaks +- Undo/redo all changes before exporting + +--- + +## Key Features + +### 📁 Persistent File Storage +Files stay in your browser's local storage throughout your session: +- Upload once, use many times +- No re-uploading between operations +- Files persist even when switching tools +- Clear storage when done for privacy + +### 📄 Page Manipulation +Powerful page-level editing: +- Rotate pages individually or in batches +- Drag-and-drop page reordering +- Delete unwanted pages +- Split PDFs at marked positions + +### 👁️ Visual File Management +See what you're working with: +- Thumbnail previews of all PDFs +- File names and sizes displayed +- Quick file selection + +### ⏮️ Undo/Redo Support +Made a mistake? No problem: +- Undo operations to previous versions +- Redo changes you undid +- Version history tracking +- Jump to any previous state + +### 🎯 Focused Workspace +Everything in one place: +- Clean, uncluttered interface +- Tool settings sidebar +- File preview area +- Results management + +--- + +## How to Use Multi-Tool + +### Getting Started + +1. **Open Multi-Tool** + - Click "Multi-Tool" from the home page (in Recommended Tools) + - Or navigate to it from the tools menu + +2. **Upload Your Files** + - Drag and drop PDFs into the workspace + - Or click to browse and select files + - Upload one or multiple PDFs as needed + +3. **Select a Tool** + - Click the tool selector/menu + - Browse or search for the operation you need + - Tool opens in the sidebar with its settings + +4. **Configure and Process** + - Adjust tool-specific settings + - Select which files to process + - Click "Process" or "Apply" + +5. **Continue Working** + - Result is added to your workspace + - Original file preserved (unless you choose to replace) + - Select another tool to continue + - Build your workflow step by step + +--- + +## Common Workflows + +### Example 1: Document Preparation +**Goal:** Prepare a scanned document for distribution + +1. **Upload** your scanned PDF +2. **OCR** → Make it searchable +3. **Crop** → Remove scanner edges +4. **Compress** → Reduce file size +5. **Add Watermark** → Brand the document +6. **Download** → Save final version + +**Time saved:** No re-uploading between 5 operations! + +--- + +### Example 2: Multi-Document Merger +**Goal:** Combine and enhance multiple PDFs + +1. **Upload** multiple PDF files +2. **Merge** → Combine into one document +3. **Add Page Numbers** → Number all pages +4. **Add Table of Contents** → Improve navigation +5. **Add Password** → Secure the result +6. **Download** → Final protected document + +**Benefit:** All files managed in one workspace + +--- + +### Example 3: Experimentation +**Goal:** Find the best compression settings + +1. **Upload** your PDF +2. **Compress** with low settings → Check quality +3. **Undo** → Return to original +4. **Compress** with medium settings → Compare +5. **Undo** → Try again +6. **Compress** with high settings → Find best balance +7. **Download** preferred version + +**Advantage:** Undo/redo lets you compare results easily + +--- + +### Example 4: Batch Processing +**Goal:** Apply same operations to multiple files + +1. **Upload** 10 PDF files +2. **Rotate** → Fix orientation on all +3. **Crop** → Remove margins from all +4. **Add Watermark** → Brand all documents +5. **Download All** → Get processed batch + +**Efficiency:** Process entire batch without individual uploads + +--- + + +## File Management + +### Adding Files +- **Drag and Drop:** Easiest method - drag PDFs into workspace +- **Browse:** Click "Add Files" or upload button +- **From Previous Operation:** Results automatically added to workspace + +### Organizing Files +- **Select:** Click to select files for specific operations +- **Multi-Select:** Hold Ctrl/Cmd to select multiple files + +### Removing Files +- **Individual:** Click X or delete button on file thumbnail +- **Clear All:** Use "Clear Files" button to remove everything +- **Auto-Clear:** Files clear when you close the browser (configurable) + +### Storage Information +- **Used Space:** See how much browser storage you're using +- **Remaining Space:** Check available space +- **Per-File Size:** Each file shows its size +- **Total Size:** See total workspace usage + +--- + +## Workspace Features + +### File Previews +- **Thumbnails:** First page thumbnail for each PDF +- **Quick Preview:** Click thumbnail for larger preview +- **Page Count:** Shows number of pages per file +- **File Info:** See file size and last modified time + +### Settings and Options +- **Tool Settings:** Configure each operation's parameters +- **Apply to Selected:** Process only selected files +- **Apply to All:** Process entire workspace +- **Batch Mode:** Process multiple files with same settings + +--- + +## Best Practices + +### 1. Organize Before Starting +- Name your files descriptively before uploading +- Group related files together +- Plan your workflow sequence + +### 2. Work Progressively +- Start with one file to test settings +- Apply same settings to batch once confirmed +- Build complexity gradually + +### 3. Use Undo Liberally +- Try different settings and compare +- Don't worry about mistakes +- Experiment freely with undo safety net + +### 4. Manage Storage +- Clear completed projects regularly +- Download important results immediately +- Monitor storage usage indicator +- Use desktop app for unlimited storage + +### 5. Save Intermediate Results +- Download important intermediate versions +- Don't rely on browser storage long-term +- Clear files before closing on shared computers + +### 6. Leverage File Persistence +- Upload all related files at once +- Use them across multiple operations +- Avoid re-uploading unnecessarily + +--- + +## Tips and Tricks + +### Speed Up Your Workflow +- **Quick Tool Switch:** Use search to find tools quickly +- **Favorite Tools:** Frequently used tools appear first +- **Batch Operations:** Select multiple files and process at once +- **Undo/Redo:** Use toolbar buttons to revert or reapply changes + +### Avoid Common Issues +- **Storage Full:** Clear old files before uploading large PDFs +- **Lost Files:** Download important results before clearing storage +- **Performance:** Close and reopen Multi-Tool if it becomes slow +- **Browser Refresh:** Save work before refreshing (files may clear) + +### Advanced Techniques +- **Version Branching:** Keep multiple versions to try different approaches +- **Quality Comparison:** Compress at different levels and compare +- **Template Workflows:** Develop standard sequences for repetitive tasks +- **Batch Consistency:** Use same settings across document sets + +--- + +## Multi-Tool vs. Individual Tools vs. Automate + +### Use Multi-Tool When: +✅ Working with multiple related operations +✅ Need flexibility to adjust on the fly +✅ Experimenting with different settings +✅ Want visual feedback at each step +✅ Processing a few files with various operations + +### Use Individual Tools When: +✅ Single, simple operation needed +✅ Quick one-off task +✅ Don't need file persistence +✅ Processing one file, one time + +### Use Automate When: +✅ Same workflow repeated frequently +✅ Predictable, consistent operations +✅ Automated folder processing +✅ No manual intervention needed +✅ Large batch processing + +--- + +## Browser Storage and Privacy + +### How It Works +- Files stored in your browser's **local IndexedDB** +- Data never leaves your device until you process +- Only you can access your stored files +- Storage is per-domain (isolated from other sites) + +### Storage Limits +Typical browser limits: +- **Chrome/Edge:** ~10GB or 60% of available disk space +- **Firefox:** ~10GB +- **Safari:** ~1GB (more restrictive) + +### Privacy Controls +- **Clear on Exit:** Configure browser to clear data on close +- **Manual Clear:** Use "Clear Files" button anytime +- **Incognito Mode:** Storage cleared when window closes +- **Desktop App:** Full offline privacy, unlimited storage + +### Security Notes +- Files are **not encrypted** in browser storage +- Don't store highly sensitive documents long-term +- Use desktop app for sensitive work +- Clear storage on shared/public computers + +--- + +## Troubleshooting + +### Files Disappeared +**Possible Causes:** +- Browser cleared storage automatically +- You clicked "Clear Files" +- Browser data was cleared manually +- Switched to incognito mode + +**Solutions:** +- Check Downloads folder (you may have saved them) +- Use desktop app for persistent storage +- Enable "persistent storage" in browser settings + +--- + +### Out of Storage Space +**Symptoms:** Can't upload new files, error messages + +**Solutions:** +1. Clear old/completed projects +2. Download and delete large files +3. Use desktop app for large projects +4. Compress files before uploading + +--- + +### Multi-Tool Running Slowly +**Symptoms:** Lag, freezing, slow response + +**Solutions:** +1. Clear unused files from workspace +2. Close other browser tabs +3. Restart browser +4. Use desktop app for better performance +5. Reduce number of files in workspace + +--- + +### Can't Find a Tool +**Symptoms:** Tool missing from Multi-Tool + +**Possible Reasons:** +- Tool has dedicated interface (Compare, Automate, Sign) +- Tool has been disabled by administrator +- Search for tool name to locate it + +--- + +## Desktop App vs. Browser Multi-Tool + +### Browser Multi-Tool +**Pros:** +- No installation needed +- Access from any device +- Automatic updates +- Web-based convenience + +**Cons:** +- Storage limits (~1-10GB) +- Files may be cleared +- Requires internet for processing +- Browser-dependent performance + +### Desktop App Multi-Tool +**Pros:** +- Unlimited storage +- True persistent files +- Completely offline capable +- Native performance +- Files in your file system + +**Cons:** +- Requires installation +- Device-specific +- Manual updates + +**Recommendation:** Desktop app for serious work, browser for quick tasks + +--- + +## Related Documentation + +- **[Recommended Tools](./Recommended-Tools.md)** - Other frequently used tools +- **[Automate (Pipeline)](./Features%20Pipeline.md)** - Automated workflows +- **[Complete Tool Reference](./Functionality.md)** - All available tools +- **[Desktop App Installation](../Installation/Windows.md)** - Get unlimited storage + +--- + +## Frequently Asked Questions + +### Can I save my Multi-Tool workspace? +Not directly, but you can: +- Download all processed files +- Use Automate to save operation sequences +- Desktop app keeps files in your file system + +### How long are files stored? +- Until you manually clear them +- Until browser storage is cleared +- Until browser closes (if configured that way) +- Desktop app: indefinitely in your file system + +### Can I access files from another device? +No, browser storage is device-specific. Options: +- Download files and transfer them +- Use cloud storage between devices +- Self-host Stirling-PDF on your network + +### Does Multi-Tool work offline? +- **Browser:** No, requires server connection for processing +- **Desktop App:** Yes, completely offline capable + +### Can I process multiple files at once? +Yes! Select multiple files and most operations will process them in batch. + +--- + +## Summary + +Multi-Tool is your **PDF command center** in Stirling-PDF V2: +- 📁 Upload once, use everywhere +- 🔄 Chain unlimited operations +- ⏮️ Undo/redo for experimentation +- 👁️ Visual file management +- 🚀 Efficient multi-step workflows + +**Perfect for:** Complex PDF tasks, multi-step operations, batch processing, and exploratory work. + +Ready to supercharge your PDF workflow? Open Multi-Tool and experience the V2 difference! diff --git a/docs/Functionality/OCR.md b/docs/Functionality/OCR.md new file mode 100644 index 00000000..ad2d3c95 --- /dev/null +++ b/docs/Functionality/OCR.md @@ -0,0 +1,330 @@ +--- +sidebar_position: 5 +id: OCR +title: OCR (Optical Character Recognition) +description: Make scanned PDFs searchable and editable with OCR +--- + +# OCR (Optical Character Recognition) + +**Tool ID:** `ocr-pdf` + +Make scanned PDFs searchable and editable by recognizing text in images. Stirling-PDF's OCR tool uses Tesseract OCR engine to extract text from image-based PDFs and convert them into searchable, selectable documents. + +--- + +## What is OCR? + +OCR (Optical Character Recognition) is technology that recognizes text within images and converts it into actual, selectable text. This makes scanned documents searchable, editable, and accessible. + +### When You Need OCR + +- Scanned paper documents (no text layer) +- Photos of documents or whiteboards +- Screenshots of text +- Image-only PDFs +- PDFs where you can't select or search text + +--- + +## How to Use OCR + +1. **Upload Your PDF** - Select a scanned or image-based PDF +2. **Select Language(s)** - Choose the language(s) in your document +3. **Configure Options** - Adjust OCR settings (optional) +4. **Process** - Run OCR on the document +5. **Download** - Get your searchable PDF + +--- + +## Language Support + +Stirling-PDF supports OCR in **100+ languages** including: + +### Common Languages +- **English** - eng +- **Spanish** - spa +- **French** - fra +- **German** - deu +- **Italian** - ita +- **Portuguese** - por +- **Russian** - rus +- **Chinese (Simplified)** - chi_sim +- **Chinese (Traditional)** - chi_tra +- **Japanese** - jpn +- **Korean** - kor +- **Arabic** - ara +- **Hindi** - hin +- **Dutch** - nld +- **Polish** - pol +- **Turkish** - tur +- **Vietnamese** - vie +- **Thai** - tha + +### Multiple Languages + +If your document contains multiple languages, you can select multiple language packs for better accuracy. + +**Example:** A document with English and Spanish text should have both `eng` and `spa` selected. + +--- + +## OCR Options + +### Layout Preservation + +**Options:** +- **Preserve Original Layout** - Maintains original page structure, formatting, and layout +- **Simple Text Layer** - Adds searchable text without preserving complex formatting +- **Clean Text Only** - Extracts text without any layout preservation + +**Recommendation:** Use "Preserve Original Layout" for documents where visual structure matters (forms, tables, multi-column layouts). + +### OCR Quality Settings + +**Options:** +- **Fast** - Quick processing, good for clean scans +- **Balanced** - Good quality with reasonable speed (recommended) +- **Best** - Maximum accuracy, slower processing + +### Preprocessing Options + +Improve OCR accuracy by preprocessing images: + +- **Auto-rotate** - Automatically detect and correct page orientation +- **Deskew** - Fix slightly tilted/skewed scans +- **Despeckle** - Remove noise and artifacts from scans +- **Remove Background** - Clean up paper texture and shadows +- **Enhance Contrast** - Improve readability of faded text + +**Tip:** For poor quality scans, enable multiple preprocessing options. + +--- + +## Best Practices + +### For Best OCR Results + +1. **Use high-quality scans** + - 300 DPI or higher recommended + - Higher resolution = better accuracy + - Minimum 150 DPI for acceptable results + +2. **Clean, clear images** + - High contrast between text and background + - Minimal shadows or stains + - Sharp focus, not blurry + +3. **Correct orientation** + - Text should be right-side up + - Use auto-rotate if unsure + +4. **Select correct language** + - Choose all languages present in document + - Wrong language = poor accuracy + +5. **Preprocess poor scans** + - Enable deskew for tilted pages + - Use despeckle for noisy scans + - Enhance contrast for faded text + +### Document Types + +**Works Best With:** +- ✅ Scanned documents (text documents, contracts, letters) +- ✅ Photos of documents taken with good lighting +- ✅ Clean screenshots of text +- ✅ Printed text (books, magazines, reports) + +**Challenging Cases:** +- ⚠️ Handwritten text (limited accuracy) +- ⚠️ Stylized or decorative fonts +- ⚠️ Very small text (< 8pt font) +- ⚠️ Low resolution images +- ⚠️ Heavily compressed or artifacted images + +--- + +## Common Issues + +### "No text recognized" + +**Possible Causes:** +- Wrong language selected +- Image quality too poor +- Text too small or blurry +- Extreme skew/rotation + +**Solutions:** +- Verify correct language pack selected +- Use higher quality scan +- Enable preprocessing options +- Check document orientation + +### "Poor accuracy / Garbled text" + +**Possible Causes:** +- Low quality scan +- Wrong language selected +- Unusual font or formatting +- Background interference + +**Solutions:** +- Increase scan resolution +- Select multiple language packs +- Enable despeckle and contrast enhancement +- Clean up document before scanning + +### "Processing takes too long" + +**Possible Causes:** +- Large document (many pages) +- High resolution images +- "Best" quality setting +- Multiple preprocessing options + +**Solutions:** +- Process in smaller batches +- Use "Balanced" quality setting +- Reduce resolution if very high +- Disable unnecessary preprocessing + +--- + +## Technical Details + +### OCR Engine + +Stirling-PDF uses **Tesseract OCR**, an industry-standard open-source OCR engine originally developed by HP and now maintained by Google. + +**Key Features:** +- Over 100 languages supported +- Multiple output formats +- Layout analysis and preservation +- Character and word confidence scores + +### Processing Steps + +1. **Image Analysis** - Detect page layout and text regions +2. **Preprocessing** - Apply selected image enhancements +3. **Text Recognition** - Recognize characters using language models +4. **Layout Reconstruction** - Preserve original formatting +5. **PDF Generation** - Create searchable PDF with text layer + +### Output Format + +OCR produces a **PDF with embedded text layer**: +- Original image preserved (visual appearance unchanged) +- Invisible text layer added on top +- Text is searchable and selectable +- Layout matches original document + +--- + +## Configuration + +### Installing Language Packs + +By default, Stirling-PDF includes common language packs. To add additional languages: + +**Docker:** +```dockerfile +# Install additional language packs +RUN apt-get update && apt-get install -y \ + tesseract-ocr-ara \ + tesseract-ocr-chi-sim \ + tesseract-ocr-jpn +``` + +**See:** [OCR Configuration Guide](../Configuration/OCR.md) for detailed setup instructions. + +### Environment Variables + +```yaml +# OCR Settings +system: + ocr: + enabled: true + languages: "eng,spa,fra,deu" # Default languages + pageSegmentationMode: auto +``` + +--- + +## Use with Other Tools + +### Common Workflows + +**OCR → Convert to Word** +1. Run OCR to make document searchable +2. Use [Convert](./Convert/Convert.md) to export to DOCX +3. Edit document in Word + +**OCR → Search & Redact** +1. Run OCR to add text layer +2. Use search to find sensitive information +3. Use [Redact](./Page-Operations/redact.md) to remove it + +**OCR → Extract Data** +1. Run OCR on scanned forms/invoices +2. Use [PDF to CSV](./Convert/Convert.md) to extract tables +3. Import data into spreadsheet + +**Scan → OCR → Compress** +1. Scan documents to PDF +2. Run OCR to make searchable +3. Use [Compress](./Compress.md) to reduce file size + +--- + +## API Usage + +Perform OCR programmatically via API: + +```bash +curl -X POST http://stirling-pdf:8080/api/v1/ocr/pdf \ + -F "fileInput=@scanned.pdf" \ + -F "languages=eng+spa" \ + -F "sidecar=false" \ + -F "deskew=true" \ + -F "clean=true" \ + -F "cleanFinal=true" \ + -F "ocrType=force" \ + -F "ocrRenderType=hocr" \ + -o searchable.pdf +``` + +**Parameters:** +- `languages` - Language codes (+ separated) +- `sidecar` - Generate separate text file +- `deskew` - Fix tilted pages +- `clean` - Remove noise +- `cleanFinal` - Final cleanup +- `ocrType` - `skip`, `force`, or `auto` +- `ocrRenderType` - Output format + +See [API Documentation](../API.md) for complete endpoint reference. + +--- + +## Related Tools + +- **[Convert](./Convert/Convert.md)** - Convert OCR'd PDFs to Word, text, or other formats +- **[Compress](./Compress.md)** - Reduce file size after OCR +- **[Multi-Tool](./Multi-Tool.md)** - Chain OCR with other operations +- **[Auto-Rename](./Advanced-Tools.md#auto-rename)** - Rename files based on OCR'd content + +--- + +## Summary + +Stirling-PDF's OCR tool provides: + +✅ **100+ language support** - Recognize text in any language +✅ **Layout preservation** - Maintain original document formatting +✅ **Batch processing** - OCR multiple files at once +✅ **Preprocessing options** - Enhance poor quality scans +✅ **Industry-standard engine** - Tesseract OCR with proven accuracy +✅ **API access** - Automate OCR workflows + +Perfect for digitizing scanned documents, making PDFs searchable, and extracting text from images! diff --git a/docs/Functionality/Page-Operations/Page-Operations.md b/docs/Functionality/Page-Operations/Page-Operations.md index 560d0f4a..3888679f 100644 --- a/docs/Functionality/Page-Operations/Page-Operations.md +++ b/docs/Functionality/Page-Operations/Page-Operations.md @@ -10,7 +10,9 @@ description: List of all Page related features - `split-pdfs`: This functionality enables users to split a single PDF document into multiple separate PDFs. -- `pdf-organizer`: This feature gives users the ability to rearrange, add, or delete pages within a PDF document. +- `reorganize-pages`: This feature gives users the ability to rearrange, add, or delete pages within a PDF document. + +- `extract-pages`: Extracts specific pages from a PDF document into a new separate PDF file - `rotate-pdf`: With this feature, users can rotate pages within a PDF document to their desired orientation. @@ -26,12 +28,22 @@ description: List of all Page related features - `crop`: Allows user to crop the pages to set size -- `extract pages`: Extracts the defined pages from the PDF into a new PDF document - - `pdf-to-single-page`: Converts multi pages PDF files into a single long pdf page. +- `booklet-imposition`: Arranges PDF pages for booklet printing with proper page ordering for folding and binding. Creates printer-ready booklets with correct page sequences + - `split-by-size-or-count`: Splits one or multiple PDF files into parts consisting of a maximum file size or page count definde by the user. - `overlay-pdf`: Can merge multiple PDFs into one another (ontop/behind etc) in various ways - + +- `add-attachments`: Embed files as attachments within a PDF document. Attached files can be extracted later by PDF readers that support attachments + - `split-pdf-by-sections`: Splits a page in multiple section vertically, horizontally or both. Can be used to split a page in half etc. + +- `add-page-numbers`: Add customizable page numbers and text to the edges of PDF pages with options for position, formatting, and page ranges. + +- `remove-blanks`: With this feature, users can remove blank pages from a PDF document automatically, detecting pages with little to no content. + +- `auto-split-pdf`: Automatically splits documents into separate files based on QR codes detected between pages. Designed for bulk scanning workflows where separator pages with QR codes are placed between documents. + +- `edit-table-of-contents`: Edit, add, or modify the table of contents (bookmarks) in a PDF document for better navigation. diff --git a/docs/Functionality/Read-and-Annotate.md b/docs/Functionality/Read-and-Annotate.md new file mode 100644 index 00000000..d4c5a464 --- /dev/null +++ b/docs/Functionality/Read-and-Annotate.md @@ -0,0 +1,485 @@ +--- +sidebar_position: 8 +id: Read-and-Annotate +title: Read & Annotate PDFs +description: Interactive PDF viewer with annotation tools for reading and markup +--- + +# Read & Annotate PDFs + +**Tool ID:** `read` + +The Read & Annotate tool is Stirling-PDF V2's interactive PDF viewer and annotation system. Read PDFs directly in your browser while adding comments, highlights, drawings, and other markup - all without leaving the application. + +:::tip V2.0 Feature +Built with **[EmbedPDF](https://github.com/EmbedPDF/EmbedPDF)**, an advanced open-source PDF viewer, the Read tool provides a fluid reading and annotation experience with full support for PDF standards. +::: + +--- + +## What is Read & Annotate? + +Read & Annotate is a full-featured PDF viewer that lets you: +- Read PDFs in a clean, focused interface +- Add annotations, comments, and notes +- Highlight and markup text +- Draw freehand on pages +- Add shapes, arrows, and callouts +- Insert text boxes and sticky notes +- Collaborate by marking up documents +- Save annotated PDFs for sharing + +Think of it as your digital PDF notepad - read, review, and mark up documents all in one place. + +--- + +## Key Features + +### 📖 Full PDF Viewer +Professional reading experience: +- Smooth page scrolling +- Zoom in/out controls +- Full-screen mode +- Page thumbnails for navigation +- Search within document +- Bookmarks and table of contents +- Print from browser + +### ✏️ Text Annotations +Mark up text with ease: +- **Highlight** - Yellow, green, pink, blue highlighters +- **Underline** - Emphasize important text +- **Strikethrough** - Mark text for removal +- **Text Notes** - Add comments anywhere +- **Sticky Notes** - Floating note boxes + +### 🎨 Drawing Tools +Freehand markup capabilities: +- **Pen/Pencil** - Draw freehand +- **Highlighter** - Freehand highlighting +- **Eraser** - Remove drawn annotations +- **Colors** - Full color palette +- **Line Width** - Adjustable thickness +- **Opacity** - Control transparency + +### 📐 Shape Tools +Add structured markup: +- **Lines** - Straight lines and arrows +- **Rectangles** - Boxes and frames +- **Circles/Ellipses** - Round shapes +- **Arrows** - Directional indicators +- **Callouts** - Speech bubbles for comments +- **Stamps** - Pre-made approval stamps + +### 💬 Comments and Notes +Collaborative features: +- **Text Comments** - Add detailed feedback +- **Reply Threads** - Respond to annotations +- **Author Attribution** - Track who added what +- **Timestamp** - See when added +- **Comment Panel** - List all comments + +### 💾 Save and Export +Keep your work: +- **Save Annotations** - Embedded in PDF +- **Download** - Get annotated PDF +- **Standard Format** - Compatible with other PDF readers +- **Preserve Original** - Keep original unchanged option + +--- + +## How to Use Read & Annotate + +### Opening a PDF + +1. **Navigate to Read Tool** + - Click "Read" from home page (Recommended Tools) + - Or select from tools menu + +2. **Upload Your PDF** + - Drag and drop PDF into viewer + - Or click to browse and select file + - PDF opens in reading mode + +3. **Start Reading** + - Scroll through pages + - Use zoom controls as needed + - Navigate with thumbnail panel + +--- + +## Annotation Tools Guide + +### Highlighting Text + +**How to highlight:** +1. Click the Highlight tool in toolbar +2. Select highlight color (yellow, green, pink, blue) +3. Click and drag over text you want to highlight +4. Release to apply +5. Highlight appears immediately + +**Tips:** +- Hold Shift to highlight across multiple lines +- Double-click to highlight entire word +- Triple-click to highlight entire paragraph +- Change color by clicking highlighted text + +--- + +### Adding Comments + +**How to add comments:** +1. Click the Comment/Note tool +2. Click where you want to add comment +3. Type your comment in the popup box +4. Click "Save" or press Enter +5. Comment icon appears on page + +**Comment Features:** +- **Edit:** Click comment icon to edit text +- **Delete:** Right-click → Delete +- **Move:** Drag comment icon to reposition +- **Reply:** Click to add threaded replies +- **Color-Code:** Assign colors to organize + +--- + +### Drawing Freehand + +**How to draw:** +1. Select Pen/Pencil tool from toolbar +2. Choose color and line thickness +3. Click and drag to draw on page +4. Release when finished +5. Repeat for additional drawings + +**Drawing Controls:** +- **Undo:** Use undo button to undo last stroke +- **Eraser:** Switch to eraser to remove parts +- **Opacity:** Adjust for transparent overlay +- **Smooth:** Lines auto-smoothed for clean look + +--- + +### Adding Shapes + +**How to add shapes:** +1. Select shape tool (Rectangle, Circle, Arrow, etc.) +2. Choose border color and fill +3. Click and drag to create shape +4. Release to place +5. Drag handles to resize + +**Shape Options:** +- **Border:** Color and thickness +- **Fill:** Solid color or transparent +- **Style:** Solid, dashed, or dotted lines +- **Resize:** Drag corner handles +- **Rotate:** Rotate handle for angles + +--- + +### Text Boxes + +**How to add text boxes:** +1. Select Text Box tool +2. Click where you want text +3. Type your text +4. Adjust font, size, and color +5. Click outside box when done + +**Text Formatting:** +- **Font:** Choose from available fonts +- **Size:** Adjust text size +- **Color:** Any color for text +- **Alignment:** Left, center, right +- **Bold/Italic:** Style options + +--- + +## Navigation Features + +### Page Navigation +- **Scroll:** Mouse wheel or trackpad +- **Arrow Keys:** Up/down for pages +- **Page Numbers:** Jump to specific page +- **Thumbnails:** Click thumbnail to jump +- **Bookmarks:** Use PDF bookmarks if present + +### Zoom Controls +- **Zoom In:** + button or Ctrl/Cmd++ +- **Zoom Out:** - button or Ctrl/Cmd+- +- **Fit Width:** Fit page width to screen +- **Fit Height:** Fit page height to screen +- **Actual Size:** 100% zoom +- **Custom:** Enter specific percentage + +### View Modes +- **Single Page:** One page at a time +- **Continuous:** Scrolling multiple pages +- **Two-Page Spread:** Side-by-side pages +- **Full Screen:** Distraction-free reading +- **Presentation:** Slideshow mode + +--- + +## Collaboration Features + +### Multi-User Annotations +When multiple people review the same document: +- **Author Names:** Each annotation shows who created it +- **Timestamps:** See when annotations were added +- **Color Coding:** Assign colors to different reviewers +- **Thread Comments:** Reply to others' comments +- **Version Tracking:** Compare different annotated versions + +### Sharing Annotated PDFs +Your annotations are embedded in standard PDF format: +- ✅ **Compatible:** Opens in Adobe Acrobat, Foxit, etc. +- ✅ **Preserved:** Annotations travel with the file +- ✅ **Editable:** Others can add more annotations +- ✅ **Professional:** Standard PDF annotation format + +--- + +## Keyboard Shortcuts + +### Navigation +| Shortcut | Action | +|----------|--------| +| **Arrow Keys** | Navigate pages | +| **Page Up/Down** | Jump pages | +| **Home** | First page | +| **End** | Last page | +| **Ctrl/Cmd + F** | Find/Search | + +### Zoom +| Shortcut | Action | +|----------|--------| +| **Ctrl/Cmd + +** | Zoom in | +| **Ctrl/Cmd + -** | Zoom out | +| **Ctrl/Cmd + 0** | Reset zoom | +| **Ctrl/Cmd + Mouse Wheel** | Zoom in/out | + +### Tools +| Shortcut | Action | +|----------|--------| +| **Ctrl/Cmd + Z** | Undo annotation | +| **Ctrl/Cmd + Y** | Redo annotation | +| **H** | Highlight tool | +| **T** | Text tool | +| **P** | Pen tool | +| **Delete** | Remove selected annotation | + +### View +| Shortcut | Action | +|----------|--------| +| **F11** | Full screen | +| **Esc** | Exit full screen | +| **Ctrl/Cmd + Shift + T** | Toggle thumbnails | + +--- + +## Annotation Properties + +### Customization Options +Every annotation can be customized: +- **Color:** Choose from full color palette +- **Opacity:** Make transparent or opaque +- **Border Width:** Thick or thin lines +- **Font:** Text annotation font styles +- **Author:** Set your name for attribution +- **Date:** Timestamp of creation + +### Editing Annotations +Modify existing annotations: +- **Select:** Click any annotation to select +- **Move:** Drag to reposition +- **Resize:** Drag handles to resize +- **Edit Text:** Click to edit comment text +- **Change Color:** Select and change color +- **Delete:** Select and press Delete key + +--- + +## Best Practices + +### For Effective Reviewing +1. **Color Code:** Use consistent colors for different types of feedback +2. **Be Specific:** Add detailed comments, not just highlights +3. **Use Shapes:** Circle important areas, arrow to specific elements +4. **Layer Annotations:** Use different tools for different purposes +5. **Save Often:** Don't lose your markup work + +### For Clear Communication +1. **Descriptive Comments:** Write clear, actionable feedback +2. **Numbered Points:** Number comments for reference in discussions +3. **Priority Levels:** Use colors to indicate urgency +4. **Location Markers:** Use arrows and shapes to be precise +5. **Summary Notes:** Add overall comment at end + +### For Organization +1. **Naming Convention:** Save annotated PDFs with descriptive names +2. **Version Control:** Include version numbers in filenames +3. **Date Stamps:** Note review date in filename or comment +4. **Backup Copies:** Keep original un-annotated version +5. **Export Comments:** List all comments before final review + +--- + +## Saving and Exporting + +### Save Options +- **Save Annotations:** Embeds annotations in PDF file +- **Flatten Annotations:** Merge annotations into pages (permanent) +- **Export Comments:** Extract comments to separate file +- **Print with Annotations:** Annotations visible when printed + +### Download Formats +- **PDF with Annotations:** Standard annotated PDF +- **Flattened PDF:** Annotations permanently merged +- **Comment Summary:** Text file of all comments + +### File Management +- **Auto-Save:** Annotations saved automatically in browser +- **Manual Save:** Click "Save" to download annotated PDF +- **Clear Browser Storage:** Remember to download before clearing +- **Desktop App:** Saves directly to your file system + +--- + +## Compatibility + +### Annotation Standards +Stirling-PDF uses standard PDF annotation formats: +- ✅ **Adobe Acrobat** - Full compatibility +- ✅ **Foxit Reader** - All annotations supported +- ✅ **PDF-XChange** - Complete support +- ✅ **macOS Preview** - Most annotations visible +- ✅ **Other PDF Readers** - Standard format supported + +### Limitations +Some advanced features may not work everywhere: +- Complex callouts might appear as simple shapes +- Custom colors may render slightly differently +- Font choices limited by reader's available fonts + +--- + +## Troubleshooting + +### Annotations Not Saving +**Solution:** +- Click "Save" button to download annotated PDF +- Don't rely on browser storage alone +- Check browser isn't blocking downloads +- Try desktop app for automatic saving + +### Can't Select Text to Highlight +**Possible Causes:** +- PDF is scanned image (no text layer) +- Text is in an image or graphic +- PDF has security restrictions + +**Solutions:** +- Run OCR first to add text layer +- Use freehand highlighter instead +- Check PDF permissions + +### Slow Performance with Many Annotations +**Solutions:** +- Flatten annotations to improve performance +- Split large PDFs into sections +- Use desktop app for better performance +- Clear browser cache + +### Annotations Lost After Closing +**Cause:** Didn't download annotated PDF before closing + +**Prevention:** +- Always download/save annotated PDF +- Don't rely on browser storage long-term +- Use desktop app for persistent files + +--- + +## Read Tool vs. Other Viewers + +### vs. Adobe Acrobat Reader +**Stirling-PDF Read:** +- ✅ No installation needed (browser) +- ✅ Integrated with other Stirling tools +- ✅ Open source and free +- ❌ Fewer advanced features +- ❌ Browser-dependent + +**Adobe Acrobat:** +- ✅ More advanced features +- ✅ Native application +- ✅ Industry standard +- ❌ Requires installation +- ❌ Paid features + +### vs. Browser Default PDF Viewer +**Stirling-PDF Read:** +- ✅ Full annotation tools +- ✅ Save annotations in PDF +- ✅ Professional markup options +- ✅ Integrated with PDF processing + +**Browser Viewer:** +- ✅ Instant opening +- ❌ Limited or no annotations +- ❌ Basic viewing only + +--- + +## Desktop App vs. Browser + +### Browser Read Tool +**Pros:** +- No installation +- Access anywhere +- Automatic updates + +**Cons:** +- Must download to save +- Browser storage limits +- Requires internet + +### Desktop App Read Tool +**Pros:** +- Saves directly to disk +- Better performance +- Offline capable +- Larger files supported + +**Cons:** +- Requires installation +- Device-specific + +--- + +## Related Documentation + +- **[Multi-Tool](./Multi-Tool.md)** - Workbench for multiple operations +- **[Sign PDFs](../Functionality/Security/Security.md)** - Add signatures +- **[Recommended Tools](./Recommended-Tools.md)** - Other top tools +- **[Desktop Installation](../Installation/Windows.md)** - Get desktop app + +--- + +## Summary + +The Read & Annotate tool transforms Stirling-PDF into a powerful PDF review platform: + +- 📖 **Full-featured viewer** - Professional reading experience +- ✏️ **Complete annotation tools** - Highlights, comments, drawings, shapes +- 💬 **Collaboration ready** - Standard format, multi-user support +- 💾 **Save and share** - Annotated PDFs compatible everywhere +- 🚀 **Integrated workflow** - Part of Stirling-PDF V2 ecosystem + +**Perfect for:** Document review, contract markup, student notes, design feedback, form filling, and collaborative editing. + +Ready to start annotating? Open the Read tool and mark up your first PDF! diff --git a/docs/Functionality/Recommended-Tools.md b/docs/Functionality/Recommended-Tools.md new file mode 100644 index 00000000..e9297d07 --- /dev/null +++ b/docs/Functionality/Recommended-Tools.md @@ -0,0 +1,255 @@ +--- +sidebar_position: 1 +id: Recommended-Tools +title: Recommended Tools +description: The 7 most commonly used PDF tools in Stirling-PDF V2 +--- + +# Recommended Tools + +These are the **7 most frequently used PDF operations** in Stirling-PDF, prominently featured for quick access. Perfect for everyday PDF tasks. + +--- + +## Multi-Tool + +**Tool ID:** `multiTool` + +A powerful workbench interface that allows you to chain multiple PDF operations together in sequence without re-uploading files between steps. + +### What it does +- Upload PDFs once and use them across multiple operations +- Chain operations together (e.g., merge → compress → add watermark) +- See thumbnail previews of your files +- Switch between different tools seamlessly +- All processing happens in a single session + +### Perfect for +- Complex multi-step PDF workflows +- Working with the same file across different operations +- Experimenting with different settings +- Batch processing with multiple tools + +**📖 [Read the complete Multi-Tool Guide →](./Multi-Tool.md)** for detailed workflows, tips, and advanced features. + +--- + +## Merge PDFs + +**Tool ID:** `merge` + +Combine multiple PDF documents into a single unified PDF file. + +### What it does +- Merge 2 or more PDF files into one document +- Rearrange the order of PDFs before merging +- Preview thumbnails of each PDF +- Maintain quality of original documents +- Preserve bookmarks and metadata (optional) + +### Perfect for +- Combining multiple reports into one document +- Merging chapters or sections of a book +- Consolidating scanned documents +- Creating comprehensive document packages + +### Options +- **Sort Order:** Drag and drop to reorder PDFs before merging +- **Metadata:** Choose which source document's metadata to keep + +--- + +## Compare + +**Tool ID:** `compare` + +Compare two PDF documents side-by-side and visually highlight the differences between them. Essential for reviewing document revisions and finding changes. + +### What it does +- Display two PDFs side-by-side for easy comparison +- Highlight text differences (added, removed, modified) +- Visual diff view with color coding +- Navigate between changes easily +- Generate comparison reports + +### Perfect for +- Reviewing document revisions +- Finding changes between contract versions +- Quality assurance and proofreading +- Legal document comparison + +**📖 [Read the complete Compare Guide →](./Compare.md)** for detailed comparison modes, settings, use cases, and best practices. + +--- + +## Compress + +**Tool ID:** `compress-pdf` + +Reduce PDF file size while maintaining acceptable quality for your needs. Stirling-PDF's compression tool optimizes images, removes unnecessary data, and applies various compression techniques. + +### What it does +- Significantly reduce PDF file size (10-90% reduction) +- Multiple compression levels available +- Compress images within PDFs +- Remove unnecessary metadata +- Optimize for web or email sharing + +### Perfect for +- Sharing PDFs via email +- Reducing storage requirements +- Faster PDF loading times +- Meeting file size upload limits + +**📖 [Read the complete Compress Guide →](./Compress.md)** for detailed compression options, quality settings, tips, and best practices. + +--- + +## Convert + +**Tool ID:** `convert` + +Convert between PDF and 50+ other file formats including images, Office documents, HTML, and more. + +### What it does +- Convert TO PDF from 50+ formats +- Convert FROM PDF to images, Office files, HTML, etc. +- Batch conversion support +- Maintains formatting when possible +- Supports both single and multiple file conversion + +### Supported Formats + +#### To PDF +- **Images:** JPG, PNG, GIF, TIFF, BMP, WebP +- **Office:** DOCX, XLSX, PPTX, DOC, XLS, PPT +- **Web:** HTML files, URLs (website screenshots) +- **Text:** TXT, RTF, Markdown +- **Email:** EML (email to PDF) +- **Comics:** CBZ, CBR + +#### From PDF +- **Images:** JPG, PNG, TIFF, BMP, GIF +- **Office:** DOCX (Word), PPTX (PowerPoint) +- **Web:** HTML, XML +- **Text:** Plain text +- **Archival:** PDF/A +- **Data:** CSV (table extraction) +- **Comics:** CBZ, CBR + +### Perfect for +- Converting scanned images to searchable PDFs (combine with OCR) +- Creating PDFs from Office documents +- Extracting text from PDFs +- Archiving emails as PDFs +- Converting PDFs to editable Word documents + +**Learn more:** [Complete Conversion Guide](./Convert/Convert.md) + +--- + +## OCR (Optical Character Recognition) + +**Tool ID:** `ocr-pdf` + +Make scanned PDFs searchable and editable by recognizing text in images. Stirling-PDF's OCR tool uses Tesseract OCR engine to extract text from image-based PDFs. + +### What it does +- Recognize text from scanned documents +- Make image-based PDFs searchable +- Extract text from images within PDFs +- Support for 100+ languages +- Preserve original document layout + +### Perfect for +- Scanned documents and images +- Making old paper documents searchable +- Extracting text from photos of documents +- Creating accessible PDFs from scans +- Enabling copy/paste from scanned PDFs + +**📖 [Read the complete OCR Guide →](./OCR.md)** for detailed instructions, language support, configuration options, and best practices. + +--- + +## Redact + +**Tool ID:** `redact` + +Permanently remove sensitive information from PDF documents with black boxes or white spaces. + +### What it does +- Permanently remove (not just hide) text +- Black out or white out sensitive information +- Automatic redaction based on text patterns +- Manual redaction with draw tool +- Regex pattern support for complex redaction + +### Perfect for +- Removing personal information (PII) +- Redacting confidential data +- Preparing documents for public release +- GDPR/privacy compliance +- Legal document redaction + +### Redaction Methods + +#### Manual Redaction +- Draw boxes over areas to redact +- Preview before applying +- Adjust box size and position +- Choose black or white fill + +#### Automatic Redaction +- Search for text patterns to redact +- Use regex for complex patterns +- Redact all instances automatically +- Preview matches before redacting + +### Common Use Cases +- Social Security Numbers: `\d{3}-\d{2}-\d{4}` +- Phone Numbers: `\(\d{3}\) \d{3}-\d{4}` +- Email Addresses: `[\w\.-]+@[\w\.-]+\.\w+` +- Credit Card Numbers: `\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}` +- Custom text: Any word or phrase + +### Important Notes +- **Redaction is permanent** - original content cannot be recovered +- Always download and verify redacted PDFs +- Test regex patterns before applying to ensure accuracy +- Manual review recommended for sensitive documents + +**Learn more:** [Redaction Guide](./Page-Operations/redact.md) + +--- + +## Why These Tools? + +These 7 tools represent the most common PDF operations that users perform daily: + +1. **Multi-Tool** - Work with multiple operations efficiently +2. **Merge** - Combine documents (one of the most requested features) +3. **Compare** - Review changes and differences +4. **Compress** - Share files easily via email/upload +5. **Convert** - Universal format compatibility +6. **OCR** - Make any document searchable +7. **Redact** - Privacy and security compliance + +--- + +## Quick Access + +In Stirling-PDF V2, these recommended tools are: +- ✨ Featured prominently on the home page +- 🔍 Easier to find in search +- ⭐ Marked with special indicators +- 📱 Optimized for quick access + +--- + +## Next Steps + +- **Explore more tools:** [Complete Tool Reference](./Functionality.md) +- **Standard tools:** [Security](./Security/Security.md), [Page Operations](./Page-Operations/Page-Operations.md) +- **Advanced features:** [Automation Workflows](./Features%20Pipeline.md) +- **API access:** [API Documentation](../API.md) diff --git a/docs/Functionality/Security/Certificate-Signing.md b/docs/Functionality/Security/Certificate-Signing.md new file mode 100644 index 00000000..03e78ee1 --- /dev/null +++ b/docs/Functionality/Security/Certificate-Signing.md @@ -0,0 +1,847 @@ +--- +sidebar_position: 2 +id: Certificate-Signing +title: Certificate Signing +description: Sign and validate PDF certificates +--- + +# Certificate Signing + +Stirling-PDF provides comprehensive PDF certificate signing and validation capabilities. Digitally sign PDFs with X.509 certificates and validate existing signatures against trusted certificate chains. + +--- + +## Overview + +**Two main features:** + +1. **Sign PDFs** - Apply digital signatures using certificates +2. **Validate Signatures** - Verify certificate-signed PDFs against trust chains + +**Use Cases:** +- Legal document signing +- Contract verification +- Invoice authentication +- Compliance requirements (eIDAS, etc.) +- Enterprise document workflows + +--- + +## Signing PDFs + +### Methods + +#### 1. Sign with Stirling-PDF (Server Certificate) + +**Easiest option** - Use auto-generated server certificate. + +**How it works:** +- Server generates self-signed certificate on first startup +- Certificate persists across restarts +- Users sign PDFs with one click +- No certificate management needed + +**Use cases:** +- Internal documents +- Non-legal signatures +- Quick signing workflows +- Testing and development + +**Steps:** +1. Go to **Certificate Sign** tool +2. Upload PDF +3. Select "Sign with Stirling-PDF" +4. Configure signature appearance (optional): + - Position on page + - Size + - Visible or invisible + - Text to display +5. Click Sign +6. Download signed PDF + +**Configuration:** +```yaml +system: + serverCertificate: + enabled: true # Enable auto-generation + organizationName: Stirling-PDF # Certificate org name + validity: 365 # Days until expiration + regenerateOnStartup: false # Keep same cert across restarts +``` + +**Environment Variables:** +```bash +SYSTEM_SERVERCERTIFICATE_ENABLED=true +SYSTEM_SERVERCERTIFICATE_ORGANIZATIONNAME="My Company" +SYSTEM_SERVERCERTIFICATE_VALIDITY=365 +``` + +--- + +#### 2. Sign with Custom Certificate + +**For legal/official documents** - Use your own certificate. + +**Requirements:** +- X.509 certificate in PKCS#12 (.p12) or PEM format +- Private key +- Optional: Certificate chain + +**Steps:** +1. Go to **Certificate Sign** tool +2. Upload PDF +3. Select "Upload Certificate" +4. Upload your certificate file (.p12, .pfx, or .pem) +5. Enter certificate password +6. Configure signature appearance +7. Click Sign +8. Download signed PDF + +**Supported formats:** +- `.p12` / `.pfx` - PKCS#12 (most common) +- `.pem` - PEM-encoded certificate + key +- `.crt` + `.key` - Separate cert and key files + +**Example with openssl:** +```bash +# Generate your own certificate (for testing) +openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 + +# Convert to PKCS#12 for Stirling-PDF +openssl pkcs12 -export -out mycert.p12 -inkey key.pem -in cert.pem +``` + +--- + +#### 3. Server-Managed Custom Certificates + +**For admins** - Provide organization certificate for all users. + +**How to set up:** +1. Place certificate in configs directory: + ```bash + configs/ + └── keystore.p12 + ``` + +2. Configure in settings.yml: + ```yaml + system: + serverCertificate: + enabled: false # Disable auto-generation + ``` + +3. Set certificate password via environment variable: + ```bash + KEYSTORE_PASSWORD=your-password + ``` + +**Users see:** +- "Sign with [Organization Name]" option +- No need to upload certificate +- Consistent signing across organization + +--- + +### Signature Appearance + +Configure how signature appears on PDF: + +#### Visible Signature + +Signature appears as box on PDF page. + +**Options:** +- **Position:** X/Y coordinates or page location (top-left, center, etc.) +- **Size:** Width and height in points +- **Page:** Which page(s) to sign +- **Text:** Name, date, reason displayed +- **Image:** Optional signature image + +**Example configuration:** +```yaml +Signature: + Position: Bottom-Right + Page: Last + Size: 200x100 points + Display: + - Signer Name + - Sign Date + - Reason: "Approved" +``` + +#### Invisible Signature + +Signature embedded in PDF metadata, not visible. + +**Use cases:** +- Digital timestamping +- Authentication without visual mark +- Multiple signatures on same document + +--- + +### Signing Multiple PDFs + +**Batch signing** - Sign multiple PDFs with same certificate. + +**Methods:** + +1. **Multi-Tool:** + - Upload multiple PDFs + - Apply certificate sign operation + - All PDFs signed with same cert + - Download as zip + +2. **Pipeline (Automation):** + ```json + { + "name": "Sign Documents", + "pipeline": [ + { + "operation": "cert-sign", + "parameters": { + "certType": "server", + "reason": "Approved", + "location": "bottom-right" + } + } + ] + } + ``` + +--- + +## Validating Signatures + +### What is Signature Validation? + +Verify that: +- ✅ PDF was signed by claimed certificate +- ✅ Certificate is trusted (in trust chain) +- ✅ Certificate was valid at signing time +- ✅ PDF has not been modified since signing +- ✅ Certificate has not been revoked + +### Trust Chains + +Stirling-PDF checks multiple trust sources: + +#### 1. Server-Generated Certificates +```yaml +security: + validation: + trust: + serverAsAnchor: true # Trust server-generated certs +``` + +**Use case:** Trust PDFs signed by your Stirling-PDF instance. + +--- + +#### 2. System Trust Store +```yaml +security: + validation: + trust: + useSystemTrust: true # Use OS certificate store +``` + +**What it includes:** +- Operating system's trusted CA certificates +- Certificates added by system administrator +- Standard public CAs (Let's Encrypt, DigiCert, etc.) + +**Use case:** Trust certificates from public certificate authorities. + +--- + +#### 3. Mozilla CA Bundle +```yaml +security: + validation: + trust: + useMozillaBundle: true # Mozilla's curated CA list +``` + +**What it includes:** +- Mozilla's trusted CA certificate bundle +- Regularly updated list of trusted CAs +- Well-maintained, widely trusted + +**Use case:** Standard web trust model for PDFs. + +--- + +#### 4. Adobe Approved Trust List (AATL) +```yaml +security: + validation: + trust: + useAATL: true # Adobe's approved CAs + aatl: + url: https://trustlist.adobe.com/tl.pdf +``` + +**What it includes:** +- Certificate authorities approved by Adobe +- Widely recognized for PDF signing +- Automatically updated from Adobe + +**Use case:** Enterprise PDF workflows, Adobe-signed documents. + +--- + +#### 5. EU Trusted List (EUTL) +```yaml +security: + validation: + trust: + useEUTL: true # EU eIDAS trust list + eutl: + lotlUrl: https://ec.europa.eu/tools/lotl/eu-lotl.xml + acceptTransitional: false # Accept transitional CAs +``` + +**What it includes:** +- EU member state trusted service providers +- eIDAS-compliant certificates +- European government and business CAs + +**Use case:** EU legal documents, eIDAS compliance, government workflows. + +--- + +### Revocation Checking + +Verify certificate has not been revoked: + +```yaml +security: + validation: + revocation: + mode: ocsp+crl # Options: none, ocsp, crl, ocsp+crl + hardFail: false # Fail validation if revocation check fails +``` + +#### Revocation Methods + +| Method | Description | Speed | Reliability | +|--------|-------------|-------|-------------| +| **none** | No revocation check | Instant | ⚠️ Not recommended | +| **ocsp** | Online Certificate Status Protocol | Fast | ✅ Real-time | +| **crl** | Certificate Revocation List | Slower | ✅ Works offline | +| **ocsp+crl** | Try OCSP, fall back to CRL | Medium | ✅ Best balance | + +#### Hard Fail vs Soft Fail + +**Soft Fail (hardFail: false):** +- ✅ Validation succeeds if revocation check unavailable +- ⚠️ Warning shown: "Could not verify revocation status" +- Use when network reliability uncertain + +**Hard Fail (hardFail: true):** +- ❌ Validation fails if revocation check unavailable +- ✅ Stricter security +- Use for high-security environments + +--- + +### Authority Information Access (AIA) + +Automatically fetch missing intermediate certificates: + +```yaml +security: + validation: + allowAIA: false # Enable AIA certificate fetching +``` + +**What it does:** +- Downloads intermediate certificates from URLs in certificate +- Completes certificate chain automatically +- Makes validation more likely to succeed + +**Security consideration:** +- Disabled by default (security best practice) +- Enable only in controlled environments +- Requires outbound HTTPS access + +--- + +## Configuration Examples + +### Minimal Configuration (Default) + +Works out-of-box for basic signing: + +```yaml +system: + serverCertificate: + enabled: true + +security: + validation: + trust: + serverAsAnchor: true + useSystemTrust: true +``` + +**Capabilities:** +- ✅ Sign with server certificate +- ✅ Validate system-trusted signatures +- ✅ No external dependencies + +--- + +### Standard Enterprise Setup + +Balanced security and usability: + +```yaml +system: + serverCertificate: + enabled: true + organizationName: Acme Corp + validity: 365 + +security: + validation: + trust: + serverAsAnchor: true + useSystemTrust: true + useMozillaBundle: true + useAATL: false + allowAIA: false + revocation: + mode: ocsp + hardFail: false +``` + +**Capabilities:** +- ✅ Sign with company certificate +- ✅ Validate against multiple trust sources +- ✅ OCSP revocation checking (soft fail) +- ✅ Works in most environments + +--- + +### High-Security Configuration + +Strict validation for regulated industries: + +```yaml +security: + validation: + trust: + serverAsAnchor: false + useSystemTrust: true + useMozillaBundle: true + useAATL: true + useEUTL: true + allowAIA: false + revocation: + mode: ocsp+crl + hardFail: true +``` + +**Capabilities:** +- ✅ Only trust external CAs (not server-generated) +- ✅ Multiple trust sources (AATL + EUTL) +- ✅ Dual revocation checking +- ✅ Hard fail on revocation check failure +- Use for: Finance, legal, government + +--- + +### EU eIDAS Compliance + +For European legal documents: + +```yaml +security: + validation: + trust: + serverAsAnchor: false + useSystemTrust: false + useMozillaBundle: false + useAATL: false + useEUTL: true # Only EU trusted list + eutl: + lotlUrl: https://ec.europa.eu/tools/lotl/eu-lotl.xml + acceptTransitional: true + allowAIA: false + revocation: + mode: ocsp+crl + hardFail: true +``` + +**Capabilities:** +- ✅ eIDAS-compliant validation +- ✅ Only EU member state CAs trusted +- ✅ Strict revocation checking +- Use for: EU contracts, government, regulated industries + +--- + +## Using the Tools + +### Certificate Sign Tool + +**Location:** Security → Certificate Sign + +**Features:** +- Upload PDF(s) to sign +- Choose certificate source +- Configure signature appearance +- Batch signing support +- Preview signature location + +**Workflow:** +1. Upload PDF(s) +2. Select certificate: + - Server certificate + - Upload custom certificate + - Use organization certificate (if configured) +3. Configure appearance: + - Visible or invisible + - Position and size + - Text and image + - Page selection +4. Add metadata: + - Reason for signing + - Location + - Contact info +5. Sign and download + +--- + +### Validate Signature Tool + +**Location:** Security → Validate Signature (planned) + +**Features:** +- Upload signed PDF +- Check signature validity +- View certificate details +- Check trust chain +- Verify revocation status + +**Output:** +``` +✅ Signature Valid + +Signer: CN=John Doe, O=Acme Corp +Signed: 2025-01-15 10:30:00 UTC +Certificate: RSA 2048-bit + +Trust Chain: + ✅ Acme Corp Root CA + ✅ Acme Corp Intermediate CA + ✅ John Doe + +Revocation: ✅ Not revoked (OCSP) +Document: ✅ Not modified +``` + +--- + +## API Usage + +### Sign PDF via API + +**Endpoint:** `POST /api/v1/security/cert-sign` + +**Example with server certificate:** +```bash +curl -X POST http://stirling-pdf:8080/api/v1/security/cert-sign \ + -F "fileInput=@document.pdf" \ + -F "certType=server" \ + -F "reason=Approved" \ + -F "location=bottom-right" \ + -F "showSignature=true" \ + -o signed.pdf +``` + +**Example with custom certificate:** +```bash +curl -X POST http://stirling-pdf:8080/api/v1/security/cert-sign \ + -F "fileInput=@document.pdf" \ + -F "certType=custom" \ + -F "certificateFile=@mycert.p12" \ + -F "password=certpass" \ + -F "reason=Contract Approval" \ + -o signed.pdf +``` + +--- + +### Validate Signature via API + +**Endpoint:** `POST /api/v1/security/validate-signature` + +**Example:** +```bash +curl -X POST http://stirling-pdf:8080/api/v1/security/validate-signature \ + -F "fileInput=@signed.pdf" \ + | jq . +``` + +**Response:** +```json +{ + "valid": true, + "signer": "CN=John Doe, O=Acme Corp", + "signDate": "2025-01-15T10:30:00Z", + "trustChain": [ + "CN=Acme Corp Root CA", + "CN=Acme Corp Intermediate CA", + "CN=John Doe" + ], + "revocationStatus": "not_revoked", + "documentModified": false, + "errors": [] +} +``` + +--- + +## Troubleshooting + +### Signature validation fails + +**Symptom:** "Certificate not trusted" error. + +**Solutions:** +1. Enable appropriate trust source: + ```yaml + security: + validation: + trust: + useSystemTrust: true # Or useMozillaBundle, useAATL, etc. + ``` + +2. Add certificate to system trust store: + ```bash + # Copy CA certificate to container + docker cp ca-cert.crt stirling-pdf:/usr/local/share/ca-certificates/ + + # Update trust store + docker exec stirling-pdf update-ca-certificates + ``` + +3. Check certificate chain complete: + - Ensure intermediate certificates included + - Or enable AIA fetching (if secure environment) + +--- + +### Revocation check fails + +**Symptom:** "Unable to check revocation status" warning. + +**Solutions:** +1. Check network access: + - Container needs HTTPS access to OCSP/CRL servers + - Check firewall rules + - Verify DNS resolution + +2. Use soft fail: + ```yaml + security: + validation: + revocation: + hardFail: false # Validation succeeds despite revocation check failure + ``` + +3. Use CRL instead of OCSP: + ```yaml + security: + validation: + revocation: + mode: crl # CRL more reliable in restricted networks + ``` + +--- + +### Server certificate not generated + +**Symptom:** "Sign with Stirling-PDF" option not available. + +**Solutions:** +1. Check configuration: + ```yaml + system: + serverCertificate: + enabled: true # Must be enabled + ``` + +2. Check logs for errors: + ```bash + docker logs stirling-pdf | grep -i certificate + ``` + +3. Verify write permissions: + ```bash + # Ensure configs directory writable + docker exec stirling-pdf ls -la /configs/ + ``` + +4. Manually regenerate: + ```yaml + system: + serverCertificate: + regenerateOnStartup: true # Force regeneration + ``` + Restart container, then set back to `false`. + +--- + +### EUTL/AATL not loading + +**Symptom:** Validation fails for EUTL/AATL certificates. + +**Solutions:** +1. Check network access: + ```bash + # Test from container + docker exec stirling-pdf curl -I https://ec.europa.eu/tools/lotl/eu-lotl.xml + docker exec stirling-pdf curl -I https://trustlist.adobe.com/tl.pdf + ``` + +2. Check configuration URLs: + ```yaml + security: + validation: + aatl: + url: https://trustlist.adobe.com/tl.pdf # Verify correct URL + eutl: + lotlUrl: https://ec.europa.eu/tools/lotl/eu-lotl.xml + ``` + +3. Check for proxy requirements: + ```yaml + # If behind corporate proxy + system: + proxy: + host: proxy.company.com + port: 8080 + ``` + +--- + +## Security Best Practices + +### For Signing + +1. **Use appropriate certificates:** + - Server certificates: Internal/testing only + - Custom certificates: Legal/official documents + - Organization certificates: Centralized management + +2. **Protect private keys:** + - Use strong passwords for PKCS#12 files + - Store keys securely (not in Docker image) + - Rotate certificates regularly + +3. **Configure appearance:** + - Visible signatures for accountability + - Include signer name, date, reason + - Position consistently across documents + +### For Validation + +1. **Enable appropriate trust sources:** + - System trust: General validation + - AATL: Adobe ecosystem + - EUTL: EU legal documents + - Don't enable all unless needed + +2. **Revocation checking:** + - Always enable for production (at least OCSP) + - Use hard fail for high-security + - Use soft fail for reliability + +3. **AIA fetching:** + - Disable by default (security) + - Only enable in controlled environments + - Monitor network traffic + +4. **Trust chain verification:** + - Verify full chain to root CA + - Don't trust self-signed (except server certs for internal use) + - Check expiration dates + +--- + +## Legal Considerations + +**Disclaimer:** Stirling-PDF provides tools for PDF signing and validation. Legal validity depends on jurisdiction and use case. + +### When Certificates Are Legally Binding + +**Generally accepted:** +- ✅ Certificates from trusted CAs (AATL, EUTL) +- ✅ eIDAS-qualified certificates (EU) +- ✅ Certificates with proof of identity verification +- ✅ Proper timestamping + +**May not be legally binding:** +- ⚠️ Self-signed certificates (server-generated) +- ⚠️ Certificates without identity verification +- ⚠️ Expired certificates at signing time + +### Compliance + +**EU eIDAS:** +- Use EUTL trust list +- eIDAS-qualified certificates +- Qualified timestamping +- Long-term validation (LTV) + +**US ESIGN Act:** +- Consent to electronic signatures +- Record retention requirements +- Identity verification + +**Consult legal counsel** for your specific requirements. + +--- + +## Learn More + +**Configuration:** +- [System and Security Settings](../../Configuration/System%20and%20Security.md#signature-validation) - Technical configuration details +- [Extra Settings](../../Configuration/Extra-Settings.md) - All certificate-related configuration options + +**Migration:** +- [Settings Changes](../../Migration/Settings-Changes.md#pdf-signature-validation) - V2 new settings +- [New Features](../../Migration/New-Features.md#-pdf-signature-validation) - Feature overview + +**Related Tools:** +- [Sign](./Security.md) - Handwritten/image signatures +- [Add Password](./Security.md) - PDF encryption +- [Permissions](./Security.md) - Access control + +--- + +## Summary + +**Stirling-PDF certificate signing provides:** + +✅ **Easy signing** - Server certificates work out-of-box +✅ **Custom certificates** - Use your own for legal documents +✅ **Organization certificates** - Centralized cert management +✅ **Comprehensive validation** - Multiple trust sources +✅ **Revocation checking** - OCSP and CRL support +✅ **EU compliance** - eIDAS/EUTL support +✅ **Flexible configuration** - From basic to enterprise +✅ **API access** - Automate workflows + +**Perfect for:** +- Internal document workflows +- Legal document signing +- Contract management +- Invoice verification +- Compliance requirements +- Enterprise automation diff --git a/docs/Functionality/Security/Security.md b/docs/Functionality/Security/Security.md index a4d7602b..bbdef933 100644 --- a/docs/Functionality/Security/Security.md +++ b/docs/Functionality/Security/Security.md @@ -1,25 +1,154 @@ --- sidebar_position: 3 -description: List of all Security related features +description: Security features for PDFs and deployment configurations --- # Features - Security -- `add-password`: This feature allows users to secure their PDFs by adding a password. +## PDF Security Tools -- `remove-password`: With this feature, users can remove the password from a secured PDF. +### Password Protection -- `change-permissions`: This functionality allows users to change the permissions of a PDF, controlling how others can view and edit it. +- **`add-password`**: Secure your PDFs by adding password protection. Supports user passwords (opens PDF) and owner passwords (controls permissions). -- `add-watermark`: This feature enables users to add custom watermarks to their PDFs. +- **`remove-password`**: Remove password protection from secured PDFs (requires the original password). -- `cert-sign`: This feature enables users to digitally sign their PDFs using a certificate. For (hand-)written signatures see Features - Additional Utilities --> `sign` +### Permissions & Access Control -- `validate-signature`: Verify digital signatures and certificates in PDF documents, checking against custom certificate files +- **`change-permissions`**: Control how others can view and edit your PDFs. Set restrictions on printing, copying, editing, form filling, and more. -- `remove-cert-sign`: Removes digital signatures from any inputted PDF +- **`flatten`**: Flatten PDF form fields by merging them into the document, making them non-editable. Prevents further modifications to form data and interactive elements. -- `sanitize-pdf`: This allows the user to remove various things within the PDF which may cause security concern such as javascript, files, links, fonts and metadata. +- **`unlock-pdf-forms`**: Unlock form fields in a PDF document, allowing users to edit previously locked form fields and interactive elements. -- `auto-redact`: This features lets the user input text (or regex) to be redacted/blacked out from the pdf document. +### Signatures -- `get-info-on-pdf`: This grabs all info on a PDF such as version, font types, width height and any and all information it can find and puts it within a formatted JSON doc (or visual tables within UI) +- **`sign`**: Add handwritten, text, or image signatures to PDFs. Draw signatures with mouse/touchscreen, type your name, or upload signature images. For cryptographic digital signatures, use `cert-sign` instead. + + **Learn more:** [Sign PDF (Handwritten Signatures)](./Sign.md) + +- **`cert-sign`**: Digitally sign PDFs using X.509 certificates. Cryptographic signatures that prove identity and document integrity. Supports server-generated certificates, custom certificates, and organization certificates. + + **Learn more:** [Certificate Signing Guide](./Certificate-Signing.md) + +- **`validate-signature`**: Verify digital signatures and certificates in PDF documents. Check against trusted certificate chains including system trust, Adobe AATL, EU EUTL, and Mozilla CA bundle. + + **Learn more:** [Certificate Signing - Validation](./Certificate-Signing.md#validating-signatures) + +- **`remove-cert-sign`**: Remove digital certificate signatures from PDFs. Useful when you need to edit a signed document. + +### Content Security + +- **`add-watermark`**: Add custom watermarks to PDFs. Supports text and image watermarks with configurable position, opacity, and rotation. + +- **`sanitize-pdf`**: Remove potentially dangerous elements from PDFs including JavaScript, embedded files, external links, fonts, and metadata. Essential for security-conscious workflows. + +- **`auto-redact`**: Redact (black out) sensitive information from PDFs. Supports text search and regex patterns to find and permanently remove sensitive content. + +### Information & Metadata + +- **`get-info-on-pdf`**: Extract comprehensive PDF information including version, fonts, dimensions, permissions, metadata, and more. Output as JSON or visual tables. + +--- + +## Certificate Signature Validation + +Stirling-PDF provides enterprise-grade PDF signature validation with configurable trust chains. + +### Trust Sources + +Configure which certificate authorities to trust: + +- **System Trust Store** - Operating system's trusted CAs +- **Mozilla CA Bundle** - Mozilla's curated CA list +- **Adobe AATL** - Adobe Approved Trust List +- **EU EUTL** - EU Trusted List (eIDAS compliance) +- **Server Certificates** - Trust server-generated certificates + +### Revocation Checking + +Verify certificates haven't been revoked: + +- **OCSP** - Online Certificate Status Protocol (fast, real-time) +- **CRL** - Certificate Revocation Lists (works offline) +- **Dual Mode** - Try OCSP first, fall back to CRL + +### Configuration + +```yaml +security: + validation: + trust: + serverAsAnchor: true # Trust server-generated certificates + useSystemTrust: true # Use OS trust store + useMozillaBundle: true # Mozilla CA bundle + useAATL: false # Adobe Approved Trust List + useEUTL: false # EU Trusted List + allowAIA: false # Fetch intermediate certificates + revocation: + mode: none # Options: none, ocsp, crl, ocsp+crl + hardFail: false # Fail if revocation check fails +``` + +**Learn more:** [Certificate Signing - Configuration](./Certificate-Signing.md#configuration-examples) + +--- + +## CORS Configuration + +For split deployments where frontend and backend are on different domains, configure Cross-Origin Resource Sharing (CORS). + +### What is CORS? + +CORS allows your frontend (e.g., `https://pdf.example.com`) to communicate with a backend on a different domain (e.g., `https://api.example.com`). + +### Configuration + +```yaml +system: + corsAllowedOrigins: + - 'https://pdf.example.com' + - 'https://pdf.internal.company.com' +``` + +**Environment Variable:** +```bash +SYSTEM_CORSALLOWEDORIGINS=https://pdf.example.com,https://pdf.internal.company.com +``` + +### Use Cases + +- **Split Deployment** - Separate frontend and backend containers +- **CDN Distribution** - Serve frontend from CDN, backend from server +- **Multiple Frontends** - One backend serving multiple frontend instances +- **Development** - Frontend dev server communicating with backend + +### Security Considerations + +**✅ Best Practices:** +- Only allow specific, trusted origins +- Never use wildcard (`*`) in production +- Use HTTPS for all origins +- Verify origin headers server-side + +**⚠️ Common Mistakes:** +```yaml +# DON'T: Allow all origins (insecure) +corsAllowedOrigins: ['*'] + +# DO: Specify exact origins +corsAllowedOrigins: ['https://pdf.example.com'] +``` + +**Learn more:** +- [Split Deployment Configuration](../../Configuration/System%20and%20Security.md#cors-configuration) +- [Docker Split Mode](../../Installation/Docker%20Install.md#split-deployment-advanced-users) + +--- + +## Related Configuration + +For advanced security configuration, see: + +- **[System and Security Settings](../../Configuration/System%20and%20Security.md)** - JWT, session management, server certificates +- **[Certificate Signing](./Certificate-Signing.md)** - Comprehensive signing and validation guide +- **[Single Sign-On](../../Configuration/Single%20Sign-On%20Configuration.md)** - Enterprise authentication diff --git a/docs/Functionality/Security/Sign.md b/docs/Functionality/Security/Sign.md new file mode 100644 index 00000000..38977aff --- /dev/null +++ b/docs/Functionality/Security/Sign.md @@ -0,0 +1,372 @@ +--- +sidebar_position: 3 +id: Sign +title: Sign PDF (Handwritten Signatures) +description: Add handwritten, text, or image signatures to PDFs +--- + +# Sign PDF (Handwritten Signatures) + +**Tool ID:** `sign` + +Add handwritten signatures, text signatures, or image-based signatures to PDF documents. This tool is for visual/handwritten signatures - for certificate-based digital signatures, see [Certificate Signing](./Certificate-Signing.md). + +--- + +## What is PDF Signing? + +There are two types of PDF signatures: + +### Handwritten/Visual Signatures (This Tool) +- Draw your signature with mouse/touchscreen +- Add signature as text (typed name) +- Upload signature image (PNG, JPG) +- Visual appearance only +- Non-cryptographic + +**Use For:** Signing forms, contracts, letters where a visual signature is needed. + +### Digital/Certificate Signatures (Different Tool) +- Cryptographic signatures using certificates +- Proves identity and document integrity +- Cannot be forged +- Legally binding in many jurisdictions + +**Use For:** Legal documents, contracts requiring authentication, compliance requirements. + +**Learn More:** [Certificate Signing Guide](./Certificate-Signing.md) + +--- + +## How to Sign PDFs + +### Method 1: Draw Your Signature + +1. **Upload PDF** - Select document to sign +2. **Navigate to Page** - Find where you need to sign +3. **Click "Draw Signature"** - Opens signature pad +4. **Draw** - Use mouse or touchscreen to draw signature +5. **Position** - Drag signature to correct location +6. **Resize** - Adjust signature size +7. **Apply** - Add signature to PDF +8. **Download** - Save signed document + +**Tips:** +- Use a touchscreen or stylus for best results +- Draw slowly for smoother lines +- Click "Clear" to redraw if needed +- Make signature large enough to be legible + +### Method 2: Type Your Signature + +1. **Upload PDF** +2. **Click "Text Signature"** +3. **Type Your Name** - Enter text for signature +4. **Choose Font** - Select cursive/script font +5. **Position and Size** - Adjust placement +6. **Apply** - Add to PDF + +**Best For:** Quick signing when handwriting isn't practical. + +### Method 3: Upload Signature Image + +1. **Upload PDF** +2. **Click "Upload Signature"** +3. **Select Image** - Choose PNG/JPG of your signature +4. **Position and Resize** - Place on document +5. **Apply** - Add to PDF + +**Best For:** Consistent signature appearance across documents. + +--- + +## Using Pre-stored Signatures + +You can configure Stirling-PDF to load pre-stored signature files for quick access. This is useful for: +- Consistent signature appearance +- Quick signing of multiple documents +- Team/organization signature standards + +**Configuration:** [Sign with Custom Files](../../Configuration/Sign%20with%20custom%20files.md) + +--- + +## Signature Options + +### Appearance + +**Transparency:** +- Make signature background transparent +- Blend naturally with document + +**Color:** +- Traditional blue ink +- Black ink +- Custom colors + +**Size:** +- Adjust to fit signature line +- Maintain aspect ratio +- Scale up/down as needed + +### Position + +**Placement:** +- Drag and drop to any location +- Align to signature lines +- Position relative to form fields + +**Rotation:** +- Rotate if needed +- Adjust angle + +**Pages:** +- Sign on single page +- Add to multiple pages +- Different signatures per page + +--- + +## Best Practices + +### Creating Good Signatures + +**For Drawn Signatures:** +1. Use a stylus or touchscreen if possible +2. Draw slightly larger than needed (easier to scale down) +3. Use consistent speed for smooth lines +4. Practice in signature pad before applying +5. Keep signature simple (complex signatures may not look good) + +**For Image Signatures:** +1. Scan or photograph on white paper +2. High contrast (dark ink, white background) +3. Crop tightly around signature +4. Save as PNG with transparent background +5. High resolution (300 DPI minimum) + +### Document Signing + +**Before Signing:** +1. Read the entire document +2. Verify all details are correct +3. Ensure you have authority to sign +4. Check signature placement locations + +**While Signing:** +1. Place signature within designated areas +2. Don't cover important text +3. Size appropriately for signature line +4. Add date if required +5. Add initials if multiple pages + +**After Signing:** +1. Save original unsigned copy (optional) +2. Download signed PDF +3. Verify signature appears correctly +4. Distribute or submit as needed + +--- + +## Signature Types Comparison + +### Visual vs. Digital Signatures + +| Feature | Visual Signature (This Tool) | Digital Signature ([Certificate](./Certificate-Signing.md)) | +|---------|------------------------------|-------------------------------------------------------------| +| **Appearance** | Handwritten/image | May include visual + certificate info | +| **Security** | Visual only, can be copied | Cryptographically secure | +| **Authentication** | No verification | Proves signer identity | +| **Tamper Detection** | None | Detects any changes after signing | +| **Legal Validity** | Varies by jurisdiction | Legally binding in many countries | +| **Use Case** | Forms, casual documents | Contracts, legal documents | +| **Setup** | None required | Requires certificate | + +### When to Use Each + +**Use Visual Signing (This Tool) When:** +- ✅ Signing forms and applications +- ✅ Internal documents +- ✅ Casual agreements +- ✅ Documents that just need a visual signature +- ✅ No cryptographic verification needed + +**Use Digital Signing ([Certificate](./Certificate-Signing.md)) When:** +- ✅ Legal contracts requiring authentication +- ✅ Compliance and regulatory documents +- ✅ Documents that must prove integrity +- ✅ Multi-party agreements needing verification +- ✅ Legally binding signatures required + +--- + +## Multiple Signatures + +### Signing as Multiple People + +**Option 1: Sequential Signing** +1. First person signs and saves +2. Second person opens signed PDF +3. Second person adds their signature +4. Continue for additional signers + +**Option 2: Signature Coordination** +1. Each person creates their signature image +2. One person uploads all signatures +3. Places each signature in correct location + +### Team Signatures + +For organizations needing standardized signatures: +1. Store signature images on server +2. Configure pre-loaded signatures +3. Users select from available signatures +4. Consistent appearance across documents + +**Setup:** [Sign with Custom Files](../../Configuration/Sign%20with%20custom%20files.md) + +--- + +## Common Issues + +### "Signature looks pixelated" + +**Causes:** +- Drew too small and scaled up +- Low resolution image +- Compressed too much + +**Solutions:** +- Draw signature larger +- Use higher resolution image (300+ DPI) +- Save as PNG, not JPG + +### "Signature doesn't match signature line" + +**Causes:** +- Signature too large or small +- Wrong aspect ratio +- Position slightly off + +**Solutions:** +- Resize to fit signature line +- Adjust aspect ratio if needed +- Zoom in for precise positioning + +### "Can't draw smooth signature" + +**Causes:** +- Using mouse (not ideal for drawing) +- Drawing too fast +- No stylus/touchscreen + +**Solutions:** +- Use touchscreen or stylus if available +- Draw more slowly +- Consider uploading signature image instead +- Use text signature as alternative + +--- + +## Security Considerations + +### What Visual Signatures DON'T Provide + +**⚠️ No Authentication:** +- Anyone can draw/add any signature +- No way to verify who actually signed +- Can be copied from other documents + +**⚠️ No Tamper Protection:** +- Document can be edited after signing +- No way to detect changes +- Signature can be moved/removed + +**⚠️ Limited Legal Standing:** +- May not be legally binding +- Jurisdiction-dependent +- Check local laws and requirements + +### When Visual Signatures Are Sufficient + +**✅ Appropriate For:** +- Internal company forms +- Consent forms (non-legal) +- Acknowledgment of receipt +- Casual agreements +- Personal documents + +**❌ NOT Appropriate For:** +- Legal contracts (use [digital signatures](./Certificate-Signing.md)) +- Financial documents requiring verification +- Government/regulatory submissions +- Documents requiring proof of identity +- Multi-party agreements needing authentication + +--- + +## Legal Considerations + +### Electronic Signature Laws + +Different jurisdictions have different requirements: + +**US (ESIGN Act):** +- Visual signatures generally accepted +- Intent to sign is key +- Record retention required + +**EU (eIDAS Regulation):** +- Three signature levels: Simple, Advanced, Qualified +- Visual signatures = Simple Electronic Signatures +- Limited legal weight compared to qualified signatures + +**Always:** +- Check local laws and requirements +- Consult legal counsel for important documents +- Use digital signatures for legally binding documents + +--- + +## API Usage + +Add signatures programmatically via API: + +```bash +# This tool is primarily interactive +# For programmatic signing, use certificate signing: +curl -X POST http://stirling-pdf:8080/api/v1/sign/cert \ + -F "fileInput=@document.pdf" \ + -F "certFile=@certificate.p12" \ + -F "password=certpass" \ + -o signed.pdf +``` + +See [API Documentation](../../API.md) for complete endpoint reference. + +--- + +## Related Tools + +- **[Certificate Signing](./Certificate-Signing.md)** - Digital signatures with certificates +- **[Add Image](../Advanced-Tools.md#add-image)** - Add logos or other images +- **[Add Stamp](../Content-Editing/Content-Editing.md)** - Add official stamps +- **[Flatten](./Security.md#permissions--access-control)** - Make signatures non-editable +- **[Add Password](./Security.md#password-protection)** - Protect signed documents + +--- + +## Summary + +Stirling-PDF's Sign tool provides: + +✅ **Three signature methods** - Draw, type, or upload +✅ **Easy positioning** - Drag and drop placement +✅ **Customizable appearance** - Size, color, transparency +✅ **Multiple signatures** - Sign as multiple parties +✅ **Pre-stored signatures** - Quick access to saved signatures +✅ **No setup required** - Start signing immediately + +Perfect for forms, applications, and documents needing visual signatures! + +**Need authentication and legal validity?** Use [Certificate Signing](./Certificate-Signing.md) instead. diff --git a/docs/Functionality/The Technologies.md b/docs/Functionality/The Technologies.md index 6dd4774a..c5b9f085 100644 --- a/docs/Functionality/The Technologies.md +++ b/docs/Functionality/The Technologies.md @@ -1,29 +1,107 @@ --- sidebar_position: 0 -description: List of all technologies Stirling-PDF uses! +description: What makes Stirling-PDF powerful - technologies and capabilities! --- -# The Technologies Behind Stirling PDF -Stirling PDF harnesses several technologies throughout its implementation. - -# Java -As part of the JAVA framework to host the WebUI itself we use Spring Boot and Thymeleaf. -Apache PDFBox is the core of the PDF functionality within Stirling-PDF. -They offer a variety of methods to edit PDFs which we have then built Stirling-PDF on. -We also show all licenses used within our Java application [here](https://stirlingpdf.io/licenses). - -# JavaScript -- [PDF.js](https://github.com/mozilla/pdf.js) -- [PDF-LIB.js](https://github.com/Hopding/pdf-lib) - -# Core Components -- [Spring Boot + Thymeleaf](https://spring.io/projects/spring-boot) for the web framework -- [PDFBox](https://pdfbox.apache.org/) for majority of PDF manipulation -- [qpdf](https://qpdf.sourceforge.io/) for some PDF operations -- [LibreOffice](https://www.libreoffice.org/discover/libreoffice/) for advanced file conversions - -# Additional Technologies -- HTML, CSS, JavaScript for the frontend -- Docker for containerization -- jcefmaven (specifically for portable non-server version) - -For a comprehensive list of all technologies within the java application and their licenses, please visit our [licenses page](https://stirlingpdf.io/licenses). \ No newline at end of file +# What Makes Stirling-PDF Powerful + +Stirling-PDF combines server-side processing power with modern browser capabilities to give you the best PDF experience possible. + +## Key Features + +### Work Offline with Browser Storage +- **Your files stay in your browser** - No need to re-upload files when switching between tools +- **Faster workflows** - Skip the upload wait time when working with the same files +- **Preview thumbnails** - See what your files look like before processing +- **Privacy first** - Files are stored locally in your browser, not on our servers between operations + +### Undo and Redo Your Work +- **Made a mistake?** Go back to previous versions of your file +- **Try different options** - Experiment with settings and revert if needed +- **Work confidently** - Know you can always undo changes + +### File History Tracking +- **See what you've done** - Track all the operations you've performed +- **Jump back in time** - Restore earlier versions of your files +- **Clear when needed** - Remove local files and history whenever you want + +### Desktop Applications +- **Windows, Mac, and Linux** native applications available +- **Open PDFs directly** - Double-click PDF files to open them in Stirling-PDF +- **No browser needed** - Standalone application with all features +- **Automatic updates** - Stay up to date with the latest features + +### Modern, Responsive Interface +- **Fast and smooth** - Modern web technology for a better experience +- **Works on any device** - Responsive design for desktop, tablet, and mobile +- **Real-time previews** - See changes as you make them +- **Dark mode** - Easy on your eyes + +### Flexible Deployment Options +- **All-in-one container** - Simple Docker deployment with everything included +- **Split frontend and backend** - Scale and deploy components separately +- **Serve frontend from CDN** - Ultra-fast page loads worldwide +- **Run anywhere** - Cloud, self-hosted, or on your desktop + +## The Technology Behind It + +### Processing Power (Server-Side) +Stirling-PDF uses powerful open-source tools to handle complex PDF operations: + +- **[PDFBox](https://pdfbox.apache.org/)** - Core PDF manipulation for most operations +- **[LibreOffice](https://www.libreoffice.org/)** - Advanced file conversions (Office documents, images, etc.) +- **[qpdf](https://qpdf.sourceforge.io/)** - Specialized PDF operations +- **[Tesseract OCR](https://github.com/tesseract-ocr/tesseract)** - Extract text from images in PDFs +- **[OpenCV](https://opencv.org/)** - Image processing and computer vision operations + +### Modern Web Experience (Browser-Side) +A fast, modern interface built with powerful frontend technologies: + +**Core Framework:** +- **[React](https://react.dev/)** - Modern UI framework for responsive interfaces +- **[TypeScript](https://www.typescriptlang.org/)** - Type-safe development +- **[Vite](https://vitejs.dev/)** - Lightning-fast build tool + +**PDF Rendering & Interaction:** +- **[EmbedPDF](https://github.com/EmbedPDF/EmbedPDF)** - Advanced PDF viewer with annotation support +- **[PDF.js](https://mozilla.github.io/pdf.js/)** - Mozilla's PDF rendering engine +- **[pdf-lib](https://pdf-lib.js.org/)** - Client-side PDF manipulation + +**UI & Components:** +- **[Mantine](https://mantine.dev/)** - Modern React component library +- **[Material UI](https://mui.com/)** - Additional UI components +- **[Tailwind CSS](https://tailwindcss.com/)** - Utility-first styling +- **[Iconify](https://iconify.design/)** - Unified icon framework + +**Enhanced Features:** +- **[i18next](https://www.i18next.com/)** - Internationalization (30+ languages) +- **[signature_pad](https://github.com/szimek/signature_pad)** - Canvas-based signatures +- **[JSZip](https://stuk.github.io/jszip/)** - Client-side ZIP handling +- **[Axios](https://axios-http.com/)** - HTTP client for API communication + +### Desktop Applications +Native applications built with modern desktop technology: + +- **[Tauri](https://tauri.app/)** - Rust-based native app framework + - **Automatic PDF file association** - Open PDFs directly in Stirling-PDF + - **Bundled processing tools** - Everything you need included + - **System integration** - Feels like a native application + - **One-click installers** - Easy installation on all platforms + - **Small footprint** - Efficient resource usage + +## Open Source and Transparent + +All the technologies we use are open source and well-documented: + +- View all Java application licenses on our [licenses page](https://stirlingpdf.io/licenses) +- Review our source code on [GitHub](https://github.com/Stirling-Tools/Stirling-PDF) +- No vendor lock-in - Deploy and customize as needed +- Community-driven development + +## Privacy and Security + +Designed with privacy in mind: + +- **Browser storage stays local** - Files cached in your browser never leave your device +- **Open source** - Audit the code yourself +- **No tracking required** - Disable analytics completely if desired +- **Your data, your control** - Self-host on your own infrastructure \ No newline at end of file diff --git a/docs/Functionality/_category_.json b/docs/Functionality/_category_.json index e472811f..3ec88ff0 100644 --- a/docs/Functionality/_category_.json +++ b/docs/Functionality/_category_.json @@ -2,7 +2,7 @@ "label": "Functionality", "position": 2, "link": { - "type": "generated-index", - "description": "All functionality and their categories within Stirling-PDF." + "type": "doc", + "id": "Functionality/Functionality" } } diff --git a/docs/Getting Started.md b/docs/Getting Started.md index 31d01745..24415781 100644 --- a/docs/Getting Started.md +++ b/docs/Getting Started.md @@ -4,7 +4,7 @@ slug: / --- ## Benefits of Stirling-PDF -- **Extensive PDF Functionality:** Access 50+ tools, including signing, converting, merging, and more. +- **Extensive PDF Functionality:** Access 60+ tools, including signing, converting, merging, and more. - **Advanced Customization:** Deep customization, themes, and environment variables. - **Enterprise Features:** SSO, user management, and permission controls. - **Data Security:** Local file processing with automatic deletion post-task. @@ -13,53 +13,118 @@ slug: / - **Open-Source:** Community-driven with frequent updates and GitHub support. - **Multi-Language Support:** Available in 38+ languages with active translations. -Please feel free to request new features or report bugs through our [GitHub](https://github.com/Stirling-Tools/Stirling-PDF/issues) or [Discord](https://discord.gg/Cn8pWhQRxZ). +## Welcome to Stirling-PDF +:::tip Upgrading from V1? +See the **[Migration Guide](./Migration/Overview)** for what's new and how to upgrade smoothly. +::: -## Introduction +Stirling-PDF is a locally hosted web application that allows you to perform various operations on PDF files. With 60+ tools, flexible deployment options, and enterprise features, it's the comprehensive PDF solution for individuals and organizations. -This guide will help you choose the right installation method based on your needs. -We prioritise and focus on our Server deployment options however we also offer a [Ultra-Lite model](/Installation/Versions) for desktop users +--- + +## What's New in V2 + +V2 brings major improvements to performance, workflow, and deployment flexibility: + +- **📁 Stateful Processing** - Upload once, use across multiple tools without re-uploading +- **⏮️ Undo & Redo** - Made a mistake? Just undo it! Full version history included +- **🖥️ Native Desktop Apps** - Lightning-fast startup, "Open with" integration, offline capable +- **🔀 Split Deployment** - Scale frontend and backend independently for enterprise use +- **⚙️ In-App Settings** - Configure everything through the UI, no file editing needed + +--- + +## Documentation Guide + +### 👤 For Individual Users + +**[Tool Reference](./Functionality/Functionality.md)** +Browse all 60+ PDF tools with descriptions and use cases + +--- + +### 🏢 For Organizations & IT Teams + +**[Production Deployment Guide](./Server-Admin-Onboarding.md)** +Complete walkthrough: installation → configuration → security → monitoring + +**[Pro & Enterprise Features](./Pro.md)** +SSO, advanced monitoring, external databases, and priority support + +**[Configuration Options](./Configuration/Extra-Settings.md)** +All configuration options for Docker and server deployments + +--- + +### 🔧 For Developers & Integration -## Choose Your Installation Type +**[API Documentation](./API.md)** +Integrate Stirling-PDF into your applications and workflows -### For Desktop Users -If you want to run Stirling PDF on your personal computer: +**[Configuration](./Configuration/System%20and%20Security.md)** +SSO, split deployment, certificates, security settings, and more -1. **Windows Users** - - Download our installer ([Stirling-PDF-win-installer.exe](https://files.stirlingpdf.com/win-installer.exe)) for a simple, standalone experience - - Refer to our [Windows Installation Guide](/Installation/Windows%20Installation) for detailed setup instructions +**[Contribute Guide](./Contribute.md)** +Help improve Stirling-PDF - development setup and guidelines -2. **Linux/Unix Users** - - Dedicated Linux installer to be released soon, Currently you must run Stirling-PDF as a java jar - - Follow our comprehensive [Unix Installation Guide](/Installation/Unix%20Installation) for a native installation +--- + +## Installation + +Choose how you want to run Stirling-PDF based on your needs: + +### 🖥️ Desktop Applications + +Native apps with offline support and system integration: + +| Platform | Download | Guide | +|----------|----------|-------| +| **Windows** | [Installer](https://files.stirlingpdf.com/win-installer.exe) | [Windows Guide](./Installation/Windows.md) | +| **Mac (Apple Silicon)** | [DMG](https://files.stirlingpdf.com/mac-installer.dmg) | [Mac Guide](./Installation/Mac.md) | +| **Mac (Intel)** | [DMG](https://files.stirlingpdf.com/mac-x86_64-installer.dmg) | [Mac Guide](./Installation/Mac.md) | +| **Linux** | AppImage/DEB/RPM | [Unix Guide](./Installation/Unix.md) | + +**Features:** Lightning-fast startup, "Open with" integration, works completely offline + +--- -2. **Mac Users** - - Download our installer ([Apple Silicon](https://files.stirlingpdf.com/mac-installer.dmg)/[Intel](https://files.stirlingpdf.com/mac-x86_64-installer.dmg)) for a simple, standalone experience - - Follow our comprehensive [Mac Installation Guide](/Installation/Mac%20Installation) for a native installation - -### For Server Deployments -If you're looking to host Stirling PDF as a service: +### 🐳 Docker Deployment -1. **Docker Users** - - We recommend using our Docker images for the easiest deployment - - Check our [Docker Installation Guide](/Installation/Docker%20Install) for setup instructions - - Choose from three versions: - - Fat (latest-fat): Includes additional fonts and security features - - Standard (latest): Balanced features and size - - Ultra-Lite (latest-ultra-lite): Minimal size with core features +Recommended for server deployments and organizations: -2. **Manual Server Setup** - - For bare metal server installations - - Use Stirling-PDF.jar package - - Follow our [Unix Installation Guide](/Installation/Unix%20Installation) for setup steps +**Quick Start:** +```bash +docker run -d \ + -p 8080:8080 \ + -v ./stirling-data:/configs \ + stirlingtools/stirling-pdf:latest +``` -## Quick Reference Table +**Available versions:** +- `latest` - Standard version (recommended) +- `latest-fat` - Includes extra fonts and security features +- `latest-ultra-lite` - Minimal size for resource-constrained environments + +**Full guide:** [Docker Installation Guide](./Installation/Docker%20Install.md) + +--- + +### ⚙️ Manual Server Setup + +For bare metal installations or environments without Docker: + +1. Download `Stirling-PDF.jar` +2. Install Java 21+ +3. Install dependencies (LibreOffice, Tesseract for OCR) +4. Run the JAR file + +**Full guide:** [Unix Installation Guide](./Installation/Unix.md) + +--- -| Installation Type | Best For | Documentation Link | -|------------------|----------|-------------------| -| Stirling-PDF-installer.exe | Windows desktop users | [Windows Guide](/Installation/Windows%20Installation) | -| Stirling-PDF.jar | Server deployments without Docker | [Unix Guide](/Installation/Unix%20Installation) | -| Docker Images | Server deployments with Docker | [Docker Guide](/Installation/Docker%20Install) | +## Quick Links -Choose the installation method that best suits your needs and environment. Each guide provides detailed instructions for getting Stirling PDF up and running on your system. +- **Questions?** Check our **[FAQ](./FAQ.md)** +- **Issues?** Report on **[GitHub](https://github.com/Stirling-Tools/Stirling-PDF/issues)** +- **Community?** Join our **[Discord](https://discord.gg/Cn8pWhQRxZ)** diff --git a/docs/Installation/Development Setup.md b/docs/Installation/Development Setup.md new file mode 100644 index 00000000..b9857f3d --- /dev/null +++ b/docs/Installation/Development Setup.md @@ -0,0 +1,271 @@ +--- +sidebar_position: 6 +id: Development Setup +title: Development Setup Guide +--- + +# Development Setup for Stirling-PDF + +This guide covers setting up a local development environment for Stirling-PDF, including both backend and frontend (V2.0+) development. + +## Prerequisites + +Before getting started, ensure you have the following installed: + +- **Java**: JDK 21 or later +- **Node.js**: Version 18+ for frontend development +- **npm**: Comes with Node.js +- **Docker**: For testing and containerization +- **Gradle**: Included in the repository (use `./gradlew`) +- **Git**: For version control + +### IDE Setup + +Recommended IDEs: +- **IntelliJ IDEA** (recommended for Java development) +- **Visual Studio Code** (good for both frontend and backend) +- **Eclipse** + +**Important**: Install the Lombok plugin for your IDE. Visit [projectlombok.org/setup](https://projectlombok.org/setup/) for IDE-specific instructions. + +## Getting Started + +### 1. Clone the Repository + +```bash +git clone https://github.com/Stirling-Tools/Stirling-PDF.git +cd Stirling-PDF +``` + +### 2. Backend Development + +#### Running the Backend + +```bash +# Build and run the Spring Boot application +./gradlew bootRun +``` + +The backend will start on `http://localhost:8080` + +#### Code Formatting + +Stirling-PDF uses Spotless for code formatting: + +```bash +# Apply formatting (run before committing) +./gradlew spotlessApply +``` + +#### Enable Security Features (Optional) + +For local testing with full security features: + +```bash +# Set environment variable +export SECURITY_ENABLELOGIN=true + +# Or add to your IDE's run configuration +-DSECURITY_ENABLELOGIN=true +``` + +### 3. Frontend Development (V2.0+) + +#### Initial Setup + +```bash +# Navigate to frontend directory +cd frontend + +# Install dependencies +npm install +``` + +#### Running the Development Server + +```bash +# Start Vite dev server +npm run dev +``` + +The frontend will start on `http://localhost:5173` + +**Important**: The Vite dev server automatically proxies API requests to the backend at `localhost:8080`. Make sure the backend is running before starting the frontend dev server. + +#### Frontend Technology Stack + +- **Framework**: React + TypeScript +- **Build Tool**: Vite +- **UI Library**: Mantine UI +- **Styling**: TailwindCSS +- **PDF Rendering**: PDF.js +- **PDF Manipulation**: PDF-LIB +- **Storage**: IndexedDB for client-side file storage +- **i18n**: i18next for internationalization + +### 4. Desktop Application Development + +Stirling-PDF V2.0 uses Tauri for native desktop applications: + +```bash +# Navigate to frontend directory +cd frontend + +# Run desktop app in development mode +npm run tauri-dev + +# Build desktop application +npm run tauri-build +``` + +## Development Workflow + +### Full Development Setup + +1. **Terminal 1** - Backend: + ```bash + ./gradlew bootRun + ``` + +2. **Terminal 2** - Frontend: + ```bash + cd frontend + npm run dev + ``` + +3. **Access the application**: + - Frontend (React): http://localhost:5173 + - Backend API: http://localhost:8080 + - API Documentation: http://localhost:8080/swagger-ui/index.html + +### Building the Project + +```bash +# Full build including frontend +./gradlew clean build + +# Backend only +./gradlew build -x npm_run_build +``` + +## Architecture Overview + +### Backend Architecture + +- **Framework**: Spring Boot +- **PDF Processing**: Apache PDFBox +- **Document Conversion**: LibreOffice (optional dependency) +- **PDF Optimization**: qpdf (optional dependency) +- **Security**: Spring Security (optional, controlled by `SECURITY_ENABLELOGIN`) + +### Frontend Architecture (V2.0) + +- **State Management**: React Context (FileContext for file operations) +- **File Storage**: IndexedDB for client-side persistence +- **Tool Architecture**: Hook-based pattern using `useToolOperation` +- **Memory Management**: Manual cleanup for PDF.js documents and blob URLs +- **Performance Target**: Improved handling of large PDFs with better memory management + +### Key Frontend Concepts + +#### FileContext +Central state management for all file operations: +- Active files and their variants +- Tool navigation state +- Memory management (PDF.js documents, blob URLs, Web Workers) +- IndexedDB persistence + +#### Tool Development +Tools use a modular hook-based architecture: +- **useToolOperation**: Main orchestrator hook +- **useToolState**: UI state management +- **useToolApiCalls**: HTTP requests and file processing +- **useToolResources**: Blob URLs, thumbnails, ZIP downloads + +See `ADDING_TOOLS.md` in the repository for detailed tool development guide. + +## Testing + +### Running Tests + +```bash +# Run all tests +./gradlew test + +# Full Docker test suite (tests all variants) +./test.sh +``` + +### Testing Different Versions + +Stirling-PDF offers three Docker variants: +- **Ultra-lite**: Basic PDF operations only +- **Standard** (latest): Full feature set +- **Fat** (latest-fat): Pre-downloaded dependencies for air-gapped environments + +## Configuration Files + +### Backend Configuration + +- `src/main/resources/application.yml`: Main application configuration +- `settings.yml`: User-configurable settings (generated on first run) + +### Frontend Configuration + +- `frontend/.env`: Environment variables for development +- `frontend/vite.config.ts`: Vite build configuration +- `frontend/public/locales/`: Translation files (JSON format) + +## Common Development Tasks + +### Adding Translations + +**V2.0** uses JSON translation files: + +1. Navigate to `frontend/public/locales/` +2. **Important**: Only update `en-GB` files (never `en-US`) +3. Edit the appropriate JSON file (e.g., `common.json`, `tools.json`) +4. Other languages are managed by the community + +### Adding a New PDF Tool + +See the repository's `ADDING_TOOLS.md` for detailed instructions. Quick overview: + +1. Create backend controller endpoint +2. Create frontend tool hook using `useToolOperation` +3. Add UI component +4. Add translations +5. Register tool in routing + +## Troubleshooting + +### Backend Issues + +- **Port already in use**: Change port in `application.yml` or use `-Dserver.port=8081` +- **Lombok errors**: Ensure Lombok plugin is installed in your IDE +- **Build failures**: Run `./gradlew clean` and try again + +### Frontend Issues + +- **npm install fails**: Delete `node_modules` and `package-lock.json`, then run `npm install` again +- **Proxy errors**: Ensure backend is running on port 8080 +- **Memory issues with large PDFs**: This is expected during development; memory management is optimized in production builds + +### Docker Issues + +- **Build failures**: Ensure Docker has enough memory allocated (at least 4GB recommended) +- **Permission issues**: Use Docker without sudo or add your user to the docker group + +## Additional Resources + +- **GitHub Repository**: [Stirling-Tools/Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF) +- **CLAUDE.md**: Detailed architecture and development patterns +- **DeveloperGuide.md**: Comprehensive developer documentation +- **ADDING_TOOLS.md**: Guide for creating new PDF tools +- **CONTRIBUTING.md**: Contribution guidelines + +## Need Help? + +- **GitHub Issues**: [Report bugs and request features](https://github.com/Stirling-Tools/Stirling-PDF/issues) +- **Discord**: [Join our community](https://discord.gg/Cn8pWhQRxZ) +- **Discussions**: [Ask questions on GitHub Discussions](https://github.com/Stirling-Tools/Stirling-PDF/discussions) diff --git a/docs/Installation/Docker Install.md b/docs/Installation/Docker Install.md index 53eec782..6f53af31 100644 --- a/docs/Installation/Docker Install.md +++ b/docs/Installation/Docker Install.md @@ -3,56 +3,323 @@ sidebar_position: 2 id: Docker Install title: Docker Guide --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; -# Docker Images for Stirling-PDF +# Docker Installation for Stirling-PDF -The docker image for Stirling-PDF is available on Docker Hub at [stirlingtools/stirling-pdf](https://hub.docker.com/r/stirlingtools/stirling-pdf) or on Github at [stirling-pdf](https://github.com/Stirling-Tools/Stirling-PDF/pkgs/container/stirling-pdf). +Run Stirling-PDF in Docker for easy self-hosting, automatic updates, and flexible deployment. -Please note that Stirling PDF offers three distinct versions tailored for various hardware configurations. Users seeking optimal performance on lower-end hardware can choose from the specific versions provided. For those who prefer the most recent features and updates, it is recommended to continue using the latest tag. +## Quick Start -| Version | Latest Tag | -| ---------- | ------------------- | -| Fat | `latest-fat` | -| Standard | `latest` | -| Ultra Lite | `latest-ultra-lite` | + + -### Run docker container with `docker run` +```bash +docker run -d \ + --name stirling-pdf \ + -p 8080:8080 \ + -v ./stirling-data:/configs \ + stirlingtools/stirling-pdf:latest +``` + + + + +Create `docker-compose.yml`: + +```yaml +version: '3.3' +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest + container_name: stirling-pdf + ports: + - '8080:8080' + volumes: + - ./stirling-data:/configs + restart: unless-stopped +``` + +Then run: +```bash +docker-compose up -d +``` + + + + +Then open `http://localhost:8080` in your browser! + +## Choosing Your Version + +Stirling-PDF offers three versions depending on your needs: + +| Version | Tag | What's Included | Best For | +|---------|-----|-----------------|----------| +| **Standard** | `latest` | All PDF features | Most users, balanced features & size | +| **Fat** | `latest-fat` | Everything + extra tools | Maximum features, larger container | +| **Ultra-Lite** | `latest-ultra-lite` | Core features only | Limited resources, minimal size | + +**Most users should use `latest`** - it has everything you need. + +### When to use each version: + +**Standard (`latest`)** - Use this if: +- ✅ You want all PDF features +- ✅ You have normal server/computer specs +- ✅ You're not sure which to pick + +**Fat (`latest-fat`)** - Use this if: +- 📦 You need every possible conversion format +- 📦 You want all optional tools included +- 📦 Disk space isn't a concern + +**Ultra-Lite (`latest-ultra-lite`)** - Use this if: +- 💾 Running on very limited hardware (Raspberry Pi, low-end VPS) +- 💾 Want fastest startup time +- 💾 Only need basic PDF operations + +To use a different version, just change the tag: +```bash +docker run -d stirlingtools/stirling-pdf:latest-ultra-lite +``` + +## Deployment Options (V2.0+) + +V2.0 lets you run Stirling-PDF in different ways depending on your needs: + +### Simple Deployment (Recommended) + +**MODE=BOTH (Default)** - Everything in one container + +- ✅ **Easiest setup** - One container does it all +- ✅ **Perfect for most users** - Single server hosting +- ✅ **No extra configuration** - Works out of the box ```bash docker run -d \ --name stirling-pdf \ -p 8080:8080 \ - -v "./StirlingPDF/trainingData:/usr/share/tessdata" \ - -v "./StirlingPDF/extraConfigs:/configs" \ - -v "./StirlingPDF/customFiles:/customFiles/" \ - -v "./StirlingPDF/logs:/logs/" \ - -v "./StirlingPDF/pipeline:/pipeline/" \ - -e DISABLE_ADDITIONAL_FEATURES=true \ + -e MODE=BOTH \ + stirlingtools/stirling-pdf:latest +``` + +**Use this if:** You're running on a single server and want the simplest setup. + +### Advanced Deployment (Split Frontend/Backend) + +For advanced users who need to scale components independently: + +**MODE=BACKEND** - Backend API only +- Runs the PDF processing API server +- Multiple frontends can connect to one backend +- Scale processing power independently + +**MODE=FRONTEND** - Frontend only +- Serves the React web interface +- Can be deployed to CDN for global distribution +- Multiple instances for load balancing + +**Use split mode if:** +- Scaling frontend and backend independently +- CDN deployment for global frontend distribution +- Running multiple frontend instances with shared backend +- Microservices/containerized architecture + +### V2.0 Configuration Variables + +| Variable | What It Does | When You Need It | Example | +|----------|--------------|------------------|---------| +| `MODE` | Deployment type | Always (defaults to BOTH) | `MODE=BOTH` | +| `BACKEND_INTERNAL_PORT` | Internal backend port | Only for MODE=BOTH customization | `BACKEND_INTERNAL_PORT=8081` | +| `VITE_API_BASE_URL` | Where the backend is located | Required for MODE=FRONTEND | `VITE_API_BASE_URL=http://backend:8080` | + +**Most users don't need to set these** - the defaults work great! + +## Full Setup (With All Features) + +Want OCR, custom settings, and logging? Add more volumes: + + + + +```bash +docker run -d \ + --name stirling-pdf \ + -p 8080:8080 \ + -v ./stirling-data/tessdata:/usr/share/tessdata \ + -v ./stirling-data/configs:/configs \ + -v ./stirling-data/logs:/logs \ + -v ./stirling-data/pipeline:/pipeline \ + -e SECURITY_ENABLELOGIN=false \ -e LANGS=en_GB \ - docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest + stirlingtools/stirling-pdf:latest ``` -### Run docker container with `docker compose` + + + +Create `docker-compose.yml`: -- `docker-compose.yml` ```yaml version: '3.3' services: stirling-pdf: - image: docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest + image: stirlingtools/stirling-pdf:latest + container_name: stirling-pdf ports: - '8080:8080' volumes: - - ./StirlingPDF/trainingData:/usr/share/tessdata # Required for extra OCR languages - - ./StirlingPDF/extraConfigs:/configs - - ./StirlingPDF/customFiles:/customFiles/ - - ./StirlingPDF/logs:/logs/ - - ./StirlingPDF/pipeline:/pipeline/ + - ./stirling-data/tessdata:/usr/share/tessdata # OCR language files + - ./stirling-data/configs:/configs # Settings & database + - ./stirling-data/logs:/logs # Application logs + - ./stirling-data/pipeline:/pipeline # Automation configs + environment: + - SECURITY_ENABLELOGIN=false # Set true to enable user authentication + - LANGS=en_GB # Interface language + restart: unless-stopped +``` + +Then run: +```bash +docker-compose up -d +``` + + + + +**What each volume does:** +- `/configs` - Your settings and database +- `/usr/share/tessdata` - OCR language files +- `/logs` - Application logs +- `/pipeline` - Automation configurations + +**What this does:** +- Runs Stirling-PDF on port 8080 +- Stores data in `./stirling-data` folder +- Automatically restarts if it crashes +- Everything in one container (MODE=BOTH is default) + +### Split Deployment (Advanced Users) + +Want to scale frontend and backend independently? Use this: + +Create `docker-compose.yml`: + +```yaml +version: '3.3' +services: + # Backend - PDF processing engine + stirling-backend: + image: stirlingtools/stirling-pdf:latest + container_name: stirling-backend + ports: + - '8081:8080' + volumes: + - ./stirling-data/tessdata:/usr/share/tessdata + - ./stirling-data/configs:/configs + - ./stirling-data/logs:/logs + - ./stirling-data/pipeline:/pipeline environment: - - DISABLE_ADDITIONAL_FEATURES=false - - LANGS=en_GB + - MODE=BACKEND # Backend only + restart: unless-stopped + + # Frontend - Web interface + stirling-frontend: + image: stirlingtools/stirling-pdf:latest + container_name: stirling-frontend + ports: + - '8080:8080' + environment: + - MODE=FRONTEND # Frontend only + - VITE_API_BASE_URL=http://stirling-backend:8080 # Where backend is located + depends_on: + - stirling-backend + restart: unless-stopped +``` + +**Benefits of split deployment:** +- Scale frontend and backend independently +- Run multiple frontends with one backend +- Deploy frontend globally via CDN +- Better resource allocation + +**When to use split:** +- High traffic websites +- Global user base +- Microservices architecture +- Need independent scaling + +## Updating Stirling-PDF + +### Docker Run +```bash +docker stop stirling-pdf +docker rm stirling-pdf +docker pull stirlingtools/stirling-pdf:latest +# Then run your original docker run command +``` + +### Docker Compose +```bash +docker-compose down +docker-compose pull +docker-compose up -d +``` + +Your data is safe in the volumes and will persist across updates! + +## Common Configurations + +### Enable User Authentication +```yaml +environment: + - SECURITY_ENABLELOGIN=true +``` + +### Change Interface Language +```yaml +environment: + - LANGS=es_ES # Spanish, or en_GB, fr_FR, de_DE, etc. ``` -### Extras +### Multiple Languages +```yaml +environment: + - LANGS=en_GB,es_ES,fr_FR # Comma-separated +``` + +### Custom Port +```yaml +ports: + - '9000:8080' # Access at http://localhost:9000 +``` + +## Next Steps + +- **Add OCR Languages**: See [OCR Configuration](../Configuration/OCR.md) +- **Enable Authentication**: See [Security Settings](../Configuration/System%20and%20Security.md) +- **Setup Automation**: See [Pipeline Configuration](../Configuration/Pipeline.md) +- **More Settings**: See [Configuration](../Configuration/Configuration.md) + +## Troubleshooting + +**Can't access at localhost:8080?** +- Check if port 8080 is already in use +- Try a different port: `-p 9000:8080` +- Check firewall settings + +**Permission errors with volumes?** +- Make sure the directories exist +- Check folder permissions: `chmod -R 755 ./stirling-data` + +**Container keeps restarting?** +- Check logs: `docker logs stirling-pdf` +- Check system resources (RAM, disk space) +- Try ultra-lite version for limited hardware -For extra parameters and customization please check the [advanced configuration](https://docs.stirlingpdf.com/Advanced%20Configuration/How%20to%20add%20configurations) page! +**Features not working?** +- Some features need dependencies +- Check logs for missing requirements +- Consider using `latest-fat` for all features diff --git a/docs/Installation/Mac.md b/docs/Installation/Mac.md index 23be601d..8583da23 100644 --- a/docs/Installation/Mac.md +++ b/docs/Installation/Mac.md @@ -3,61 +3,149 @@ sidebar_position: 2 id: Mac Installation title: Mac Installation Guide --- - # MacOS Installation Guide for Stirling PDF +# MacOS Installation Guide for Stirling PDF -Stirling PDF can be run on MacOS either by using the `.dmg` installer or directly from the `.jar` file. +Stirling PDF for Mac is available as a **native desktop application** or can run as a **server** using the JAR file. -### Prerequisites: -- Java 17 or 21 (_21 preferred_) - - Install via Homebrew: `brew install openjdk@21` +## Desktop Application (Recommended) -## Running via the installer -| [Apple Silicon chips](https://files.stirlingpdf.com/mac-installer.dmg) | [Intel chips](https://files.stirlingpdf.com/mac-x86_64-installer.dmg) | -|------------------------------------------------------------------------|-----------------------------------------------------------------------| +**V2.0 brings a native Mac desktop experience** with all PDF tools available offline! -Download the `.dmg` file and follow the instructions to install the app. A window should pop up allowing you to copy the -app to your Applications folder. +### What You Get -![mac-installer.png](../../static/img/mac-installer.png) +- ✅ **Native macOS application** - Optimized for both Apple Silicon and Intel Macs +- ✅ **Open PDFs directly** - Double-click any PDF to open in Stirling-PDF +- ✅ **Works completely offline** - No internet required after installation +- ✅ **All features included** - Every PDF tool available +- ✅ **Better performance** - Native speed on M1/M2/M3 chips +- ✅ **No browser needed** - Standalone application +- ✅ **Menu bar integration** - Feels like a native Mac app -The app should now be located in Applications. Head to your Applications folder to open the app. When you open the app -for the first time, it will be blocked by MacOS because it has not been officially verified by Apple yet. +### Installation Steps -![mac-app-blocked.png](../../static/img/mac-app-blocked.png) +**1. Download the right version for your Mac:** -This is only temporary but in the meantime, open System Settings and go to Privacy & Security and then scroll down to the -Security section. You should see the same message indicating the app being blocked. Click 'Open Anyway', you may be -prompted to enter your password to allow the app. Once you have done this, head back to Applications and open the app -again. It should open with no issue this time. +| Chip Type | Download Link | +|-----------|--------------| +| **Apple Silicon** (M1/M2/M3) | [Download for Apple Silicon](https://files.stirlingpdf.com/mac-installer.dmg) | +| **Intel** processors | [Download for Intel](https://files.stirlingpdf.com/mac-x86_64-installer.dmg) | -![mac-security-allow.png](../../static/img/mac-security-allow.png) +**Not sure which chip you have?** +- Click the Apple menu → "About This Mac" +- Look at "Chip" or "Processor" +- If it says "M1", "M2", or "M3" → Use Apple Silicon version +- If it says "Intel" → Use Intel version -## Running via the `.jar` file -Download the `.jar` file [here](https://files.stirlingpdf.com/Stirling-PDF.jar). -1. Open Terminal -2. Navigate to the folder containing the JAR: +**2. Install the application:** + +1. Open the downloaded `.dmg` file +2. Drag Stirling-PDF to your Applications folder + +![mac-installer.png](/img/mac-installer.png) + +**3. First-time launch (Security):** + +macOS will block the app on first launch because it's not from the App Store: + +![mac-app-blocked.png](/img/mac-app-blocked.png) + +**To allow Stirling-PDF:** +1. Open **System Settings** → **Privacy & Security** +2. Scroll down to the **Security** section +3. Click **"Open Anyway"** next to the Stirling-PDF message +4. Enter your password if prompted +5. Go back to Applications and launch Stirling-PDF again + +![mac-security-allow.png](/img/mac-security-allow.png) + +The app will now open normally every time! + +### Using the Desktop App + +**Opening PDFs:** +- **Double-click any PDF file** - Opens in Stirling-PDF +- **Right-click → Open With → Stirling-PDF** +- **Drag and drop** files into the application +- **File → Open** from the menu bar + +**Making Stirling-PDF your default PDF viewer:** +1. Right-click (or Control+click) any PDF file +2. Select **"Get Info"** +3. Under **"Open with"**, choose **Stirling-PDF** +4. Click **"Change All"** to apply to all PDFs +5. Confirm when prompted + +**Benefits of desktop app:** +- Files stay on your Mac (not in browser storage) +- Work without internet connection +- Native performance (especially on Apple Silicon) +- Unlimited file storage +- Menu bar integration +- macOS gestures and features work + +## Server Version (For Hosting and Sharing) + +Want to host Stirling-PDF on a Mac server for multiple users? Use the JAR file version. + +### Prerequisites + +Install Java 21 (required for server version): + +```bash +# Install Homebrew if you don't have it +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +# Install Java 21 +brew install openjdk@21 + +# Add to your PATH (add to ~/.zshrc to make permanent) +export PATH="/usr/local/opt/openjdk@21/bin:$PATH" +``` + +### Running the Server + +1. **Download the JAR file**: [Stirling-PDF.jar](https://files.stirlingpdf.com/Stirling-PDF.jar) + +2. **Open Terminal** and navigate to the download folder: ```bash - cd /path/to/folder/containing/jar + cd ~/Downloads # Or wherever you saved the JAR ``` -3. Run the JAR file: + +3. **Run Stirling-PDF**: ```bash java -jar Stirling-PDF.jar ``` -_For convenience, you can create a simple script:_ -1. Create a file named run-stirling.sh and add the following contents: - ```bash - #!/bin/bash - cd /path/to/folder/containing/jar +4. **Access via browser** at `http://localhost:8080` + +5. **Share with others** on your network at `http://your-mac-ip:8080` + +### Creating a Convenience Script + +For easier launching, create a startup script: + +1. **Create the script**: + ```bash + nano ~/run-stirling.sh + ``` + +2. **Add these contents**: + ```bash + #!/bin/bash + cd ~/Downloads # Change to where your JAR is located java -jar Stirling-PDF.jar ``` -2. Make it executable: + +3. **Save and exit** (Ctrl+X, then Y, then Enter) + +4. **Make it executable**: ```bash - chmod +x run-stirling.sh + chmod +x ~/run-stirling.sh ``` -3. Run it with: + +5. **Run anytime with**: ```bash - ./run-stirling.sh + ~/run-stirling.sh ``` diff --git a/docs/Installation/Unix.md b/docs/Installation/Unix.md index 3e001ceb..31eb75fa 100644 --- a/docs/Installation/Unix.md +++ b/docs/Installation/Unix.md @@ -24,7 +24,7 @@ You could theoretically use a Distrobox/Toolbox, if your Distribution has old or Install the following software, if not already installed: -- Java 17 or later (21 recommended) +- Java 21 or later - Gradle 7.0 or later (included within repo so not needed on server) - Git - Python 3.8 (with pip) diff --git a/docs/Installation/Windows.md b/docs/Installation/Windows.md index a83730a5..28952fce 100644 --- a/docs/Installation/Windows.md +++ b/docs/Installation/Windows.md @@ -5,13 +5,76 @@ title: Windows Guide --- # Windows Installation Guide for Stirling PDF -Stirling PDF provides Windows compatibility through a downloadable .exe files depending on your usecase! -For personal user we recommend the latest -[Stirling-PDF-installer](https://files.stirlingpdf.com/win-installer.exe) +Stirling PDF for Windows comes in two versions: a **Desktop Application** for personal use and a **Server Version** for hosting and sharing with others. -For Server use (wanting to host Stirling-PDF as a server to share with multiple users) -We recommend downloading the [Stirling-PDF-server.exe](https://files.stirlingpdf.com/win-server.exe) or [Stirling-PDF-server-with-login.exe](https://files.stirlingpdf.com/win-server-with-login.exe) -This version also requires you to install the latest [java jdk21](https://www.oracle.com/uk/java/technologies/downloads/#jdk21-windows) you can get the installer [here](https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe) +## Desktop Application (Recommended for Personal Use) + +**V2.0 brings a native Windows desktop experience** with all PDF tools available offline! + +### What You Get + +- ✅ **Native Windows application** - Feels like a built-in Windows program +- ✅ **Open PDFs directly** - Double-click any PDF to open in Stirling-PDF +- ✅ **Works completely offline** - No internet required after installation +- ✅ **All features included** - Every PDF tool available +- ✅ **Automatic updates** - Stay current with latest features +- ✅ **Better performance** - Optimized for Windows +- ✅ **No browser needed** - Standalone application + +### Quick Installation + +1. **Download**: [Stirling-PDF Desktop Installer](https://files.stirlingpdf.com/win-installer.exe) +2. **Run the installer** - Follow the prompts (installs to `C:\Program Files\Stirling-PDF`) +3. **Launch from Start Menu** - Search for "Stirling-PDF" +4. **Start working with PDFs!** + +### Using the Desktop App + +**Opening PDFs:** +- **Double-click any PDF file** - Opens in Stirling-PDF +- **Right-click → Open with → Stirling-PDF** +- **Drag and drop** files into the application +- **File → Open** from the menu + +**Making Stirling-PDF your default PDF viewer:** +1. Right-click any PDF file +2. Select "Open with" → "Choose another app" +3. Select "Stirling-PDF" +4. Check "Always use this app to open .pdf files" +5. Click OK + +**Benefits of desktop app:** +- Files stay on your computer (not in browser storage) +- Work without internet connection +- Faster performance +- Unlimited file storage (not limited by browser) +- System tray icon for quick access + +## Server Version (For Hosting and Sharing) + +Want to host Stirling-PDF on a Windows server for multiple users? Use the server version. + +### Server Downloads + +**Without Login (Open Access):** +- Download: [Stirling-PDF.jar](https://files.stirlingpdf.com/Stirling-PDF.jar) +- Anyone on your network can access it +- No user accounts needed + +**With Login (User Management):** +- Download: [Stirling-PDF-with-login.jar](https://files.stirlingpdf.com/Stirling-PDF-with-login.jar) +- Requires user accounts to access +- Better for shared/business environments + +**Required:** [Java JDK 21](https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.exe) - Server versions need Java installed + +### Server Installation Steps + +1. **Install Java JDK 21** from the link above +2. **Download** your preferred server version +3. **Run the .exe file** +4. **Access** via browser at `http://localhost:8080` +5. **Share the URL** with users on your network (e.g., `http://your-server-ip:8080`) ### Optional Dependencies These dependencies enable additional features in Stirling PDF. Install only the ones you need: diff --git a/docs/Migrating-to-V2.md b/docs/Migrating-to-V2.md new file mode 100644 index 00000000..a144a89f --- /dev/null +++ b/docs/Migrating-to-V2.md @@ -0,0 +1,343 @@ +--- +sidebar_position: 3 +description: Guide for upgrading from V1 to V2 +--- + +# Migrating from V1 to V2 + +:::info Complete Migration Guide +This page provides a quick overview. For comprehensive migration documentation, see the **[Migration Guide](./Migration/Overview)** with detailed sections on: +- [New Features](./Migration/New-Features) - Everything new in V2 +- [Settings Changes](./Migration/Settings-Changes) - Complete configuration updates +- [Breaking Changes](./Migration/Breaking-Changes) - Important changes and migration paths +::: + +Upgrading to Stirling-PDF V2 is straightforward for most users. This guide helps you understand what's changed and how to make the transition smoothly. + +## Should You Upgrade? + +**Yes, if you want:** +- ✅ Faster workflows with file persistence +- ✅ Undo/redo functionality +- ✅ Better performance with large files +- ✅ Desktop applications +- ✅ Modern, responsive interface +- ✅ Future features and updates + +**Consider staying on V1 if:** +- ⚠️ You heavily customized the UI using `customFiles/templates` (requires code changes to migrate) +- ⚠️ You have specific compatibility requirements with very old browsers + +## What's Changed for Users + +### New Features You'll Love + +1. **Upload Once, Use Everywhere** + - Files stay in your browser between operations + - No more re-uploading for each tool + - Faster multi-step workflows + +2. **Undo and Redo** + - Made a mistake? Just undo it + - Try different settings and compare results + - Track, revert, and download any previous version + - All file history stored locally on your device + +3. **Desktop Applications** + - Native Windows, Mac, and Linux apps + - Lightning-fast startup (as quick as 0.3 seconds) + - "Open with Stirling-PDF" from any PDF file + - Set as your default PDF viewer + - Work completely offline + +4. **Better Performance** + - Improved handling of large files + - Better memory management + - Smoother interface + - Faster page loads + +5. **In-App Settings Management** + - Configure all settings through the Settings menu (admin only) + - No need to edit config files or restart + - Visual interface with validation + - Changes apply immediately + +### What Works the Same + +- ✅ All PDF operations and tools +- ✅ API endpoints (integrations continue to work) +- ✅ Authentication and user management +- ✅ Security features +- ✅ Pipeline and automation (now called "Automate" in the frontend with improved UX) +- ✅ Multi-language support +- ✅ Custom settings and configurations +- ✅ Privacy commitment - Your data stays yours, with full control over analytics (see [Analytics and Telemetry](./analytics-telemetry)) + +## Upgrading Your Installation + +### Docker Users (Recommended Method) + +Simply update your image tag: + +```bash +# Stop current container +docker stop stirling-pdf + +# Pull V2.0 +docker pull stirlingtools/stirling-pdf:latest + +# Start with same configuration +docker start stirling-pdf +``` + +Or update your docker-compose.yml: + +```yaml +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest # Change from 1.x to latest + # Keep all your existing environment variables and volumes + ports: + - 8080:8080 + volumes: + - ./data:/configs + - ./customFiles:/customFiles # V2 ignores templates, but other files work + environment: + # All your existing environment variables still work + - SECURITY_ENABLELOGIN=true + - LANGS=en-GB,es-ES,fr-FR +``` + +Then: +```bash +docker-compose down +docker-compose pull +docker-compose up -d +``` + +### Desktop Application Users + +1. **Windows**: Download new installer, run it (automatically updates) +2. **Mac**: Download new DMG, drag to Applications (replaces old version) +3. **Linux**: Install new .deb/.rpm/.AppImage + +Your settings should carry over automatically. + +### Manual Installation Users + +If you're running Stirling-PDF from the JAR file: + +1. Download the latest V2.0 release from [GitHub Releases](https://github.com/Stirling-Tools/Stirling-PDF/releases) +2. Stop the current V1 instance +3. Replace the JAR file +4. Start with the same command + +## Data Migration + +### Your Data is Safe + +V2.0 is **fully compatible** with V1 data: + +- ✅ User accounts and permissions +- ✅ API keys +- ✅ Settings and configurations +- ✅ Database (if using external database) +- ✅ Custom OCR language files +- ✅ Custom fonts and certificates + +**No manual migration needed** - just upgrade and your data continues working. + +### Volume Mounts That Still Work + +These volumes work exactly the same in V2: + +```yaml +volumes: + - ./configs:/configs # Settings and database + - ./logs:/logs # Log files + - ./customFiles/static:/customFiles/static # Custom images/logos + - ./tessdata:/usr/share/tessdata # OCR languages +``` + +### What Doesn't Work Anymore + +❌ **Template customization** - `customFiles/templates/` folder has been replaced + +The V1 template override system has been replaced with a new customization approach due to the UI framework change. V2 uses React components instead of HTML templates. + +**If you customized templates**, you'll need to: +1. Modify React components in the source code +2. Build the frontend +3. Deploy custom build + +See [UI Customisation](./Configuration/UI%20Customisation.md) for alternatives. + +## Breaking Changes + +### Template Customization System Changed + +**V1 Method (replaced in V2):** +``` +customFiles/templates/ + ├── home.html ❌ Replaced with React components + ├── merge.html ❌ Replaced with React components + └── settings.html ❌ Replaced with React components +``` + +**V2 Alternatives:** +- Use environment variables for branding +- Use settings panel for theme customization +- For extensive changes, modify React components in source + +### Environment Variables (New in V2) + +New optional variables you might want to use: + +```bash +# Deployment mode (default: BOTH) +MODE=BOTH # or FRONTEND or BACKEND + +# Internal backend port (when MODE=BOTH) +BACKEND_INTERNAL_PORT=8081 + +# Backend URL (when MODE=FRONTEND) +VITE_API_BASE_URL=http://your-backend:8080 +``` + +**All V1 environment variables still work** - these are additions, not replacements. + +## Post-Upgrade Checklist + +After upgrading, verify: + +- [ ] Can log in with existing credentials +- [ ] All PDF tools work as expected +- [ ] Settings and preferences are retained +- [ ] API integrations still function (if applicable) +- [ ] Custom branding appears correctly +- [ ] OCR languages are available +- [ ] Pipelines and automation continue working + +## New Features to Try + +After upgrading, explore these V2 features: + +1. **Upload a PDF** and try using multiple tools without re-uploading +2. **Use Undo/Redo** - make a change and undo it +3. **Check File Manager** - see all files stored in your browser +4. **Try the Desktop App** - download it for offline work +5. **Explore new interface** - faster and more responsive + +## Troubleshooting + +### "Files disappeared after refresh" + +This is normal V2 behavior. Files are temporarily stored in your browser: +- **Solution**: Download finished files before refreshing +- **Alternative**: Use desktop app for persistent storage + +### "My custom template changes are gone" + +V2 no longer uses HTML templates: +- **Solution**: Use environment variables for basic customization +- **Alternative**: Modify React source code for extensive changes +- **See**: [UI Customisation](./Configuration/UI%20Customisation.md) + +### "Interface looks different" + +V2 has a completely new React-based interface: +- **This is expected** - new modern design +- **All features are still there** - just in new locations +- **Tip**: Explore the new interface, it's more intuitive + +### "High memory usage" + +V2 actually uses less memory than V1 in most cases: +- **Check**: Are you using the right variant? (Standard vs Ultra-Lite) +- **Try**: Disable login if not needed (`SECURITY_ENABLELOGIN=false`) +- **See**: [FAQ - Memory Optimization](./FAQ.md#q6-my-stirling-pdf-using-high-ram-at-idle-how-can-i-optimize-memory-usage) + +### "API integration broken" + +V2's API is backward compatible: +- **Check**: Endpoint URLs haven't changed +- **Verify**: API keys are still valid +- **Test**: Use the Swagger UI at `/swagger-ui.html` + +## Rolling Back (If Needed) + +If you need to return to V1: + +### Docker +```bash +docker pull stirlingtools/stirling-pdf:1.5.0 # or your previous version +# Update your docker-compose.yml to use 1.5.0 tag +docker-compose up -d +``` + +### Desktop App +Uninstall V2 and reinstall V1 from [releases](https://github.com/Stirling-Tools/Stirling-PDF/releases/tag/v1.5.0) + +### Manual Installation +Replace the JAR file with your previous V1 version. + +**Note**: Your data will still work if you roll back - no data migration is needed in either direction. + +## Getting Help + +If you encounter issues: + +1. **Migration Guide**: [Complete Migration Documentation](./Migration/Overview) - Comprehensive upgrade guide +2. **Settings Changes**: [Configuration Updates](./Migration/Settings-Changes) - All setting changes +3. **Breaking Changes**: [What Changed](./Migration/Breaking-Changes) - Important changes +4. **FAQ**: [Frequently Asked Questions](./FAQ) - Common questions answered +5. **Report Issues**: [GitHub Issues](https://github.com/Stirling-Tools/Stirling-PDF/issues) +6. **Join Discord**: Get community help and support + +## Deployment Mode Options (Advanced) + +V2 allows splitting frontend and backend for advanced deployments: + +### Simple Deployment (Default) +```bash +# Everything in one container +docker run -e MODE=BOTH stirlingtools/stirling-pdf:latest +``` + +### Split Deployment +```bash +# Backend server +docker run -e MODE=BACKEND -p 8080:8080 stirlingtools/stirling-pdf:latest + +# Frontend (can run multiple instances) +docker run -e MODE=FRONTEND -e VITE_API_BASE_URL=http://backend:8080 -p 80:80 stirlingtools/stirling-pdf:latest +``` + +**Use split deployment if:** +- You want to scale frontend and backend independently +- Serving frontend from a CDN +- Running multiple frontends with one backend + +**Stick with MODE=BOTH if:** +- Simple single-server deployment +- Don't need independent scaling +- Want easiest setup + +See [Docker Installation](./Installation/Docker%20Install.md) for detailed examples. + +## Summary + +**Upgrading to V2 is easy:** +1. Pull latest Docker image (or download desktop app) +2. Start with your existing configuration +3. Everything continues working +4. Explore new features! + +**Key takeaways:** +- ✅ Data is fully compatible +- ✅ API remains unchanged +- ✅ Most customizations still work +- ❌ Template overrides need different approach +- 🎉 Many new features to enjoy + +**Welcome to V2!** Enjoy the faster, more modern Stirling-PDF experience. diff --git a/docs/Migration/Breaking-Changes.md b/docs/Migration/Breaking-Changes.md new file mode 100644 index 00000000..d44127a1 --- /dev/null +++ b/docs/Migration/Breaking-Changes.md @@ -0,0 +1,795 @@ +--- +sidebar_position: 3 +id: Breaking-Changes +title: Breaking Changes in V2 +description: Important changes that may affect your V2 upgrade +--- + +# Breaking Changes in V2 + +Most V1 deployments will upgrade smoothly to V2, but there are some important changes you should know about. This page documents breaking changes and how to handle them. + +--- + +## ⚠️ Impact Summary + +| Change | Impact | Action Required | +|--------|--------|-----------------| +| **Template Customization** | High | Rewrite customizations | +| **UI Settings Location** | Medium | Use in-app settings | +| **Session Management** | Low | Update setting names | +| **Database Notifications** | Low | Use audit logs instead | + +--- + +## 🎨 Template Customization System Removed + +**Impact:** HIGH for users who customized UI using `customFiles/templates/` + +### What Changed + +**V1 Approach:** +```bash +customFiles/ + └── templates/ + ├── fragments/ + │ └── navbar.html # Custom navbar + └── home.html # Custom homepage +``` + +V1 used server-side template injection with Thymeleaf templates. + +**V2 Approach:** +V2 uses React frontend - server-side template injection no longer possible. + +### Migration Path + +If you customized templates in V1, you have two options: + +#### Option 1: Use Built-In Customization (Recommended) + +V2 provides in-app settings for most common customizations: + +**Available Customizations:** +- App name and description +- Navbar branding +- Logo style (classic/modern) +- Custom logo upload +- Homepage description + +**How to use:** +1. Enable login: `SECURITY_ENABLELOGIN=true` +2. Log in as admin +3. Go to Settings → UI +4. Configure branding there + +**Learn more:** [UI Customisation](../Configuration/UI%20Customisation.md) + +#### Option 2: Edit Static Files in Docker + +For customizations beyond built-in settings, you can mount and edit static files: + +**Steps:** +1. Mount the `/customFiles/static/` directory in Docker +2. Add your custom static files (images, favicons, etc.) +3. Reference them in your HTML/settings +4. Restart container to apply changes + +**Example Docker compose:** +```yaml +volumes: + - ./customFiles:/customFiles:rw +``` + +**Use cases:** +- Custom favicon +- Custom images/logos +- Static assets + +#### Option 3: Fork the Frontend (Advanced) + +For complete UI customization: + +**Steps:** +1. Fork Stirling-PDF repository +2. Modify React components in `frontend/src/` +3. Build custom frontend +4. Deploy in split mode with custom frontend + +**Trade-offs:** +- ✅ Complete control +- ❌ Must maintain your fork +- ❌ Manual merges for updates + +### What No Longer Works + +These V1 customization patterns are **no longer supported:** + +```html + +
+ + +
+ Custom content +
+ + + +``` + +--- + +## ⚙️ UI Settings Moved to In-App Configuration + +**Impact:** MEDIUM - Settings moved, but easy to reconfigure + +### What Changed + +**V1 Configuration:** +```yaml +ui: + appName: 'My PDF Tool' + homeDescription: 'Welcome to our PDF service!' +``` + +**V2 Configuration:** +```yaml +ui: + appNameNavbar: 'My PDF Tool' # Still in YAML + # appName and homeDescription REMOVED + # Configure these in-app instead +``` + +### Why the Change + +**Benefits:** +- ✅ No container restart needed +- ✅ Visual interface with preview +- ✅ Validation prevents errors +- ✅ Changes apply immediately +- ✅ Role-based access control + +### Migration Steps + +1. **Note your current settings:** + ```yaml + # From V1 settings.yml + ui: + appName: 'CompanyName PDF' + homeDescription: 'Internal document processing' + ``` + +2. **Remove from settings.yml:** + ```yaml + ui: + appNameNavbar: 'CompanyName PDF' + # appName - REMOVE THIS LINE + # homeDescription - REMOVE THIS LINE + ``` + +3. **Configure in UI:** + - Enable login: `SECURITY_ENABLELOGIN=true` + - Start V2 + - Log in as admin + - Go to Settings → UI + - Enter app name and description + - Save + +### Environment Variables + +These environment variables **no longer work**: + +```bash +# V1 (NO LONGER WORKS) +UI_APPNAME="My PDF Tool" +UI_HOMEDESCRIPTION="Welcome!" + +# V2 (USE IN-APP SETTINGS INSTEAD) +# Set through UI after logging in +``` + +`UI_APPNAMENAVBAR` still works for navbar branding. + +--- + +## 🔐 Session Management Improvements + +**Impact:** LOW - New session features with simple setting updates + +### What Changed + +Session management enhanced with new JWT-based features and improved settings: + +| V1 Setting | V2 Setting | Change | +|------------|------------|--------| +| `jwt.enabled` | `jwt.persistence` | Renamed | +| `jwt.keyCleanup` | `jwt.enableKeyCleanup` | Renamed | +| `jwt.secureCookie` | _(removed)_ | Always secure now | +| _(new)_ | `jwt.enableKeyRotation` | New feature | +| _(new)_ | `jwt.keyRetentionDays` | New feature | + +### Migration + +**V1 Configuration:** +```yaml +security: + jwt: + enabled: false + keyCleanup: false + secureCookie: true +``` + +**V2 Configuration:** +```yaml +security: + jwt: + persistence: true # was 'enabled' + enableKeyCleanup: true # was 'keyCleanup' + enableKeyRotation: true # NEW + keyRetentionDays: 7 # NEW + # secureCookie REMOVED +``` + +### Environment Variables + +**V1 (NO LONGER WORKS):** +```bash +SECURITY_JWT_ENABLED=false +SECURITY_JWT_KEYCLEANUP=false +SECURITY_JWT_SECURECOOKIE=true +``` + +**V2 (USE THESE):** +```bash +SECURITY_JWT_PERSISTENCE=true +SECURITY_JWT_ENABLEKEYCLEANUP=true +SECURITY_JWT_ENABLEKEYROTATION=true +SECURITY_JWT_KEYRETENTIONDAYS=7 +``` + +### After Upgrade + +**Expected behavior:** Users will be logged out once after upgrade. + +**Why:** Session token format changed with new JWT implementation. + +**Action:** Users just need to log in again. Normal behavior. + +**Learn more:** [Settings Changes - JWT Configuration](./Settings-Changes.md#enhanced-jwt-configuration) + +--- + +## 🔕 Database Notifications Removed + +**Impact:** LOW - Replaced with better alternative + +### What Changed + +Database backup/import notifications removed. + +**V1 Configuration (NO LONGER WORKS):** +```yaml +premium: + enterpriseFeatures: + databaseNotifications: + backups: + successful: false + failed: false + imports: + successful: false + failed: false +``` + +### Why Removed + +Replaced with comprehensive audit logging system that provides: +- More detailed information +- Searchable history +- Export capabilities +- Better retention policies + +### Migration to Audit Logs + +**V2 Alternative:** + +1. **Enable audit logging:** + ```yaml + system: + logging: + level: INFO + ``` + +2. **Monitor logs:** + ```bash + docker logs stirling-pdf | grep "Database backup" + docker logs stirling-pdf | grep "Database import" + ``` + +3. **Or use audit log UI:** + - Log in as admin + - Go to Settings → Audit Logs + - Filter by operation type + - Export as needed + +### What You Get Instead + +**Audit logs provide:** +- ✅ Database operations (backup, import, export) +- ✅ User actions (login, logout, operations) +- ✅ Admin actions (settings changes, user management) +- ✅ Failed operations with error details +- ✅ Search and filter capabilities +- ✅ Export to CSV/JSON + +**Example audit log entry:** +```json +{ + "timestamp": "2025-01-15T10:30:00Z", + "user": "admin", + "action": "database.backup", + "status": "success", + "details": { + "size": "1.2 GB", + "duration": "45s", + "location": "/backups/db-2025-01-15.sql" + } +} +``` + +--- + +## 🔧 Calibre Custom Path Removed + +**Impact:** LOW - Auto-detection improved + +### What Changed + +Custom Calibre path no longer needed. + +**V1 Configuration (NO LONGER WORKS):** +```yaml +system: + customPaths: + operations: + calibre: '/usr/bin/calibre' +``` + +### Why Removed + +V2 has improved path detection: +- Automatically finds Calibre in standard locations +- Checks multiple common paths +- Better error messages if not found + +### Migration + +1. **Remove from settings.yml:** + ```yaml + system: + customPaths: + operations: + # calibre: '' # DELETE THIS LINE + ``` + +2. **Verify Calibre is installed:** + ```bash + docker exec stirling-pdf which ebook-convert + ``` + +3. **If not found, install in container:** + ```dockerfile + # In your Dockerfile + RUN apt-get update && apt-get install -y calibre + ``` + +### Standard Detection Paths + +V2 automatically checks: +- `/usr/bin/ebook-convert` +- `/usr/local/bin/ebook-convert` +- `ebook-convert` (in PATH) + +If Calibre is in any standard location, it will be found automatically. + +--- + +## 📦 Docker Image Changes + +**Impact:** LOW - Most users unaffected + +### Tag Changes + +**V1 Tags:** +```bash +stirlingtools/s-pdf:latest # OLD NAME +stirlingtools/s-pdf:0.xx.x +``` + +**V2 Tags:** +```bash +stirlingtools/stirling-pdf:latest # NEW NAME +stirlingtools/stirling-pdf:2.x.x +``` + +### Migration + +Update your docker-compose.yml: + +**V1:** +```yaml +services: + stirling-pdf: + image: stirlingtools/s-pdf:latest # OLD +``` + +**V2:** +```yaml +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest # NEW +``` + +### Backwards Compatibility + +The old `s-pdf` image is deprecated but still receives updates for now. However, you should migrate to the new image name. + +--- + +## 🌐 API Compatibility + +**Impact:** LOW - Most endpoints unchanged + +### What Stayed the Same + +✅ All existing API endpoints work +✅ Request/response formats unchanged +✅ Authentication methods compatible +✅ API keys still valid + +### What Changed + +**New endpoints added:** +- `/api/v1/security/validate-signature` - PDF signature validation +- `/api/v1/misc/remove-cert-sign` - Remove certificate signatures +- `/api/v1/misc/booklet-imposition` - Booklet printing layout +- `/api/v1/misc/unlock-pdf-forms` - Unlock form fields +- `/api/v1/misc/replace-color` - Color replacement +- `/api/v1/misc/add-attachments` - Add file attachments +- `/api/v1/misc/edit-toc` - Edit table of contents + +**Enhanced endpoints:** +- Better error messages +- Consistent error format +- Progress tracking for long operations + +### Migration + +**No action needed** for existing API integrations. New endpoints are additive. + +**If using OpenAPI spec:** +1. Download updated spec from `/v3/api-docs` +2. Regenerate client code if needed + +--- + +## 🗄️ Database Schema + +**Impact:** NONE - Automatic migration + +### What Changed + +Database schema updated to support: +- Enhanced audit logging +- JWT key rotation +- User invitation system +- In-app settings storage + +### Migration + +**Automatic!** On first V2 startup: +1. V2 detects V1 schema +2. Runs migration scripts +3. Updates to V2 schema +4. All data preserved + +**No manual action needed.** + +### Rollback Considerations + +Database is **forward-compatible only**: +- ✅ V1 → V2 upgrade: Automatic +- ⚠️ V2 → V1 rollback: Database needs manual downgrade + +**If you need to rollback:** +1. Restore database backup from before V2 upgrade +2. Or use V1-compatible database dump + +**Recommendation:** Take database backup before upgrading. + +--- + +## 📱 Browser Compatibility + +**Impact:** LOW - Modern browsers required + +### Minimum Browser Versions + +**V2 Requirements:** + +| Browser | Minimum Version | Notes | +|---------|----------------|-------| +| **Chrome** | 90+ | Recommended | +| **Firefox** | 88+ | Recommended | +| **Safari** | 14+ | Some limitations | +| **Edge** | 90+ | Chromium-based | + +**V1 vs V2:** +- V1 supported older browsers (IE11, old Safari) +- V2 requires modern browsers for IndexedDB, modern JavaScript + +### Why the Change + +V2 features require modern browser APIs: +- IndexedDB for file storage +- ES2020+ JavaScript +- Modern CSS features +- Web Workers for performance + +### If Users Have Old Browsers + +**Options:** +1. **Update browser** (recommended) +2. **Use desktop app** (supports older systems) +3. **Stay on V1** (still receives security updates) + +--- + +## 🔒 Security Changes + +**Impact:** LOW - Generally more secure + +### HTTPS Enforcement + +**V2 Change:** Secure cookies always enabled for production. + +**V1:** +```yaml +security: + jwt: + secureCookie: true # Configurable +``` + +**V2:** +```yaml +# secureCookie removed - always secure in production +``` + +**Impact:** +- ✅ More secure by default +- ⚠️ Requires HTTPS in production +- Development mode (localhost) still works over HTTP + +**Migration:** +If running in production, ensure HTTPS is configured: +```yaml +server: + ssl: + enabled: true + key-store: /path/to/keystore.p12 + key-store-password: ${SSL_PASSWORD} +``` + +### Session Management + +**V2 Changes:** +- Shorter default session timeout (4 hours → 2 hours) +- Better session invalidation +- Stricter CORS policies + +**To increase timeout:** +```yaml +security: + sessionTimeout: 14400 # 4 hours in seconds +``` + +--- + +## 🎯 Feature Flag Changes + +**Impact:** LOW - Endpoint customization still works + +### What Changed + +Tool IDs updated for consistency: + +| Old ID (V1) | New ID (V2) | Tool Name | +|-------------|-------------|-----------| +| `pdf-organizer` | `reorganize-pages` | Reorganize Pages | +| `sign-forms` | `sign` | Sign PDF | + +### Migration + +Update `settings.yml` endpoint customization: + +**V1:** +```yaml +endpoints: + toRemove: ['pdf-organizer'] +``` + +**V2:** +```yaml +endpoints: + toRemove: ['reorganize-pages'] +``` + +**Complete tool ID list:** [Endpoint Customisation](../Configuration/Endpoint%20or%20Feature%20Customisation.md) + +--- + +## 📖 Documentation Structure + +**Impact:** NONE - Just informational + +### What Changed + +Documentation reorganized for clarity: +- "V2 Guides" → "Guides" (current features) +- "Migration" section added (V1→V2 transition) +- Dedicated pages for super tools +- Comprehensive tool reference + +### Old Links + +Documentation has been reorganized: +- Guides section contains current features (File Storage, Undo/Redo, Desktop vs Web) +- Migration section contains V1→V2 transition information +- Individual pages moved to appropriate sections + +--- + +## ✅ Pre-Upgrade Checklist + +Before upgrading to V2, verify: + +### 1. Customizations +- [ ] **Using custom templates?** → Plan rewrite or use built-in settings +- [ ] **Custom logo?** → Will work in V2 + +### 2. Configuration +- [ ] **Backup settings.yml** before modifying +- [ ] **Note UI settings** (appName, homeDescription) +- [ ] **Update JWT settings** (enabled → persistence) +- [ ] **Remove deprecated sections** (database notifications) + +### 3. Infrastructure +- [ ] **Backup database** before upgrade +- [ ] **Test in staging** environment first +- [ ] **Verify HTTPS** configured for production +- [ ] **Check browser versions** for users + +### 4. Features +- [ ] **Using database notifications?** → Switch to audit logs +- [ ] **Custom Calibre path?** → Remove, auto-detection works + +### 5. API Integrations +- [ ] **Using deprecated tool IDs?** → Update to new IDs +- [ ] **Update OpenAPI spec** if using generated clients +- [ ] **Test API endpoints** in staging + +--- + +## 🆘 Troubleshooting + +### "Unknown configuration key" warnings + +**Symptom:** +``` +WARN: Unknown configuration key: premium.proFeatures.googleDrive +``` + +**Solution:** Remove deprecated settings from settings.yml. See [Settings Changes](./Settings-Changes.md). + +--- + +### Custom templates not loading + +**Symptom:** Custom navbar/homepage not appearing. + +**Solution:** Template system removed. Use in-app settings or custom CSS instead. See [Template Customization](#-template-customization-system-removed). + +--- + +### Users logged out after upgrade + +**Symptom:** All users need to re-login after V2 upgrade. + +**Solution:** Expected behavior due to JWT format change. Users just need to log in once. + +--- + +### API returns 404 for tool + +**Symptom:** API call fails with tool not found. + +**Solution:** Update tool IDs. Example: `pdf-organizer` → `reorganize-pages`. See [Feature Flag Changes](#-feature-flag-changes). + +--- + +### App name not showing + +**Symptom:** `ui.appName` in settings.yml not displaying. + +**Solution:** Setting moved to in-app configuration. Log in as admin, go to Settings → UI. See [UI Settings](#%EF%B8%8F-ui-settings-moved-to-in-app-configuration). + +--- + +## 🔄 Rollback Guide + +If you need to return to V1: + +### 1. Stop V2 +```bash +docker stop stirling-pdf +``` + +### 2. Restore Database +```bash +# Option A: Restore from backup +docker exec -i postgres psql -U stirling < backup-before-v2.sql + +# Option B: Use existing (database is backward compatible for rollback) +``` + +### 3. Restore Settings +```bash +# Restore V1 settings.yml from backup +cp settings.yml.v1.backup configs/settings.yml +``` + +### 4. Start V1 +```bash +# Update docker-compose.yml +image: stirlingtools/stirling-pdf:1.5.0 + +docker-compose up -d +``` + +### Data Preservation + +Your data remains intact: +- ✅ User accounts +- ✅ API keys +- ✅ Configurations +- ✅ Custom files + +--- + +## 📚 Related Documentation + +- **[Migration Overview](./Overview.md)** - General upgrade guide +- **[New Features](./New-Features.md)** - What's new in V2 +- **[Settings Changes](./Settings-Changes.md)** - Configuration updates +- **[FAQ](../FAQ.md)** - Common questions + +--- + +## Summary + +**Breaking changes are minimal:** + +✅ Most configurations work unchanged +✅ All data migrates automatically +✅ API compatibility maintained +⚠️ Template customizations need rewrite +⚠️ UI settings moved to in-app config +⚠️ JWT settings renamed + +**Action required:** +1. Update JWT setting names +2. Remove deprecated configurations +3. Reconfigure UI settings in-app +4. Rewrite template customizations (if any) + +**Most users can upgrade with minimal changes!** diff --git a/docs/Migration/New-Features.md b/docs/Migration/New-Features.md new file mode 100644 index 00000000..f5372153 --- /dev/null +++ b/docs/Migration/New-Features.md @@ -0,0 +1,699 @@ +--- +sidebar_position: 2 +id: New-Features +title: New Features in V2 +description: All new features and capabilities added in V2 +--- + +# New Features in V2 + +V2 brings powerful new features that fundamentally improve how you work with PDFs. This page documents everything new in V2. + +--- + +## 📁 Browser File Storage + +**The Game Changer:** Upload PDFs once, use them across multiple tools without re-uploading. + +### What's New + +- **Persistent Storage:** Files stored locally in your browser using IndexedDB +- **Cross-Tool Usage:** Access uploaded files from any tool +- **Smart Management:** Automatic cleanup, manual delete options +- **Large File Support:** Up to 10GB storage (browser-dependent) + +### How It Works + +``` +Upload PDF → Stored in Browser → Use in Any Tool → Delete When Done +``` + +**Example Workflow:** +1. Upload `report.pdf` in Multi-Tool +2. Compress it +3. Switch to Add Page Numbers (file still there!) +4. Add watermark (still no re-upload!) +5. Download final result + +### Storage Limits + +| Browser | Storage Limit | Notes | +|---------|--------------|-------| +| Chrome/Edge | ~10GB | 60% of available disk space | +| Firefox | ~10GB | User-configurable | +| Safari | ~1GB | More restrictive | + +--- + +## ⏮️ Undo, Redo & Version History + +**Made a mistake?** Just undo it! V2 introduces comprehensive version control. + +### What's New + +- **Undo/Redo:** Undo and redo buttons in toolbar +- **Version History:** See all previous versions with timestamps +- **Jump to Version:** Restore any previous state +- **Visual Indicators:** See current version in timeline +- **All Local:** History stored in your browser, fully private + +### How It Works + +Every operation creates a new version: + +``` +Original.pdf → [Compress] → v1 → [Add Pages] → v2 → [Watermark] → v3 + ↑ ↑ ↑ ↑ + Can restore to any point in history +``` + +### Accessing Features + +- **Undo Button:** Click undo in toolbar +- **Redo Button:** Click redo in toolbar +- **History Panel:** Click history icon in Multi-Tool + +### Example Use Case + +**Scenario:** You compressed a PDF too aggressively and text is blurry. + +**Solution:** +1. Click undo button to undo compression +2. Open Version History panel +3. See: Original → Compress (MEDIUM) ← You are here +4. Click "Restore" on Original +5. Re-compress with LIGHT setting instead + + +--- + +## 🖥️ Desktop Applications (Tauri) + +**NEW:** Native desktop apps for Windows, Mac, and Linux. + +### What's New + +- **Lightning Fast:** 0.3 second startup time +- **Native Integration:** "Open with Stirling-PDF" in file explorer +- **System Default:** Set as default PDF viewer +- **Offline Capable:** Full functionality without server +- **Resource Efficient:** Uses ~50MB RAM vs browser ~200MB + +### Platform Support + +| Platform | Format | Features | +|----------|--------|----------| +| **Windows** | `.exe` installer | Context menu integration | +| **macOS** | `.dmg` | Dock integration | +| **Linux** | `.AppImage`, `.deb` | Desktop file integration | + +### Key Differences from Web + +| Feature | Desktop | Web Browser | +|---------|---------|-------------| +| Startup Speed | 0.3s | 2-3s | +| File Association | ✅ Yes | ❌ No | +| Default Viewer | ✅ Yes | ❌ No | +| System Integration | ✅ Native | ⚠️ Limited | +| Storage | Unlimited | Browser limits | +| Updates | Manual | Automatic | + +### Right-Click Integration + +After installation: +1. Right-click any PDF in file explorer +2. Select "Open with Stirling-PDF" +3. PDF opens directly in app +4. Process immediately + +**Learn More:** +- [Installation Guide](../Installation/Windows.md) + +--- + +## 🔀 Split Deployment Architecture + +**NEW:** Deploy frontend and backend separately for better scalability. + +### What's New + +Three deployment modes: + +#### 1. Unified Mode (Default) +Single container with frontend + backend together. + +```bash +docker run -d \ + -p 8080:8080 \ + stirlingtools/stirling-pdf:latest +``` + +#### 2. Split Mode +Frontend and backend in separate containers. + +**Backend:** +```bash +docker run -d \ + -e MODE=BACKEND \ + -p 8081:8080 \ + stirlingtools/stirling-pdf:latest +``` + +**Frontend:** +```bash +docker run -d \ + -e MODE=FRONTEND \ + -e VITE_API_BASE_URL=http://backend:8080 \ + -p 8080:8080 \ + stirlingtools/stirling-pdf:latest +``` + +#### 3. Backend-Only Mode +Use as API-only service. + +```bash +docker run -d \ + -e MODE=BACKEND \ + -p 8080:8080 \ + stirlingtools/stirling-pdf:latest +``` + +### Benefits + +- **Independent Scaling:** Scale frontend and backend separately +- **CDN Integration:** Serve static frontend from CDN +- **Development:** Work on frontend without running backend +- **Security:** Separate concerns, different security zones + +### CORS Configuration + +New settings for split deployment: + +```yaml +system: + corsAllowedOrigins: ['https://pdf.example.com'] + frontendUrl: 'https://pdf.example.com' +``` + +**Learn More:** [Docker Installation - Split Mode](../Installation/Docker%20Install.md#split-deployment-advanced-users) + +--- + +## ⌨️ Custom Keyboard Shortcuts + +**NEW:** Configure your own keyboard shortcuts for quick tool access. + +### What's New + +- **Custom Hotkeys:** Assign keyboard shortcuts to any tool +- **Quick Access:** Default shortcuts for 7 most popular tools (Cmd/Ctrl+Alt+1-7) +- **Flexible Mapping:** Use any combination of Ctrl, Alt, Shift, Cmd keys +- **Visual Feedback:** See all shortcuts in settings +- **Conflict Detection:** Prevents duplicate shortcut assignments +- **Easy Reset:** Restore default shortcuts anytime + +### Default Shortcuts + +The 7 Recommended Tools come with pre-configured shortcuts: + +| Tool | Windows/Linux | Mac | +|------|---------------|-----| +| Multi-Tool | Ctrl+Alt+1 | Cmd+Option+1 | +| Read & Annotate | Ctrl+Alt+2 | Cmd+Option+2 | +| Merge | Ctrl+Alt+3 | Cmd+Option+3 | +| Compare | Ctrl+Alt+4 | Cmd+Option+4 | +| Compress | Ctrl+Alt+5 | Cmd+Option+5 | +| OCR | Ctrl+Alt+6 | Cmd+Option+6 | +| Redact | Ctrl+Alt+7 | Cmd+Option+7 | + +### Customizing Shortcuts + +**To configure:** +1. Open Settings (gear icon) +2. Navigate to "Keyboard Shortcuts" section +3. Find the tool you want to assign +4. Click "Set Shortcut" +5. Press your desired key combination +6. Save changes + +**Example:** +- Want to open Convert with Ctrl+Alt+C? +- Navigate to Convert tool in shortcuts list +- Click "Set Shortcut" +- Press Ctrl+Alt+C + +### Tips + +- **Don't override browser shortcuts:** Avoid Ctrl+T, Ctrl+W, etc. +- **Use Alt/Option combos:** Less likely to conflict with system shortcuts +- **Keep it memorable:** Use letters that relate to tool names +- **Test after setting:** Make sure shortcuts work in practice + +--- + +## ⚙️ In-App Settings Management + +**NEW:** Configure everything through the UI (admin only). + +### What's New + +- **Visual Configuration:** No more editing YAML files +- **Instant Validation:** See errors before saving +- **Live Preview:** Some settings apply immediately +- **Organized Sections:** Settings grouped logically +- **Search Settings:** Find what you need quickly +- **Import/Export:** Backup and restore configurations + +### Settings You Can Configure + +**System:** +- Default locale and timezone +- Resource limits +- Logging levels +- CORS origins + +**Security:** +- Login requirements +- User registration +- Session timeout +- Password policies + +**UI Customization:** +- App name and description +- Logo style (classic/modern) +- Navbar branding +- Homepage content + +**Features:** +- Enable/disable tools +- Endpoint customization +- OCR languages +- Conversion settings + +### How to Access + +1. Enable login: `SECURITY_ENABLELOGIN=true` +2. Log in as admin +3. Click Settings icon in navbar +4. Configure through UI +5. Save changes + +**Benefits Over File Configuration:** +- No container restart needed (for most settings) +- Validation prevents errors +- Changes tracked in audit log +- Role-based access control + +--- + +## 🔐 PDF Signature Validation + +**NEW:** Comprehensive certificate chain validation for signed PDFs. + +### What's New + +Full trust chain validation system: + +- **Multiple Trust Sources:** + - System trust store + - Mozilla CA bundle + - Adobe Approved Trust List (AATL) + - EU Trusted List (EUTL) + - Server-generated anchor certificates + +- **Revocation Checking:** + - OCSP (Online Certificate Status Protocol) + - CRL (Certificate Revocation Lists) + - Configurable hard/soft fail + +- **AIA (Authority Information Access):** + - Automatic intermediate cert fetching + - Chain building support + +### Configuration + +```yaml +security: + validation: + trust: + serverAsAnchor: true # Trust server-generated certs + useSystemTrust: true # Use OS trust store + useMozillaBundle: true # Mozilla CA certificates + useAATL: false # Adobe trust list + useEUTL: false # EU trust list + allowAIA: false # Fetch intermediate certs + revocation: + mode: none # none, ocsp, crl, ocsp+crl + hardFail: false # Fail if revocation check fails +``` + +### Use Cases + +**Enterprise:** +- Validate invoices signed by partners +- Verify contract signatures +- Compliance with legal requirements + +**Government:** +- Validate officially signed documents +- EU eIDAS compliance +- EUTL integration + +**General:** +- Verify PDF authenticity +- Check if signature still valid +- Detect tampered documents + +**Learn More:** [Certificate Signing](../Functionality/Security/Certificate-Signing.md) + +--- + +## 🔑 Server Certificate Management + +**NEW:** Automatic certificate generation for signing PDFs. + +### What's New + +- **Auto-Generated Certs:** Server creates signing certificates on startup +- **Customizable:** Configure organization name, validity period +- **No Manual Setup:** Works out of the box +- **Renewable:** Regenerate certificates as needed +- **"Sign with Stirling-PDF" Feature:** Users can sign with server cert + +### Configuration + +```yaml +system: + serverCertificate: + enabled: true + organizationName: Stirling-PDF + validity: 365 # days + regenerateOnStartup: false +``` + +### How It Works + +1. **First Startup:** + - Server generates self-signed certificate + - Stored in `configs/` directory + - Used for "Sign with Stirling-PDF" feature + +2. **Subsequent Startups:** + - Uses existing certificate (unless `regenerateOnStartup: true`) + - Certificate persists across restarts + +3. **User Signs PDF:** + - Selects "Sign with Stirling-PDF" + - Server signs using generated certificate + - Signature embedded in PDF + +### Custom Certificates + +You can also provide your own certificates: + +```bash +configs/ + ├── keystore.p12 # Your certificate + └── settings.yml +``` + +Then disable auto-generation: +```yaml +system: + serverCertificate: + enabled: false # Use custom cert instead +``` + +**Learn More:** +- [Certificate Signing Guide](../Functionality/Security/Certificate-Signing.md) +- [Configuration](../Configuration/System%20and%20Security.md#server-certificates) + +--- + +## 🎯 Multi-Tool Workbench + +**NEW:** Dedicated workspace for chaining unlimited operations. + +### What's New + +- **Visual Workbench:** See all loaded files and their history +- **Unlimited Operations:** Chain as many tools as needed +- **Operation History:** See what you've done to each file +- **Undo/Redo:** Per-file version control +- **Batch Processing:** Process multiple files simultaneously +- **Result Management:** Keep, download, or discard results + +### Example Workflow + +``` +Multi-Tool Workbench +├── invoice.pdf +│ ├── [Original] +│ ├── [OCR - English] +│ ├── [Compress - MEDIUM] +│ └── [Add Page Numbers] ← Current +├── report.pdf +│ ├── [Original] +│ └── [Add Watermark] ← Current +└── contract.pdf + └── [Original] ← No operations yet +``` + +### Key Features + +1. **Smart Tool Switching:** + - Switch tools without losing files + - Context preserved between operations + - No re-uploading needed + +2. **Operation Queue:** + - See pending operations + - Reorder before processing + - Cancel if needed + +3. **Result Preview:** + - Preview before downloading + - Compare before/after + - Verify operations succeeded + +**Learn More:** [Multi-Tool Workbench Guide](../Functionality/Multi-Tool.md) + +--- + +## 📖 Read & Annotate Tool + +**NEW:** Full-featured PDF viewer with annotation capabilities. + +### What's New + +- **PDF Viewer:** Read PDFs directly in browser +- **Annotation Tools:** + - Highlight text + - Add comments + - Draw shapes + - Insert text boxes + - Sticky notes +- **Navigation:** + - Thumbnail sidebar + - Table of contents + - Page search + - Zoom controls +- **Collaboration:** + - Export annotations + - Share annotated PDFs + - Comment threads + +### Use Cases + +**Review:** +- Mark up documents for approval +- Add review comments +- Highlight important sections + +**Collaboration:** +- Annotate contracts before signing +- Review proposals with team +- Provide feedback on drafts + +**Study:** +- Highlight key passages +- Add study notes +- Mark important pages + +### Annotation Types + +| Tool | Use Case | Example | +|------|----------|---------| +| **Highlight** | Mark important text | Legal clauses | +| **Comment** | Add feedback | "Needs revision" | +| **Text Box** | Add missing text | Corrections | +| **Shape** | Circle/underline | Draw attention | +| **Sticky Note** | Quick notes | "Follow up" | + +**Learn More:** [Read & Annotate Guide](../Functionality/Read-and-Annotate.md) + +--- + +## 🔄 Enhanced Session Management + +**Improved:** Better session and token management with rotation and cleanup. + +### What's New in V2 + +| Feature | V1 | V2 | +|---------|----|----| +| Token Persistence | Optional | Configurable | +| Key Rotation | ❌ No | ✅ Yes | +| Key Cleanup | Manual | Automatic | +| Key Retention | N/A | Configurable days | +| Secure Cookie | Hardcoded | Removed (always secure) | + +### New Settings + +```yaml +security: + jwt: + persistence: true # Store keys across restarts + enableKeyRotation: true # Rotate signing keys periodically + enableKeyCleanup: true # Auto-delete old keys + keyRetentionDays: 7 # How long to keep old keys +``` + +### Benefits + +**Key Rotation:** +- Improved security through regular key changes +- Seamless for users (old tokens still work during grace period) +- Configurable rotation schedule + +**Automatic Cleanup:** +- No manual key management needed +- Prevents key accumulation +- Configurable retention period + +**Persistence:** +- Keys survive container restarts +- No user re-login after restart +- Optional for stateless deployments + +--- + +## ✉️ Email Invitation System + +**NEW:** Invite users via email instead of manual registration. + +### What's New + +- **Email Invites:** Send registration links via email +- **Token-Based:** Secure one-time registration tokens +- **Expiration:** Invites expire after configurable period +- **Role Assignment:** Set user role in invite +- **Bulk Invites:** Invite multiple users at once + +### Configuration + +```yaml +mail: + enabled: true + enableInvites: true # NEW in V2 + smtp: + host: smtp.example.com + port: 587 + username: noreply@example.com + password: ${MAIL_PASSWORD} +``` + +### Requirements + +- `mail.enabled: true` +- `security.enableLogin: true` +- Valid SMTP configuration + +### How It Works + +**Admin perspective:** +1. Go to User Management +2. Click "Invite User" +3. Enter email and select role +4. Send invite + +**User perspective:** +1. Receive email with invite link +2. Click link (valid for 48 hours) +3. Create account with password +4. Automatically logged in + +### Environment Variables + +```bash +MAIL_ENABLED=true +MAIL_ENABLEINVITES=true +MAIL_SMTP_HOST=smtp.gmail.com +MAIL_SMTP_PORT=587 +MAIL_SMTP_USERNAME=your-email@gmail.com +MAIL_SMTP_PASSWORD=your-app-password +``` + +--- + +## 🎨 Logo Customization + +**NEW:** Choose between logo styles and customize branding. + +### What's New + +```yaml +ui: + logoStyle: classic # Options: 'classic' or 'modern' +``` + +### Logo Styles + +| Style | Description | Best For | +|-------|-------------|----------| +| **Classic** | Traditional "S" icon | Established brands | +| **Modern** | Minimalist design | Clean, modern look | + +### Custom Logo + +You can still provide custom logo files: + +```bash +customFiles/ + └── static/ + └── logo.svg # Your custom logo +``` + +Then reference in settings: +```yaml +ui: + appNameNavbar: 'My Company PDF' + logoStyle: classic # Or use custom logo +``` + +--- + +## Summary + +**V2's Major Features:** + +- 📁 **Browser File Storage** - Upload once, use across multiple tools +- ⏮️ **Undo/Redo & Version History** - Never lose work +- 🖥️ **Desktop Applications** - Native Windows, Mac, Linux apps +- 🎨 **Multi-Tool Workbench** - Chain unlimited operations +- 📖 **Read & Annotate** - Full PDF viewer with annotation support +- ⚙️ **In-App Settings** - Configure everything through UI +- 🔐 **Enhanced Security** - PDF signature validation, server certificates +- ✉️ **Email Invitations** - Streamlined user onboarding +- ⌨️ **Custom Keyboard Shortcuts** - Quick tool access +- 🔄 **Enhanced Session Management** - Better token management with rotation +- 🏗️ **Split Deployment** - Scale frontend and backend independently + +--- + +## Learn More + +- **[Migration Overview](./Overview.md)** - How to upgrade +- **[Settings Changes](./Settings-Changes.md)** - Configuration updates +- **[Breaking Changes](./Breaking-Changes.md)** - What changed +- **[Getting Started](../Getting%20Started.md)** - Start using V2 diff --git a/docs/Migration/Overview.md b/docs/Migration/Overview.md new file mode 100644 index 00000000..f1e14d6b --- /dev/null +++ b/docs/Migration/Overview.md @@ -0,0 +1,187 @@ +--- +sidebar_position: 0 +id: Overview +title: Migrating from V1 to V2 +description: Complete guide for upgrading from Stirling-PDF V1 to V2 +--- + +# Migrating from V1 to V2 + +Upgrading to Stirling-PDF V2 is straightforward for most users. This section helps you understand what changed and how to migrate smoothly. + +--- + +## Quick Migration Guide + +### For Docker Users (Most Common) + +```bash +# Stop current container +docker stop stirling-pdf + +# Pull V2 +docker pull stirlingtools/stirling-pdf:latest + +# Start with same configuration +docker start stirling-pdf +``` + +**That's it!** Your data and settings migrate automatically. + +--- + +## Migration Topics + +### [New Features in V2](./New-Features.md) +Everything new in V2: +- Browser file storage +- Undo/redo functionality +- Desktop applications +- Split deployment architecture +- PDF signature validation +- Server certificate management +- Enhanced JWT +- And much more... + +### [Settings Changes](./Settings-Changes.md) +Configuration changes between V1 and V2: +- New settings added +- Deprecated settings removed +- Settings renamed or reorganized +- Migration examples + +### [Breaking Changes](./Breaking-Changes.md) +Important changes that may affect you: +- Template customization system replaced +- UI settings moved to in-app configuration +- Removed features +- API compatibility notes + +--- + +## Should You Upgrade? + +**Yes, if you want:** +- ✅ Faster workflows with file persistence +- ✅ Undo/redo functionality +- ✅ Better performance with large files +- ✅ Desktop applications +- ✅ Modern, responsive interface +- ✅ Future features and updates + +**Consider staying on V1 if:** +- ⚠️ You heavily customized UI using `customFiles/templates` (requires code changes to migrate) +- ⚠️ You have specific compatibility requirements with very old browsers + +--- + +## What Stays the Same + +- ✅ All existing PDF tools +- ✅ Backend API compatibility +- ✅ Configuration files (settings.yml) +- ✅ Docker deployment process +- ✅ Security features (SSO, user management) +- ✅ Pipeline automation (renamed "Automate" in UI) +- ✅ Privacy commitment + +--- + +## Data Migration + +### Your Data is Safe + +V2 is **fully compatible** with V1 data: +- ✅ User accounts and permissions +- ✅ API keys +- ✅ Settings and configurations +- ✅ Database (internal or external) +- ✅ Custom OCR language files +- ✅ Custom fonts and certificates + +**No manual migration needed** - just upgrade and your data continues working. + +--- + +## Deployment Options + +### Simple Upgrade + +Same as V1, everything in one container: +```bash +docker run -d \ + -p 8080:8080 \ + -v ./data:/configs \ + stirlingtools/stirling-pdf:latest +``` + +### New: Split Deployment (Optional) + +V2 allows separating frontend and backend: + +**Backend:** +```bash +docker run -d \ + -e MODE=BACKEND \ + -p 8081:8080 \ + stirlingtools/stirling-pdf:latest +``` + +**Frontend:** +```bash +docker run -d \ + -e MODE=FRONTEND \ + -e VITE_API_BASE_URL=http://backend:8080 \ + -p 8080:8080 \ + stirlingtools/stirling-pdf:latest +``` + +See [Docker Installation](../Installation/Docker%20Install.md) for details. + +--- + +## Post-Upgrade Checklist + +After upgrading, verify: + +- [ ] Can log in with existing credentials +- [ ] All PDF tools work as expected +- [ ] Settings and preferences retained +- [ ] API integrations still function (if applicable) +- [ ] Custom branding appears correctly +- [ ] OCR languages available +- [ ] Pipelines continue working (now called "Automate" in UI) + +--- + +## Getting Help + +If you encounter issues: + +1. **[Settings Changes](./Settings-Changes.md)** - Check if your config needs updates +2. **[Breaking Changes](./Breaking-Changes.md)** - Review what changed +3. **[FAQ](../FAQ.md)** - Common questions answered +4. **[GitHub Issues](https://github.com/Stirling-Tools/Stirling-PDF/issues)** - Report problems +5. **[Discord](https://discord.gg/Cn8pWhQRxZ)** - Community support + +--- + +## Rolling Back (If Needed) + +If you need to return to V1: + +```bash +docker pull stirlingtools/stirling-pdf:1.5.0 +# Update docker-compose.yml to use 1.5.0 tag +docker-compose up -d +``` + +**Note:** Your data will still work if you roll back. + +--- + +## Next Steps + +- **[New Features](./New-Features.md)** - Explore what's new +- **[Settings Changes](./Settings-Changes.md)** - Update your configuration +- **[Getting Started](../Getting%20Started.md)** - Start using V2 diff --git a/docs/Migration/Settings-Changes.md b/docs/Migration/Settings-Changes.md new file mode 100644 index 00000000..343cd242 --- /dev/null +++ b/docs/Migration/Settings-Changes.md @@ -0,0 +1,445 @@ +--- +sidebar_position: 1 +id: Settings-Changes +title: Settings Changes from V1 to V2 +description: Configuration changes between V1 and V2 +--- + +# Settings Changes from V1 to V2 + +This page documents all `settings.yml` changes between V1 and V2. + +--- + +## New Settings in V2 + +### PDF Signature Validation + +**Entire new section added:** + +```yaml +security: + validation: # NEW in V2 + trust: + serverAsAnchor: true + useSystemTrust: true + useMozillaBundle: true + useAATL: false # Adobe Approved Trust List + useEUTL: false # EU Trusted List + allowAIA: false + aatl: + url: https://trustlist.adobe.com/tl.pdf + eutl: + lotlUrl: https://ec.europa.eu/tools/lotl/eu-lotl.xml + acceptTransitional: false + revocation: + mode: none # Options: none, ocsp, crl, ocsp+crl + hardFail: false +``` + +**What it does:** Comprehensive PDF signature validation with configurable trust chains. + +**Migration:** No action needed, defaults are safe for most users. + +**Learn more:** [Certificate Signing](../Functionality/Security/Certificate-Signing.md) | [Security Configuration](../Configuration/System%20and%20Security.md#signature-validation) + +--- + +### Server Certificate Management + +**New section added:** + +```yaml +system: + serverCertificate: # NEW in V2 + enabled: true + organizationName: Stirling-PDF + validity: 365 # days + regenerateOnStartup: false +``` + +**What it does:** Auto-generates signing certificates for "Sign with Stirling-PDF" feature. + +**Migration:** Works automatically with defaults. + +**Learn more:** [Certificate Signing](../Functionality/Security/Certificate-Signing.md) | [Certificate Configuration](../Configuration/System%20and%20Security.md#server-certificates) + +--- + +### Split Deployment Support + +**New settings added:** + +```yaml +system: + corsAllowedOrigins: [] # NEW in V2 + frontendUrl: '' # NEW in V2 +``` + +**What it does:** +- `corsAllowedOrigins`: Allow frontend from different origin +- `frontendUrl`: Base URL for generating invite links + +**Migration:** Leave empty for unified deployment (default). + +**Example split deployment:** +```yaml +system: + corsAllowedOrigins: ['https://pdf.example.com'] + frontendUrl: 'https://pdf.example.com' +``` + +**Learn more:** [Docker Installation - Split Mode](../Installation/Docker%20Install.md#split-deployment-advanced-users) + +--- + +### Enhanced JWT Configuration + +**Changed settings:** + +```yaml +# V1 (OLD) +security: + jwt: + enabled: false + keyCleanup: false + secureCookie: true # REMOVED + +# V2 (NEW) +security: + jwt: + persistence: true # replaces 'enabled' + enableKeyRotation: true # NEW + enableKeyCleanup: true # replaces 'keyCleanup' + keyRetentionDays: 7 +``` + +**Migration:** +- Replace `jwt.enabled` with `jwt.persistence` +- Replace `jwt.keyCleanup` with `jwt.enableKeyCleanup` +- Add `jwt.enableKeyRotation: true` +- Remove `jwt.secureCookie` (no longer used) + +--- + +### Email Invites + +**New setting added:** + +```yaml +mail: + enableInvites: false # NEW in V2 +``` + +**What it does:** Enable email invitations for user registration. + +**Requirements:** +- `mail.enabled: true` +- `security.enableLogin: true` + +**Migration:** Set to `true` if you want invite functionality. + +--- + +### UI Logo Customization + +**New setting added:** + +```yaml +ui: + logoStyle: classic # NEW in V2 - Options: 'classic' or 'modern' +``` + +**What it does:** Choose between classic S icon or modern minimalist logo. + +**Migration:** Leave as `classic` (default) or set to `modern` for new look. + +--- + +## Removed Settings in V2 + +### UI Settings Moved to In-App Configuration + +**V1 settings (REMOVED):** + +```yaml +ui: + appName: '' # REMOVED + homeDescription: '' # REMOVED +``` + +**Migration:** +1. Enable login: `SECURITY_ENABLELOGIN=true` +2. Log in as admin +3. Go to Settings in UI +4. Configure app name and description there + +**Why:** In-app settings are more user-friendly and apply immediately. + +**Learn more:** [UI Customisation](../Configuration/UI%20Customisation.md) + +--- + +### Google Drive Integration + +**V1 settings (REMOVED):** + +```yaml +premium: + proFeatures: + googleDrive: # REMOVED in V2 + enabled: false + clientId: '' + apiKey: '' + appId: '' +``` + +**Migration:** Remove this section from your `settings.yml`. + +**Why:** Feature discontinued in V2. + +--- + +### Database Notifications + +**V1 settings (REMOVED):** + +```yaml +premium: + enterpriseFeatures: + databaseNotifications: # REMOVED in V2 + backups: + successful: false + failed: false + imports: + successful: false + failed: false +``` + +**Migration:** Remove this section from your `settings.yml`. + +**Why:** Replaced with more comprehensive audit logging. + +--- + +### Calibre Custom Path + +**V1 setting (REMOVED):** + +```yaml +system: + customPaths: + operations: + calibre: '' # REMOVED in V2 +``` + +**Migration:** Remove this line. + +**Why:** Path detection improved, no longer needs custom configuration. + +--- + +## Migration Checklist + +Use this checklist when upgrading your `settings.yml`: + +### Required Changes + +- [ ] **JWT Settings:** + - [ ] Replace `jwt.enabled` with `jwt.persistence` + - [ ] Replace `jwt.keyCleanup` with `jwt.enableKeyCleanup` + - [ ] Add `jwt.enableKeyRotation: true` + - [ ] Remove `jwt.secureCookie` line + +- [ ] **Remove Deprecated Sections:** + - [ ] Remove `premium.proFeatures.googleDrive` section + - [ ] Remove `premium.enterpriseFeatures.databaseNotifications` section + - [ ] Remove `system.customPaths.operations.calibre` line + +- [ ] **UI Settings:** + - [ ] Remove `ui.appName` (use in-app settings) + - [ ] Remove `ui.homeDescription` (use in-app settings) + +### Optional Additions + +- [ ] **Add `ui.logoStyle: classic`** if you want to explicitly set logo +- [ ] **Configure `security.validation`** if you need custom signature validation +- [ ] **Set `system.serverCertificate`** options if needed +- [ ] **Add `system.corsAllowedOrigins`** if using split deployment +- [ ] **Set `system.frontendUrl`** if using split deployment +- [ ] **Enable `mail.enableInvites`** if you want email invitations + +--- + +## Environment Variable Changes + +### New Environment Variables in V2 + +```bash +# Signature validation +SECURITY_VALIDATION_TRUST_SERVERASANCHOR=true +SECURITY_VALIDATION_TRUST_USESYSTEMTRUST=true +SECURITY_VALIDATION_TRUST_USEMOZILLABUNDLE=true +SECURITY_VALIDATION_TRUST_USEAATL=false +SECURITY_VALIDATION_TRUST_USEEUTL=false +SECURITY_VALIDATION_REVOCATION_MODE=none + +# Server certificates +SYSTEM_SERVERCERTIFICATE_ENABLED=true +SYSTEM_SERVERCERTIFICATE_ORGANIZATIONNAME="My Company" +SYSTEM_SERVERCERTIFICATE_VALIDITY=365 + +# Split deployment +SYSTEM_CORSALLOWEDORIGINS=https://pdf.example.com +SYSTEM_FRONTENDURL=https://pdf.example.com + +# JWT +SECURITY_JWT_PERSISTENCE=true +SECURITY_JWT_ENABLEKEYROTATION=true +SECURITY_JWT_ENABLEKEYCLEANUP=true + +# Email invites +MAIL_ENABLEINVITES=true + +# Logo +UI_LOGOSTYLE=modern +``` + +### Deprecated Environment Variables + +```bash +# These no longer work in V2 +SECURITY_JWT_ENABLED # Use SECURITY_JWT_PERSISTENCE +SECURITY_JWT_KEYCLEANUP # Use SECURITY_JWT_ENABLEKEYCLEANUP +SECURITY_JWT_SECURECOOKIE # Removed +UI_APPNAME # Use in-app settings +UI_HOMEDESCRIPTION # Use in-app settings +``` + +--- + +## Configuration Examples + +### Minimal V2 Configuration (Works Out of Box) + +```yaml +security: + enableLogin: false + +system: + defaultLocale: en-US + +ui: + appNameNavbar: '' +``` + +All new V2 features use sensible defaults. + +--- + +### V1 to V2 Configuration Diff + +**V1 Configuration:** +```yaml +security: + jwt: + enabled: false + keyCleanup: false + secureCookie: true + +ui: + appName: 'My PDF Tool' + homeDescription: 'Welcome!' + appNameNavbar: 'PDF Tool' + +premium: + proFeatures: + googleDrive: + enabled: false +``` + +**V2 Configuration:** +```yaml +security: + jwt: + persistence: true # Changed + enableKeyRotation: true # NEW + enableKeyCleanup: true # Changed + keyRetentionDays: 7 + validation: # NEW section + trust: + serverAsAnchor: true + useSystemTrust: true + +system: + serverCertificate: # NEW section + enabled: true + organizationName: Stirling-PDF + +ui: + appNameNavbar: 'PDF Tool' + logoStyle: classic # NEW + # appName and homeDescription removed - use in-app settings +``` + +--- + +## Troubleshooting + +### "Unknown configuration key" warnings + +**Symptom:** Warnings about unrecognized settings on startup. + +**Cause:** Old V1 settings still in your `settings.yml`. + +**Solution:** Remove deprecated settings listed in this guide. + +--- + +### JWT tokens invalid after upgrade + +**Symptom:** Users logged out, need to re-login. + +**Cause:** JWT key format changed. + +**Solution:** Expected behavior, users just need to log in again once. + +--- + +### Custom app name not showing + +**Symptom:** App name doesn't appear after setting `ui.appName`. + +**Cause:** Setting moved to in-app configuration. + +**Solution:** +1. Log in as admin +2. Go to Settings → UI +3. Configure there + +--- + +## Related Documentation + +- **[New Features](./New-Features.md)** - What's new in V2 +- **[Breaking Changes](./Breaking-Changes.md)** - Important changes +- **[Configuration Options](../Configuration/Extra-Settings.md)** - All configuration variables +- **[System and Security](../Configuration/System%20and%20Security.md)** - Advanced config + +--- + +## Summary + +**Key Takeaways:** +- ✅ Most settings remain the same +- 🔄 JWT settings have new names +- ➕ Many new optional features +- ➖ Google Drive and database notifications removed +- 🎨 UI settings moved to in-app configuration + +**Action Required:** +- Update JWT setting names +- Remove deprecated sections +- Optionally configure new features + +Your existing configuration will work in V2 with minimal changes! diff --git a/docs/Migration/_category_.json b/docs/Migration/_category_.json new file mode 100644 index 00000000..5bf84adf --- /dev/null +++ b/docs/Migration/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Migrating to V2", + "position": 4, + "link": { + "type": "doc", + "id": "Migration/Overview" + } +} diff --git a/docs/Pro.md b/docs/Pro.md index 4b357982..c08b9328 100644 --- a/docs/Pro.md +++ b/docs/Pro.md @@ -7,61 +7,148 @@ tags: - Enterprise - Pro - Premium - ---- -# Stirling PDF Pro - -Stirling PDF offers a Pro edition of its software. This is the same great software, but with added features and comforts. -Some users who seek additional features, bulk user discounts or SLA support may want our Enterprise package. - -## What's included in Pro -- Support tickets via support@stirlingpdf.com to reach the Stirling-PDF team for support -- [Advanced SSO](/Advanced%20Configuration/Single%20Sign-On%20Configuration), OAuth2 and SAML with automated login handling -- [External Database](/Advanced%20Configuration/External%20Database) support for optimised deployments and load-balancing support -- Custom automated metadata handling -- Google Drive integration -- Advanced user configurations (Coming soon) -- Plus other exciting features to come. - - -## What's included in Enterprise -- Prioritised Support tickets via support@stirlingpdf.com to reach the Stirling-PDF team for support and 1:1 meetings where applicable (Provided they come from the same email domain registered with us) -- Prioritised Enhancements to Stirling-PDF where applicable -- Prometheus endpoint for advancing Usage monitoring -- Usage Monitoring UI -- Audit logs (Coming very soon) - -## Cost - -We charge 12$ per seat per month. This followed the 'Named User' model, meaning a company that requires 5 unique users logged in at any time would require 5 seats. - - -## Purchase - -To purchase stirling PDF Pro, please navigate to https://stirlingpdf.com/pricing and select either Pro or Enterprise, depending on your use-case. -For Pro, you will be redirected to Stripe to set up and handle a subscription, after which you will be automatically emailed your license key at the email provided to Stripe. -## Activation +--- +# Stirling PDF Pro / Enterprise + +Stirling PDF offers Pro and Enterprise editions of its software. These are the same great software, but with added features, streamlined license management, and support options. + +## Available Plans + +### Free Plan +- **Cost**: Free forever +- **Users**: Up to 5 users +- **Features**: + - Self-hosted deployment + - All PDF operations + - Community support + - Regular updates +- **Perfect for**: Personal use, small teams, or evaluation + +### Server Plan +- **Cost**: $99/month or $999/year (save $189 with annual billing) +- **Available billing**: Monthly or Yearly +- **Users**: Unlimited users (flat rate regardless of user count) +- **Value**: The more users you have, the better the value (e.g., 100 users = $1/user/month) +- **Features**: + - Self-hosted deployment + - All PDF operations + - Unlimited users - no per-seat charges + - Community support + - Regular updates + - Support tickets via support@stirlingpdf.com + - [External Database](./Configuration/External%20Database.md) support for optimized deployments and load-balancing + - Google Drive integration +- **Perfect for**: Organizations with many users who want predictable, flat-rate pricing + +### Enterprise Plan +- **Cost**: Base server price + per-seat licensing (check [stirling.com/pricing](https://stirling.com/pricing)) +- **Available billing**: Monthly or Yearly (save with annual billing) +- **Users**: Per-seat licensing (flexible scaling) +- **Features**: + - All Server Plan features, plus: + - [Advanced SSO](./Configuration/Single%20Sign-On%20Configuration.md), OAuth2 and SAML with automated login handling + - Custom automated metadata handling + - Priority support tickets via support@stirlingpdf.com + - 1:1 meetings with the Stirling-PDF team (from registered email domain) + - Priority feature enhancements + - Prometheus endpoint for advanced usage monitoring + - Usage Monitoring UI + - Audit logs + - SLA guarantee + - Custom integrations support + - Dedicated account manager +- **Perfect for**: Large enterprises requiring priority support, SLA guarantees, and per-seat licensing + +## Purchasing a License + +### V2.0 - In-App Purchase (Recommended) + +Stirling PDF V2.0 offers streamlined in-app purchasing and license activation: + +1. **Navigate to Settings**: Log in as an admin and go to Settings → Admin Plan +2. **Select Your Plan**: Choose between Server (unlimited users) or Enterprise (per-seat) plans +3. **Choose Billing Period**: Select monthly or yearly billing (yearly saves money) +4. **Complete Checkout**: You'll be redirected to Stripe's secure checkout +5. **Automatic Activation**: After payment, your license key is automatically retrieved and activated +6. **Confirmation**: You'll see your active plan status immediately in the Settings + +**Benefits of In-App Purchase:** +- No manual license key entry required +- Instant activation after payment +- Manage billing directly from the app +- Automatic license key synchronization +- Easy plan upgrades + +### Alternative - Contact Us + +If you prefer to purchase outside the app or have questions: + +1. Visit [stirling.com/contact](https://stirling.com/contact) or email support@stirlingpdf.com +2. Our team will assist you with your purchase +3. You'll receive your license key via email +4. Follow manual activation steps below + +## Activating Your License + +### V2.0 - Automatic Activation + +If you purchased in-app, your license is automatically activated. No further action needed! + +### V2.0 - Manual Activation + +If you purchased via the website and received a license key by email: + +1. **Admin Settings**: Log in as an admin and navigate to Settings → Admin Plan +2. **Enter License Key**: Paste your license key in the provided field +3. **Activate**: Click "Activate License" +4. **Confirmation**: Your plan features will be enabled immediately + +**No restart required** - license activation is dynamic in V2.0! + +### Legacy - settings.yml Activation + +For advanced users or air-gapped environments, you can still activate via `settings.yml`: + +1. Navigate to the Stirling PDF config folder +2. Open `settings.yml` +3. Find the premium section: -To activate, navigate to the Stirling PDF config folder and open the ``settings.yml`` -Scroll down to the enterprise section, it should look like: ```yaml premium: key: 00000000-0000-0000-0000-000000000000 enabled: false # Enable license key checks for pro/enterprise features ``` -Enter the general license key provided in the email received from purchasing Stirling PDF Pro and change enabled from false to true, then restart the Stirling-PDF instance. -You should now see logs of your Stirling-PDF instance registering and authenticating the license and enabling the Pro features. +4. Replace the key with your license key +5. Change `enabled` from `false` to `true` +6. Restart Stirling-PDF + +For 100% offline air-gapped environments (Enterprise only), you can request a certificate file: -If you need your application to be in a 100% offline air-gapped environment and are unable to authenticate a license key, we also offer a certificate file, which can be provided on request (For enterprise users only) in the format ```yaml premium: key: file:config/cert.crt - enabled: false # Enable license key checks for pro/enterprise features + enabled: true ``` -Under these settings, you will be able to customise other premium features such as +## Managing Your Subscription + +### Billing Portal + +V2.0 includes a convenient billing management interface: + +1. Navigate to Settings → Admin Plan +2. Click "Manage Billing" +3. You'll be redirected to Stripe's customer portal where you can: + - Update payment methods + - View invoices + - Cancel or modify subscriptions + - Update billing information + +## Feature Configuration + +Once activated, you can customize premium features in your `settings.yml`: ```yaml premium: @@ -79,7 +166,79 @@ premium: appId: '' ``` +## License Model + +Stirling PDF uses an **installation-based licensing model**: + +- Each license is tied to a specific installation (identified by machine fingerprint) +- **Server Plan**: Flat-rate pricing with unlimited users for one installation + - $99/month = unlimited users (great value for larger teams) + - Example: 100 users = only $1 per user per month + - Example: 500 users = only $0.20 per user per month +- **Enterprise Plan**: Base installation license + per-seat user licensing +- **Named User Model**: For Enterprise, seats represent unique users who can log in + - Example: A company with 10 employees who use Stirling PDF needs 10 seats + +## Upgrading Your Plan + +You can upgrade from Free → Server or Server → Enterprise at any time: + +1. Navigate to Settings → Admin Plan +2. Click "Upgrade Plan" +3. Select your new plan tier +4. Complete checkout +5. Your existing license will be automatically upgraded + +**Note**: When upgrading, your new plan starts immediately and you'll be credited for any unused time on your previous plan. + +## Support + +### Community Support (All Plans) +- GitHub Issues: [github.com/Stirling-Tools/Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF) +- Discord: Join our community server + +### Email Support (Server & Enterprise) +- Email: support@stirlingpdf.com +- Response time: 1-2 business days (Server), Priority response (Enterprise) + +### Enterprise Support +- Priority email support +- 1:1 meetings with Stirling-PDF team +- Dedicated account manager +- SLA guarantees + +## Frequently Asked Questions + +**Q: Can I try before I buy?** +A: Yes! The Free plan includes all features for up to 5 users. Test thoroughly before upgrading. + +**Q: What happens if I cancel?** +A: Your license remains active until the end of your billing period, then reverts to Free plan limits. + +**Q: Can I move my license to a different server?** +A: Contact support@stirlingpdf.com for license transfers. Enterprise customers have more flexibility. + +**Q: Do I need an internet connection?** +A: License activation requires internet for initial verification. Enterprise customers can request offline certificate files. + +**Q: What's the difference between monthly and yearly billing?** +A: Yearly billing offers significant savings. For Server plan: $999/year vs $1,188/year monthly (save $189 = almost 2 months free). + +**Q: How do I get an invoice?** +A: Invoices are automatically sent via email and accessible through the Billing Portal. + +## Migration from V1 + +If you're upgrading from Stirling PDF V1 with an existing license: + +1. Your existing license key will continue to work in V2 +2. You can enter it manually via Settings → Admin Plan +3. Or, re-activate through the in-app purchase flow +4. Contact support@stirlingpdf.com if you encounter any issues + +--- +For pricing details, visit [stirling.com/pricing](https://stirling.com/pricing) -Analytics Pixel +For technical support, email support@stirlingpdf.com diff --git a/docs/Server-Admin-Onboarding.md b/docs/Server-Admin-Onboarding.md new file mode 100644 index 00000000..b52e8709 --- /dev/null +++ b/docs/Server-Admin-Onboarding.md @@ -0,0 +1,1618 @@ +--- +sidebar_position: 1 +id: Production-Deployment-Guide +title: Production Deployment Guide +description: Complete production deployment guide for server administrators deploying Stirling-PDF +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Production Deployment Guide + +Welcome! This guide will walk you through deploying Stirling-PDF for your organization, from initial installation to advanced configuration and scaling. + +:::tip For Organizations & Teams +This guide is designed for server administrators deploying Stirling-PDF for teams, departments, or entire organizations. If you're interested in **Pro or Enterprise features** (SSO, advanced user management, priority support), we'll highlight upgrade paths throughout this guide. +::: + +--- + +## Overview: What You'll Accomplish + +By the end of this guide, you'll have: + +1. ✅ **Stirling-PDF running** on your infrastructure +2. ✅ **User authentication configured** with admin access +3. ✅ **Settings customized** for your organization +4. ✅ **Security hardened** with HTTPS and proper access controls +5. ✅ **Monitoring setup** to track usage and performance +6. ✅ **Understanding of Pro/Enterprise** upgrade paths + +**Time estimate:** 30-60 minutes for basic setup, 2-3 hours for full enterprise configuration + +--- + +## Step 1: Choose Your Deployment Path + + + + +**Best for:** Most organizations, production deployments, easy management + +**Why Docker Compose?** +- ✅ Simple one-command deployment +- ✅ Easy updates and rollbacks +- ✅ Persistent data management +- ✅ Production-ready configuration +- ✅ Easy to scale and customize + +**Requirements:** +- Docker Engine 20.10+ +- Docker Compose 1.29+ +- 2GB RAM minimum (4GB+ recommended) +- 10GB disk space + +**Jump to:** [Docker Compose Setup](#docker-compose-setup) + + + + +**Best for:** Quick testing, single-container deployments, learning + +**Why Docker Run?** +- ✅ Fastest way to get started +- ✅ Single command deployment +- ✅ Good for testing before production +- ⚠️ More manual management needed + +**Requirements:** +- Docker Engine 20.10+ +- 2GB RAM minimum +- 5GB disk space + +**Jump to:** [Docker Run Setup](#docker-run-setup) + + + + +**Best for:** Enterprise scale, high availability, cloud-native deployments + +**Why Kubernetes?** +- ✅ Auto-scaling capabilities +- ✅ High availability and fault tolerance +- ✅ Load balancing built-in +- ✅ Cloud provider integration +- ⚠️ More complex to set up + +**Requirements:** +- Kubernetes cluster 1.19+ +- kubectl configured +- Persistent volume support +- Load balancer support + +**Jump to:** [Kubernetes Guide](./Installation/Kubernetes.md) + + + + +**Best for:** Environments without Docker, specific OS requirements + +**Why Bare Metal?** +- ✅ Maximum control +- ✅ No container overhead +- ✅ Custom Java configurations +- ⚠️ More maintenance required + +**Requirements:** +- Java 21+ +- Linux/Unix system +- 2GB RAM minimum +- LibreOffice, Tesseract (for features) + +**Jump to:** [Unix Installation Guide](./Installation/Unix.md) + + + + +--- + +## Step 2: Installation + +Follow the installation instructions for your chosen deployment method from Step 1. + + + + +### Docker Compose Setup + +This is the recommended approach for production deployments. + +#### 2.1: Create docker-compose.yml + +Create a directory for your Stirling-PDF deployment: + +```bash +mkdir -p ~/stirling-pdf +cd ~/stirling-pdf +``` + +Create `docker-compose.yml` with this production-ready configuration: + +```yaml +version: '3.3' + +services: + stirling-pdf: + image: stirlingtools/stirling-pdf:latest + container_name: stirling-pdf + ports: + - '8080:8080' + volumes: + # Persistent data storage + - ./stirling-data/tessdata:/usr/share/tessdata # OCR language files + - ./stirling-data/configs:/configs # Settings & database + - ./stirling-data/logs:/logs # Application logs + - ./stirling-data/customFiles:/customFiles:rw # Custom branding files + - ./stirling-data/pipeline:/pipeline # Automation configs + environment: + # Core Settings + - SECURITY_ENABLELOGIN=true # Enable user authentication + + # Language & Localization + - LANGS=en_GB # Change to your locale + + # System Configuration + - SYSTEM_DEFAULTLOCALE=en-GB # Default locale + - SYSTEM_GOOGLEVISIBILITY=false # Hide from search engines + - SYSTEM_ROOTURIPATH=/ # Base URL path + - SYSTEM_CONNECTIONTIMEOUTMINUTES=5 # Connection timeout + - SYSTEM_MAXFILESIZE=2000 # Max file size in MB + + # Optional: Logging + - SYSTEM_CUSTOMSTATICFILEPATH=/customFiles/static/ # Custom files path + + restart: unless-stopped + + # Optional: Resource limits + deploy: + resources: + limits: + memory: 4G + cpus: '2.0' + reservations: + memory: 2G + cpus: '1.0' +``` + +#### 2.2: Start Stirling-PDF + +```bash +# Start the container +docker-compose up -d + +# Check if it's running +docker-compose ps + +# View logs +docker-compose logs -f +``` + +#### 2.3: Verify Installation + +Open your browser and navigate to: +``` +http://your-server-ip:8080 +``` + +You should see the Stirling-PDF homepage! + +:::tip Success! +If you see the Stirling-PDF interface, your installation is successful. Continue to Step 3 to set up authentication. +::: + +**Troubleshooting:** +- **Can't connect?** Check firewall rules: `sudo ufw allow 8080` +- **Container won't start?** Check logs: `docker-compose logs` +- **Permission errors?** Fix permissions: `sudo chmod -R 755 ./stirling-data` + + + + +### Docker Run Setup + +For quick testing or simpler deployments. + +#### 2.1: Create Data Directory and Run Container + +```bash +# Create data directory +mkdir -p ~/stirling-data + +# Run Stirling-PDF +docker run -d \ + --name stirling-pdf \ + -p 8080:8080 \ + -v ~/stirling-data/tessdata:/usr/share/tessdata \ + -v ~/stirling-data/configs:/configs \ + -v ~/stirling-data/logs:/logs \ + -v ~/stirling-data/customFiles:/customFiles:rw \ + -e SECURITY_ENABLELOGIN=true \ + -e LANGS=en_GB \ + -e SYSTEM_DEFAULTLOCALE=en-GB \ + -e SYSTEM_GOOGLEVISIBILITY=false \ + -e SYSTEM_MAXFILESIZE=2000 \ + --restart unless-stopped \ + stirlingtools/stirling-pdf:latest +``` + +#### 2.2: Verify Installation + +```bash +# Check if running +docker ps | grep stirling-pdf + +# View logs +docker logs -f stirling-pdf +``` + +Open your browser and navigate to: +``` +http://your-server-ip:8080 +``` + +You should see the Stirling-PDF homepage! + +:::tip Success! +If you see the Stirling-PDF interface, your installation is successful. Continue to Step 3 to set up authentication. +::: + +**Troubleshooting:** +- **Can't connect?** Check firewall rules: `sudo ufw allow 8080` +- **Container won't start?** Check logs: `docker logs stirling-pdf` +- **Permission errors?** Fix permissions: `sudo chmod -R 755 ~/stirling-data` + + + + +### Kubernetes Setup + +For enterprise-scale deployments with high availability. + +Kubernetes deployment requires: +- Persistent Volume Claims (PVCs) +- Deployments and Services +- Ingress/LoadBalancer configuration +- Resource limits and autoscaling + +**See full guide:** [Kubernetes Installation Guide](./Installation/Kubernetes.md) + +This includes complete YAML configurations, namespace setup, SSL/TLS, and horizontal pod autoscaling. + + + + +### Bare Metal Setup + +For environments without Docker or specific OS requirements. + +Bare metal installation requires: +- Java 21+ +- LibreOffice (for conversions) +- Tesseract OCR (for OCR features) +- Systemd service setup + +**See full guide:** [Unix Installation Guide](./Installation/Unix.md) + +This includes complete dependency installation, JAR setup, systemd configuration, and troubleshooting. + + + + +--- + +## Step 3: Initial Login & Admin Setup + +Now that Stirling-PDF is running with authentication enabled, you need to create your admin account. + +### 3.1: First-Time Login + +1. **Navigate to your Stirling-PDF instance:** + ``` + http://your-server-ip:8080 + ``` + +2. **Log in with default credentials:** + ``` + Username: admin + Password: stirling + ``` + +3. **Change the default password immediately:** + - After first login, go to Settings → Account + - Change to a strong password (12+ characters, mixed case, numbers, symbols) + +:::tip Customizing Default Credentials +You can set custom default credentials **before first startup** using environment variables: + +```yaml +environment: + - SECURITY_INITIALLOGIN_USERNAME=youradmin + - SECURITY_INITIALLOGIN_PASSWORD=YourSecurePassword123! +``` + +**Important:** These only work on first startup. If you change them after the database is created, the old credentials remain active. Always change the password through the UI after first login. +::: + +:::tip User Registration +After first login, you can control how additional users are created through Settings → Security (covered in Step 4). +::: + +### 3.2: Verify Admin Access + +1. **Log in with your admin account** + +2. **Click the Settings gear icon** ⚙️ in the top navigation bar + +3. **Verify you have admin access** by checking for admin-only sections: + - **General Settings** - System configuration + - **Security Settings** - User management, login settings + - **UI Customization** - Branding and appearance + - **User Management** - Create/manage users + - **Endpoint Configuration** - Enable/disable tools + + **Note:** Regular users can also access Settings but only see their personal preferences (language, theme). Only admins see the sections listed above. + +4. **If you don't see admin sections:** + - Check logs: `docker logs stirling-pdf` + - Verify you're the first user created + - Confirm `SECURITY_ENABLELOGIN=true` is set + +:::caution Secure Your Admin Account +- **Change the default password immediately** after first login +- Use a strong password (12+ characters, mixed case, numbers, symbols) +- Consider using SSO (OAuth2/SAML2) to avoid password management entirely +::: + +--- + +## Step 4: Configure Essential Settings + +Now that you're logged in as admin, let's configure Stirling-PDF for your organization. + +### 4.1: General Settings + +Navigate to **Settings → General** + + + + +**These settings should be configured immediately:** + +#### System Locale & Language +```yaml +system: + defaultLocale: en-US # or en-GB, de-DE, fr-FR, etc. + +ui: + languages: [] # Empty = all languages enabled. Or specify: ["en_GB", "de_DE", "fr_FR"] +``` + +**Why:** Ensures UI appears in the correct language for your users + +#### Search Engine Visibility +```yaml +system: + googlevisibility: false # Prevents search engines from indexing your site +``` + +**Why:** Keeps your internal PDF tool private + +#### File Upload Limits +```yaml +system: + fileUploadLimit: 2000MB # or "2GB" - adjust based on your needs +``` + +**Why:** Prevents users from uploading files that crash the system + + + + +**Configure these for better user experience:** + +#### Legal & Compliance +```yaml +legal: + termsAndConditions: https://yourcompany.com/tos # or empty string to disable + privacyPolicy: https://yourcompany.com/privacy # or empty string to disable + accessibilityStatement: '' # optional + cookiePolicy: '' # optional + impressum: '' # optional (required in some countries like Germany) +``` + +**Why:** Legal compliance, especially in GDPR/regulated industries + +#### Update Notifications (Optional) +```yaml +system: + showUpdate: false # Set true to show update notifications + showUpdateOnlyAdmin: false # Only admins see updates (requires showUpdate: true) +``` + +**Why:** Control update notifications in production environments + +#### Process Limits +```yaml +processExecutor: + sessionLimit: + libreOfficeSessionLimit: 1 + tesseractSessionLimit: 1 + pythonOpenCvSessionLimit: 8 + timeoutMinutes: + libreOfficetimeoutMinutes: 30 + tesseractTimeoutMinutes: 30 +``` + +**Why:** Prevents resource exhaustion based on your server capacity + + + + +### 4.2: Security Settings + +Navigate to **Settings → Security** + +:::caution Critical for Production +These settings directly impact your organization's security. Review carefully! +::: + +#### User Registration Control + + + + +**Best for:** Controlled environments, enterprises, security-conscious orgs + +**How it works:** +1. Admin creates user accounts manually in Settings → User Management +2. Admin shares credentials with users securely +3. Users log in with provided credentials + +**Email Invitations (Optional):** +If you configure email, admins can send invitation links instead. + + + + +```yaml +mail: + enabled: true + enableInvites: true + smtp: + host: smtp.gmail.com + port: 587 + username: noreply@yourcompany.com + password: ${MAIL_PASSWORD} # Use environment variable + tls: + enabled: true +``` + + + + +```bash +MAIL_ENABLED=true +MAIL_ENABLEINVITES=true +MAIL_SMTP_HOST=smtp.gmail.com +MAIL_SMTP_PORT=587 +MAIL_SMTP_USERNAME=noreply@yourcompany.com +MAIL_SMTP_PASSWORD=your-app-password +MAIL_SMTP_TLS_ENABLED=true +``` + + + + + + + +**Best for:** Large enterprises, existing SSO infrastructure + +**Single Sign-On (SSO) options:** +- **OAuth2:** Free - Supports Google, GitHub, Keycloak, any OpenID Connect provider +- **SAML2:** Pro/Enterprise only - Supports Okta, Azure AD, etc. + +**Key settings:** +```yaml +security: + enableLogin: true + loginMethod: oauth2 # or 'saml2' or 'all' + oauth2: + enabled: true + autoCreateUser: true # Auto-create users on first login + blockRegistration: false # Set true to require admin pre-registration +``` + +**Benefits:** +- ✅ No password management +- ✅ Centralized access control +- ✅ Automatic user provisioning +- ✅ Corporate policy compliance + +**See full guide:** [SSO Configuration Guide](./Configuration/Single%20Sign-On%20Configuration.md) + +Complete configuration examples for Google, GitHub, Keycloak, Okta, Azure AD, and generic OIDC/SAML2 providers. + + + + +#### Login Security Settings + +```yaml +security: + csrfDisabled: false # NEVER disable CSRF protection in production + loginAttemptCount: 5 # Lock account after 5 failed attempts + loginResetTimeMinutes: 120 # Unlock after 2 hours +``` + +**Notes:** +- Session timeout is not configurable via settings +- Password policies (length, complexity) are not currently configurable +- Use SSO/OAuth2 for enterprise password policies + +### 4.3: Feature Control + +Navigate to **Settings → Endpoints** + +Control which PDF tools are available to users. + + + + +**All tools are enabled by default.** You can disable specific tools if needed: + +```yaml +endpoints: + toRemove: [] # Add tool IDs to disable, e.g. ['sign', 'add-password'] + groupsToRemove: [] # Disable entire groups, e.g. ['LibreOffice'] +``` + +**Most organizations don't need to disable anything** - all tools are useful and safe + + + + +**Example: Disable security-sensitive tools:** + +```yaml +endpoints: + toRemove: + - 'add-password' # Disable password protection tool + - 'remove-password' # Disable password removal tool + - 'change-permissions' # Disable permissions modification +``` + +**Example: Disable entire groups:** + +```yaml +endpoints: + groupsToRemove: + - 'LibreOffice' # Disables all LibreOffice-based conversions +``` + +**How to disable in UI:** +1. Log in as admin +2. Go to Settings → Endpoints +3. Find tool you want to disable +4. Toggle off +5. Save changes + +**See all tool IDs:** [Endpoint Customisation](./Configuration/Endpoint%20or%20Feature%20Customisation.md) + + + + +### 4.4: Save and Apply Settings + +After configuring all settings: + +1. **Click "Save" button** at the bottom of each settings page +2. **Verify settings saved** - You should see a success message +3. **Some settings require restart** - Check if restart notification appears +4. **Test changes** - Log out and log in as a regular user to verify + +**If restart is needed:** +```bash +# Docker Compose +docker-compose restart + +# Docker Run +docker restart stirling-pdf +``` + +--- + +## Step 5: HTTPS & Domain Setup + +:::danger Production Requirement +**Never run in production without HTTPS.** User credentials and PDF files will be transmitted in plain text over the network. +::: + +### 5.1: Choose Your HTTPS Method + + + + +**Best for:** Simple deployments, no reverse proxy needed + +Stirling-PDF can handle HTTPS directly using built-in SSL configuration. + +#### Configure SSL in Stirling-PDF + +1. **Generate or obtain SSL certificate:** + + **Option A: Self-signed (for testing/internal use):** + ```bash + # Generate self-signed certificate + keytool -genkeypair \ + -alias stirling \ + -keyalg RSA \ + -keysize 2048 \ + -storetype PKCS12 \ + -keystore keystore.p12 \ + -validity 365 + + # Move to configs directory + mv keystore.p12 ./stirling-data/configs/ + ``` + + **Option B: Let's Encrypt (for production):** + ```bash + # Get certificate with certbot + sudo certbot certonly --standalone -d pdf.yourcompany.com + + # Convert to PKCS12 format + sudo openssl pkcs12 -export \ + -in /etc/letsencrypt/live/pdf.yourcompany.com/fullchain.pem \ + -inkey /etc/letsencrypt/live/pdf.yourcompany.com/privkey.pem \ + -out keystore.p12 \ + -name stirling + + # Move to configs + sudo mv keystore.p12 ./stirling-data/configs/ + sudo chown $USER:$USER ./stirling-data/configs/keystore.p12 + ``` + +2. **Create custom_settings.yml:** + + Create `./stirling-data/configs/custom_settings.yml`: + ```yaml + server: + port: 8443 # HTTPS port + ssl: + enabled: true + key-store: file:/configs/keystore.p12 + key-store-password: your-keystore-password + key-store-type: PKCS12 + key-alias: stirling + ``` + +3. **Update docker-compose.yml to expose port 8443:** + ```yaml + services: + stirling-pdf: + ports: + - '8443:8443' # Change from 8080:8080 + ``` + +4. **Restart Stirling-PDF:** + ```bash + docker-compose down + docker-compose up -d + ``` + +5. **Access via HTTPS:** + ``` + https://pdf.yourcompany.com:8443 + ``` + +**Benefits:** +- ✅ Simple setup, no reverse proxy needed +- ✅ Direct SSL termination in application +- ✅ Good for small deployments + +**Limitations:** +- ⚠️ Manual certificate renewal +- ⚠️ No load balancing +- ⚠️ Port 8443 instead of standard 443 + +**Learn more:** [Custom Settings - SSL Configuration](./Configuration/Extra-Settings.md#ssltls-configuration) + + + + +**Best for:** Production deployments, standard ports (443), load balancing + +Use a reverse proxy like **Nginx, Apache, or Traefik** to handle HTTPS. + +#### Option A: Nginx with Let's Encrypt + +**Install Nginx and Certbot:** +```bash +sudo apt update +sudo apt install nginx certbot python3-certbot-nginx +``` + +**Configure Nginx:** + +Create `/etc/nginx/sites-available/stirling-pdf`: +```nginx +server { + listen 80; + server_name pdf.yourcompany.com; + + # Redirect HTTP to HTTPS + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + server_name pdf.yourcompany.com; + + # SSL certificates (will be added by certbot) + ssl_certificate /etc/letsencrypt/live/pdf.yourcompany.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/pdf.yourcompany.com/privkey.pem; + + # Strong SSL settings + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; + ssl_prefer_server_ciphers on; + + # Security headers + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + add_header X-Frame-Options "SAMEORIGIN" always; + add_header X-Content-Type-Options "nosniff" always; + add_header X-XSS-Protection "1; mode=block" always; + + # Large file uploads + client_max_body_size 2000M; + client_body_timeout 300s; + + # Proxy to Stirling-PDF + location / { + proxy_pass http://localhost:8080; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # WebSocket support (if needed) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Timeouts for large files + proxy_connect_timeout 300s; + proxy_send_timeout 300s; + proxy_read_timeout 300s; + } +} +``` + +**Enable site and get certificate:** +```bash +# Enable site +sudo ln -s /etc/nginx/sites-available/stirling-pdf /etc/nginx/sites-enabled/ +sudo nginx -t +sudo systemctl reload nginx + +# Get Let's Encrypt certificate +sudo certbot --nginx -d pdf.yourcompany.com + +# Auto-renewal (certbot sets this up automatically) +sudo certbot renew --dry-run +``` + +**Update DNS:** +``` +A record: pdf.yourcompany.com → your-server-ip +``` + +**Access your site:** +``` +https://pdf.yourcompany.com +``` + + + + +**Best for:** Docker environments, automatic certificate management + +Traefik is a Docker-native reverse proxy that automatically: +- Obtains SSL certificates from Let's Encrypt +- Renews certificates automatically +- Routes traffic based on Docker labels + +**Key benefits:** +- ✅ Zero-config certificate management +- ✅ Docker label-based routing +- ✅ Automatic service discovery + +Add Traefik container to your `docker-compose.yml` and configure Stirling-PDF with Docker labels for routing. + +**See Traefik documentation:** https://doc.traefik.io/traefik/user-guides/docker-compose/basic-example/ + + + + +**Best for:** No public IP, behind firewall, home servers + +Cloudflare Tunnel provides: +- ✅ No port forwarding needed +- ✅ DDoS protection included +- ✅ Automatic HTTPS +- ✅ Free for most use cases + +**Quick setup:** +1. Install `cloudflared` +2. Authenticate with Cloudflare +3. Create tunnel pointing to `http://localhost:8080` +4. Add DNS record +5. Run as system service + +**See Cloudflare documentation:** https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/tunnel-guide/ + + + + +### 5.2: Update Stirling-PDF Configuration + +After setting up HTTPS, update Stirling-PDF to use the correct URL: + +**In Settings → General:** +```yaml +System Settings: + Root URI Path: / (or /pdf if using subdirectory) + Frontend URL: https://pdf.yourcompany.com + CORS Allowed Origins: https://pdf.yourcompany.com +``` + +**Environment variable (if using split deployment):** +```yaml +environment: + - VITE_API_BASE_URL=https://pdf.yourcompany.com + - SYSTEM_ROOTURIPATH=/ + - SECURITY_CSRFDISABLED=false +``` + +--- + +## Step 6: User Management + +Now that your system is secure and accessible, let's set up users. + +### 6.1: Understanding User Roles + + + + +**Out-of-the-box roles:** + +| Role | Permissions | Use Case | +|------|-------------|----------| +| **Admin** | Full access to all features, settings, user management | System administrators, IT staff | +| **User** | Access to enabled PDF tools, no settings access | Regular employees, end users | + +**Admin capabilities:** +- ✅ Access all PDF tools +- ✅ Manage users (create, delete, reset passwords) +- ✅ Configure all settings +- ✅ View usage statistics +- ✅ Enable/disable features +- ✅ View logs (if configured) + +**User capabilities:** +- ✅ Access enabled PDF tools only +- ✅ Upload and process files +- ✅ Download results +- ❌ No settings access +- ❌ No user management +- ❌ No system configuration + + + + +### 6.2: Adding Users + + + + +**As admin, manually create user accounts:** + +1. **Navigate to Settings → User Management** + +2. **Click "Add User" button** + +3. **Fill in user details:** + ``` + Username: john.doe + Email: john.doe@yourcompany.com (optional but recommended) + Password: Auto-generate or set manually + Role: User (or Admin for additional admins) + Enabled: Yes + ``` + +4. **Click "Create User"** + +5. **Share credentials with user** (via secure channel) + +**Bulk user creation:** +You can paste a list of email addresses (one per line) to create multiple users at once. + +**Best practices:** +- Use email as username for easier identification +- Auto-generate strong passwords +- Keep records of who has access + + + + +**Send email invitations** (requires email configuration): + +1. **Navigate to Settings → User Management** + +2. **Click "Invite User" button** + +3. **Fill in details:** + ``` + Email: jane.smith@yourcompany.com + Role: User + Message: Optional welcome message + ``` + +4. **Click "Send Invitation"** + +5. **User receives email** with magic link to register + +6. **User clicks link, creates password, and is automatically logged in** + +**Bulk invitations:** +You can paste a list of email addresses (one per line) to send multiple invitations at once. + +**Benefits:** +- ✅ More secure (user sets own password) +- ✅ Professional onboarding experience +- ✅ Magic link authentication +- ✅ No need to share passwords + +**Email configuration required:** +```yaml +Email Settings: + SMTP Host: smtp.gmail.com + SMTP Port: 587 + SMTP Username: noreply@yourcompany.com + SMTP Password: your-app-password + From Address: noreply@yourcompany.com +``` + + + + +### 6.3: User Management Tasks + +**Common admin tasks:** + +#### View All Users +- Navigate to **Settings → User Management** +- See list of all users with status, role, last login + +#### Reset User Password +1. Find user in user list +2. Click "Reset Password" button +3. New password generated or set manually +4. Share new password securely + +#### Disable/Enable User +1. Find user in user list +2. Toggle "Enabled" switch +3. Disabled users cannot log in + +#### Delete User +1. Find user in user list +2. Click "Delete" button +3. Confirm deletion +4. ⚠️ **Warning:** This is permanent + +#### Change User Role +1. Find user in user list +2. Change role dropdown (User/Admin) +3. Save changes + +--- + +## Step 7: Monitoring & Usage Tracking + +Understanding how your users are using Stirling-PDF helps with capacity planning and identifying issues. + +### 7.1: Basic Monitoring + + + + +**View application logs:** + +```bash +# Docker Compose +docker-compose logs -f stirling-pdf + +# Docker Run +docker logs -f stirling-pdf + +# Last 100 lines +docker logs --tail 100 stirling-pdf + +# Filter for errors +docker logs stirling-pdf 2>&1 | grep ERROR +``` + +**What to look for:** +- ✅ Successful operations +- ⚠️ Warnings (disk space, memory) +- ❌ Errors (failed operations, crashes) +- 🔒 Security events (failed logins, unauthorized access) + +**Common log entries:** +``` +INFO: User john.doe uploaded file document.pdf +INFO: Operation MERGE completed successfully +WARN: Disk space low: 85% used +ERROR: OCR operation failed: Tesseract not found +``` + + + + +#### Basic API Monitoring + +**Usage Statistics API** (available to all users): +```bash +# Application status +curl http://localhost:8080/api/v1/info/status + +# Request counts +curl http://localhost:8080/api/v1/info/requests/all + +# Unique users +curl http://localhost:8080/api/v1/info/requests/all/unique +``` + +**Health Check Endpoint:** +```bash +curl http://localhost:8080/api/v1/health + +# Response: +{"status":"UP","components":{"diskSpace":{"status":"UP"}}} +``` + +**Use for:** +- Load balancer health checks +- Uptime monitoring (Uptime Robot, Pingdom) +- Custom monitoring scripts + +#### Prometheus Integration (Pro/Enterprise) + +Stirling-PDF Pro/Enterprise supports Prometheus metrics for advanced monitoring. + +**Learn more:** [Usage Monitoring - Prometheus Setup](./Configuration/Usage%20Monitoring.md#prometheus-monitoring-configuration) + +**Features:** +- JVM metrics (memory, GC, threads) +- System metrics (CPU, disk) +- Application metrics (request rates, processing times) +- PDF processing metrics + +#### Log Aggregation + +Forward logs to centralized logging: + +**Option 1: Docker log driver** +```yaml +services: + stirling-pdf: + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" +``` + +**Option 2: Syslog** +```yaml +services: + stirling-pdf: + logging: + driver: syslog + options: + syslog-address: "tcp://your-syslog-server:514" +``` + +**Popular log aggregation tools:** +- ELK Stack (Elasticsearch, Logstash, Kibana) +- Splunk +- Graylog +- Datadog + + + + +### 7.2: Set Up Monitoring + +**Basic monitoring approach:** + +1. **Monitor Docker logs regularly:** + ```bash + docker logs stirling-pdf --tail 100 -f + ``` + +2. **Check Docker container health:** + ```bash + docker ps + docker stats stirling-pdf + ``` + +3. **Monitor disk space:** + ```bash + df -h + du -sh ./stirling-data/* + ``` + +4. **Use external uptime monitoring:** + - Uptime Robot (free) + - Pingdom + - StatusCake + - Monitor the health endpoint: `http://localhost:8080/api/v1/health` + +--- + +## Step 8: Backup & Disaster Recovery + +Protect your users' data and configuration with proper backups. + +### 8.1: What to Backup + +**Critical data to backup:** + +| Data | Location | Frequency | Importance | +|------|----------|-----------|------------| +| **User Database (if local)** | `./stirling-data/configs/stirling-pdf.db` | Daily | Critical* | +| **Settings File** | `./stirling-data/configs/settings.yml` | After changes | Critical | +| **Custom Files** | `./stirling-data/customFiles/` | After changes | High | +| **OCR Languages** | `./stirling-data/tessdata/` | Weekly | Medium | +| **Logs** | `./stirling-data/logs/` | Optional | Low | + +**\*Note on User Database:** +- **Free edition:** Uses local H2 database (`stirling-pdf.db`) - must be backed up +- **Pro/Enterprise:** Should use external PostgreSQL database (backed up separately) + +:::tip Pro/Enterprise Recommendation +Pro and Enterprise users should configure an external PostgreSQL database instead of using the local H2 database. This provides better reliability, scalability, and backup capabilities. + +**Learn more:** [External Database Configuration](./Configuration/External%20Database.md) +::: + +### 8.2: Backup Strategies + + + + +**Create automated backup script:** + +Create `backup-stirling.sh`: +```bash +#!/bin/bash + +# Configuration +BACKUP_DIR="/backups/stirling-pdf" +STIRLING_DATA="/path/to/stirling-data" +RETENTION_DAYS=30 + +# Create backup directory +mkdir -p "$BACKUP_DIR" + +# Generate timestamp +TIMESTAMP=$(date +%Y%m%d-%H%M%S) +BACKUP_FILE="$BACKUP_DIR/stirling-backup-$TIMESTAMP.tar.gz" + +# Stop container (optional, for consistency) +# docker-compose -f /path/to/docker-compose.yml stop stirling-pdf + +# Create backup +tar -czf "$BACKUP_FILE" \ + -C "$STIRLING_DATA" \ + configs/ \ + customFiles/ \ + tessdata/ + +# Start container (if stopped) +# docker-compose -f /path/to/docker-compose.yml start stirling-pdf + +# Delete old backups +find "$BACKUP_DIR" -name "stirling-backup-*.tar.gz" -mtime +$RETENTION_DAYS -delete + +# Log result +echo "[$TIMESTAMP] Backup completed: $BACKUP_FILE" +``` + +**Make executable and schedule:** +```bash +chmod +x backup-stirling.sh + +# Add to crontab (daily at 2 AM) +crontab -e +# Add: 0 2 * * * /path/to/backup-stirling.sh >> /var/log/stirling-backup.log 2>&1 +``` + + + + +**Backup Docker volumes:** + +```bash +# Stop container +docker-compose stop stirling-pdf + +# Backup volumes +docker run --rm \ + -v $(pwd)/stirling-data:/data \ + -v $(pwd)/backups:/backup \ + alpine tar -czf /backup/stirling-data-$(date +%Y%m%d).tar.gz /data + +# Start container +docker-compose start stirling-pdf +``` + +**Automated with Cron:** +Create `docker-volume-backup.sh`: +```bash +#!/bin/bash +cd /path/to/stirling-pdf +docker-compose stop stirling-pdf +docker run --rm \ + -v "$(pwd)/stirling-data:/data" \ + -v "$(pwd)/backups:/backup" \ + alpine tar -czf /backup/stirling-data-$(date +%Y%m%d).tar.gz /data +docker-compose start stirling-pdf + +# Cleanup old backups (keep 30 days) +find backups/ -name "stirling-data-*.tar.gz" -mtime +30 -delete +``` + + + + +### 8.3: Restore from Backup + +**Restore procedure:** + +1. **Stop Stirling-PDF:** + ```bash + docker-compose stop stirling-pdf + ``` + +2. **Extract backup:** + ```bash + tar -xzf stirling-backup-YYYYMMDD-HHMMSS.tar.gz -C ./stirling-data/ + ``` + +3. **Verify files restored:** + ```bash + ls -la ./stirling-data/configs/ + # Should see: stirling-pdf.db, settings.yml + ``` + +4. **Start Stirling-PDF:** + ```bash + docker-compose start stirling-pdf + ``` + +5. **Verify functionality:** + - Access web interface + - Log in as admin + - Check users exist + - Verify settings + +--- + +## Step 9: Performance Optimization + +Optimize Stirling-PDF for your workload and server capacity. + +### 9.1: Resource Allocation + + + + +**Recommended specifications:** +- **CPU:** 2 cores +- **RAM:** 4GB +- **Disk:** 20GB +- **Concurrent operations:** 2-4 + +**Docker resource limits:** +```yaml +deploy: + resources: + limits: + memory: 4G + cpus: '2.0' + reservations: + memory: 2G + cpus: '1.0' +``` + +**Settings:** +```yaml +system: + maxFileSize: 500 # 500MB max file + connectionTimeoutMinutes: 5 + maxConcurrentOperations: 2 +``` + + + + +**Recommended specifications:** +- **CPU:** 4 cores +- **RAM:** 8GB +- **Disk:** 50GB +- **Concurrent operations:** 4-8 + +**Docker resource limits:** +```yaml +deploy: + resources: + limits: + memory: 8G + cpus: '4.0' + reservations: + memory: 4G + cpus: '2.0' +``` + +**Settings:** +```yaml +system: + maxFileSize: 1000 # 1GB max file + connectionTimeoutMinutes: 10 + maxConcurrentOperations: 4 +``` + +**Consider:** +- Split deployment (separate frontend/backend) +- Load balancer for multiple instances +- Database on separate server + + + + +**Recommended specifications:** +- **CPU:** 8+ cores +- **RAM:** 16GB+ +- **Disk:** 100GB+ (SSD recommended) +- **Concurrent operations:** 8+ + +**Docker resource limits:** +```yaml +deploy: + resources: + limits: + memory: 16G + cpus: '8.0' + reservations: + memory: 8G + cpus: '4.0' +``` + +**Settings:** +```yaml +system: + maxFileSize: 2000 # 2GB max file + connectionTimeoutMinutes: 15 + maxConcurrentOperations: 8 +``` + +**Architecture:** +- Split deployment (separate frontend/backend) +- Multiple backend instances for processing +- Load balancer with session affinity +- Dedicated database server +- Redis for session storage +- CDN for frontend assets + +:::tip Pro/Enterprise Recommended +For large organizations, **Pro or Enterprise editions** provide: +- Advanced load balancing +- High availability configuration +- Database clustering +- Performance monitoring +- Dedicated support + +[Learn more](#step-10-proenterprise-edition) +::: + + + + +### 9.2: Storage Management + +**Monitor disk usage:** +```bash +# Check Docker disk usage +docker system df + +# Check Stirling-PDF data usage +du -sh ./stirling-data/* +``` + +**Cleanup strategies:** + +```yaml +system: + # Automatic cleanup settings + tempFileCleanup: true + tempFileMaxAge: 24 # hours + + # Log rotation + logRetentionDays: 30 + maxLogSize: 100 # MB +``` + +**Manual cleanup:** +```bash +# Clean Docker system +docker system prune -a --volumes + +# Clean old logs +find ./stirling-data/logs -name "*.log" -mtime +30 -delete + +# Clean temporary files (if not auto-cleaned) +find ./stirling-data/temp -type f -mtime +1 -delete +``` + +--- + +## Step 10: Pro/Enterprise Edition + +Stirling-PDF offers **Pro and Enterprise editions** with additional features for organizations. + +### Key Pro/Enterprise Features + +**Authentication & Security:** +- **SAML2 SSO:** Enterprise-grade single sign-on (OAuth2 is free) +- Enhanced security features + +**Database & Infrastructure:** +- **External PostgreSQL Database:** Required for Pro/Enterprise deployments +- Better reliability and scalability than local H2 database +- Professional backup and replication strategies + +**Monitoring & Analytics:** +- **Prometheus Integration:** Advanced metrics and monitoring +- **Usage Dashboard:** Graphical usage statistics at `/usage` +- Enhanced monitoring APIs + +**For pricing and enterprise inquiries:** +- **Email:** support@stirlingtools.com +- **Website:** https://stirlingtools.com/pricing +- **Documentation:** [Pro/Enterprise Features](./Pro.md) +- **External Database Setup:** [External Database Guide](./Configuration/External%20Database.md) +- **Monitoring Setup:** [Usage Monitoring](./Configuration/Usage%20Monitoring.md) + +--- + +## Next Steps & Resources + +Congratulations! You've successfully deployed and configured Stirling-PDF for your organization. + +### Recommended Next Steps + +1. **📚 Train your users** + - Share the [Getting Started Guide](./Getting%20Started.md) + - Point them to [Tool Reference](./Functionality/Functionality.md) + - Create internal documentation for your specific workflows + +2. **🔧 Advanced configuration** + - [OCR Configuration](./Configuration/OCR.md) - Add more languages + - [Pipeline Automation](./Configuration/Pipeline.md) - Automate workflows + - [API Integration](./API.md) - Integrate with other systems + +3. **🔒 Harden security** + - [Fail2Ban Setup](./Configuration/Fail2Ban.md) - Prevent brute force + - [External Database](./Configuration/External%20Database.md) - Use PostgreSQL + - Review [System and Security](./Configuration/System%20and%20Security.md) settings + +4. **📊 Monitor and optimize** + - Set up regular backup verification + - Review logs weekly + - Monitor disk space and performance + - Plan for growth + +### Support & Community + +- **Documentation:** https://docs.stirlingpdf.com +- **GitHub:** https://github.com/Stirling-Tools/Stirling-PDF +- **Discord:** https://discord.gg/Cn8pWhQRxZ +- **Issue Tracker:** https://github.com/Stirling-Tools/Stirling-PDF/issues + +### Stay Updated + +- **Release Notes:** https://github.com/Stirling-Tools/Stirling-PDF/releases +- **Blog:** https://stirlingtools.com/blog +- **Newsletter:** Subscribe at https://stirlingtools.com + +--- + +## Troubleshooting Common Issues + +### Authentication Issues + +**Problem:** Can't log in as admin + +**Solutions:** +1. Check logs: `docker logs stirling-pdf | grep ERROR` +2. Verify `SECURITY_ENABLELOGIN=true` is set +3. Reset admin password via command line: + ```bash + docker exec -it stirling-pdf sh + # Use built-in password reset tool + ``` + +### Performance Issues + +**Problem:** Slow processing, timeouts + +**Solutions:** +1. Check resource limits: `docker stats stirling-pdf` +2. Increase memory: Update `deploy.resources.limits.memory` +3. Reduce concurrent operations: Lower `maxConcurrentOperations` +4. Check disk I/O: Use SSD for better performance + +### HTTPS/Certificate Issues + +**Problem:** Certificate errors, HTTPS not working + +**Solutions:** +1. Check Nginx/Traefik logs +2. Verify DNS points to correct IP +3. Ensure ports 80 and 443 are open +4. Test Let's Encrypt manually: `sudo certbot certificates` + +### File Upload Issues + +**Problem:** Can't upload large files + +**Solutions:** +1. Increase Nginx limit: `client_max_body_size 2000M;` +2. Increase Stirling-PDF limit: `system.maxFileSize: 2000` +3. Check disk space: `df -h` +4. Increase timeouts: `client_body_timeout 300s;` + +### Need More Help? + +**For Community Support:** +- Join Discord: https://discord.gg/Cn8pWhQRxZ +- Search GitHub Issues: https://github.com/Stirling-Tools/Stirling-PDF/issues + +**For Priority Support:** +- Upgrade to Pro/Enterprise +- Email: support@stirlingtools.com +- Get dedicated support team + +--- + +**You're all set!** 🎉 + +Your Stirling-PDF deployment is ready for production use. If you have any questions or need assistance, don't hesitate to reach out to our community or consider upgrading to Pro/Enterprise for dedicated support. + +Happy PDF processing! 📄✨ diff --git a/docusaurus.config.js b/docusaurus.config.js index c1c0032b..12531671 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -55,6 +55,18 @@ const config = { sidebarPath: require.resolve('./sidebars.js'), routeBasePath: '/', editUrl: 'https://github.com/Stirling-Tools/Stirling-Tools.github.io/tree/main/', + lastVersion: 'current', + versions: { + current: { + label: '2.0 (Current)', + banner: 'none', + badge: false, + }, + '1.5': { + label: '1.6.0', + banner: 'none', + }, + }, }, theme: { customCss: require.resolve('./src/css/custom.css'), @@ -125,6 +137,11 @@ const config = { position: 'left', label: 'Docs', }, + { + type: 'docsVersionDropdown', + position: 'right', + dropdownActiveClassDisabled: true, + }, { href: 'https://github.com/Stirling-Tools/Stirling-PDF', label: 'GitHub', diff --git a/versioned_docs/version-1.5/API.md b/versioned_docs/version-1.5/API.md new file mode 100644 index 00000000..77c9e4f7 --- /dev/null +++ b/versioned_docs/version-1.5/API.md @@ -0,0 +1,109 @@ +--- +sidebar_position: 7 +id: API +title: API +description: Overview of API offering in S-PDF +tags: + - API +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Stirling PDF API + +Stirling PDF exposes a simple API for easy integration with external scripts. You can access the API documentation in two ways: + +1. Local Swagger UI at `/swagger-ui/index.html` on your Stirling-PDF instance +2. Online [Swagger Documentation](https://app.swaggerhub.com/apis-docs/Frooodle/Stirling-PDF/) + +You can also access the documentation through the settings menu (gear icon in the top-right corner). + +## Accessing API Documentation + +### Local Swagger UI +Your Stirling-PDF instance includes built-in API documentation: +1. Navigate to `http://your-instance:port/swagger-ui/index.html` +2. Or append `/swagger-ui/index.html` to your Stirling-PDF URL +3. This provides an interactive documentation interface where you can: + - View all available endpoints + - Test API calls directly + - See request/response schemas + - View authentication requirements + +### Settings Menu Access +1. Click the gear icon (⚙️) in the top-right corner +2. Look for the "API Documentation" or "API" link +3. This will take you to the local Swagger UI + +## API Authentication + +When security is enabled, all API requests require authentication. There are two ways to handle API authentication: + +### User-Specific API Keys +1. Obtain your API key: + - Log into Stirling-PDF + - Go to Account Settings (via the gear icon) + - Find your API key in the account details + +### Global API Key +You can set a custom global API key using the environment variable: +```bash +SECURITY_CUSTOMGLOBALAPIKEY=your-custom-api-key +``` +This allows you to set a single API key that works regardless of user authentication. + +2. Include the API key in all requests: + ```http + X-API-KEY: your-api-key-here + ``` + +3. Example authenticated request: + ```bash + curl -X POST "http://localhost:8080/add-watermark" \ + -H "X-API-KEY: your-api-key-here" \ + -H "Content-Type: multipart/form-data" \ + ... + ``` + +## API Limitations + +Stirling-PDF's feature set is not entirely confined to the backend, hence not all functionalities are accessible via the API. Certain operations, such as the "view-pdf" or "visually sign", are executed exclusively on the front-end, and as such, they are only available through the Web-UI. If you encounter a situation where some API endpoints appear to be absent, it is likely attributable to these front-end exclusive features. + +Stirling-PDF also has statistic and health endpoints to integrate with monitoring/dashboard applications. + +## Example CURL Commands + + + + ```bash + curl -X POST "http://localhost:8080/add-watermark" \ + -H "Content-Type: multipart/form-data" \ + -F "fileInput=@/Users/username/Downloads/sample-1_cropped.pdf" \ + -F "watermarkType=text" \ + -F "watermarkText=YOUR_WATERMARK_TEXT" \ + -F "alphabet=roman" \ + -F "fontSize=30" \ + -F "rotation=0" \ + -F "opacity=0.5" \ + -F "widthSpacer=50" \ + -F "heightSpacer=50" \ + > "/Users/username/Downloads/output.pdf" + ``` + + + ```bash + curl -X POST "http://localhost:8080/add-watermark" ^ + -H "Content-Type: multipart/form-data" ^ + -F "fileInput=@C:\Users\systo\Downloads\sample-1_cropped.pdf" ^ + -F "watermarkType=text" ^ + -F "watermarkText=YOUR_WATERMARK_TEXT" ^ + -F "alphabet=roman" ^ + -F "fontSize=30" ^ + -F "rotation=0" ^ + -F "opacity=0.5" ^ + -F "widthSpacer=50" ^ + -F "heightSpacer=50" ^ + > "C:\Users\systo\Downloads\output.pdf" + ``` + + \ No newline at end of file diff --git a/versioned_docs/version-1.5/Advanced Configuration/DATABASE.md b/versioned_docs/version-1.5/Advanced Configuration/DATABASE.md new file mode 100644 index 00000000..4604ba81 --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/DATABASE.md @@ -0,0 +1,40 @@ +--- +sidebar_position: 10 +tags: [pro, enterprise, database, management] +--- + +# Database Backups +> **Tier**: Pro, Enterprise + +## Functionality Overview + +The newly introduced feature enhances the application with robust database backup and import capabilities. This feature is designed to ensure data integrity and provide a straightforward way to manage database backups. Here's how it works: + +1. Automatic Backup Creation + - The system automatically creates a database backup every day at midnight. This ensures that there is always a recent backup available, minimizing the risk of data loss. +2. Manual Backup Export + - Admin actions that modify the user database trigger a manual export of the database. This keeps the backup up-to-date with the latest changes and provides an extra layer of data security. +3. Importing Database Backups + - Admin users can import a database backup either via the web interface or API endpoints. This allows for easy restoration of the database to a previous state in case of data corruption or other issues. + - The import process ensures that the database structure and data are correctly restored, maintaining the integrity of the application. +4. Managing Backup Files + - Admins can view a list of all existing backup files, along with their creation dates and sizes. This helps in managing storage and identifying the most recent or relevant backups. + - Backup files can be downloaded for offline storage or transferred to other environments, providing flexibility in database management. + - Unnecessary backup files can be deleted through the interface to free up storage space and maintain an organized backup directory. + +## User Interface + +### Web Interface + +1. Upload SQL files to import database backups. +2. View details of existing backups, such as file names, creation dates, and sizes. +3. Download backup files for offline storage. +4. Delete outdated or unnecessary backup files. + +### API Endpoints + +1. Import database backups by uploading SQL files. +2. Download backup files. +3. Delete backup files. + +This new functionality streamlines database management, ensuring that backups are always available and easy to manage, thus improving the reliability and resilience of the application. diff --git a/docs/Advanced Configuration/Endpoint or Feature Customisation.md b/versioned_docs/version-1.5/Advanced Configuration/Endpoint or Feature Customisation.md similarity index 100% rename from docs/Advanced Configuration/Endpoint or Feature Customisation.md rename to versioned_docs/version-1.5/Advanced Configuration/Endpoint or Feature Customisation.md diff --git a/versioned_docs/version-1.5/Advanced Configuration/External Database.md b/versioned_docs/version-1.5/Advanced Configuration/External Database.md new file mode 100644 index 00000000..bc5ae639 --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/External Database.md @@ -0,0 +1,125 @@ +--- +sidebar_position: 9 +id: External Database +title: External Database +tags: [enterprise, database] +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + + +# Using an External Database +> **Tier**: Enterprise + +It is possible to use your own external database with Stirling PDF rather than the default H2 database if you wish. +PostgreSQL is currently the only supported variant, others will be added on request. + +### Setting Up External Database Configuration +You can configure the new `Datasource` property in your `settings.yml` to connect to your external database: + +> #### ⚠️ Note +> _To use the external database feature, you will need to have a valid enterprise license and set the environment variable `DISABLE_ADDITIONAL_FEATURES` to `false`._ + + + + +```yaml + datasource: + enableCustomDatabase: false + customDatabaseUrl: jdbc:postgresql://localhost:5432/postgres + username: postgres + password: postgres + type: postgresql + hostName: localhost + port: 5432 + name: postgres +``` + +- `enableCustomDatabase`: Set this property to `true` to enable use of the custom database **Note: An enterprise license to use this feature** +- `customDatabaseUrl`: Enter the database connection url for the database here. **Note: If you set the `customDatabaseUrl` you do not need to set the type, hostName, port and name, they will all be automatically derived from the url.** +- `username`: The username for the database +- `password`: The password for the database + +If you would like more fine-grained control of the database connection, you can also use the following properties: + +#### Fine-grained Database Configuration +- `type`: The database type. Available options are `h2` and `postgresql` +- `hostName`: The host name of the database connection url (e.g. 'localhost') +- `port`: The port number of the database connection url (e.g. 8080) +- `name`: The name of the custom database. This should match the name you have set for your database + + + + +```yaml +services: + db: + image: 'postgres:17.2-alpine' + container_name: db + ports: + - "5432:5432" + environment: + POSTGRES_DB: "stirling_pdf" + POSTGRES_USER: "admin" + POSTGRES_PASSWORD: "stirling" +``` + +- `container_name`: This is the name of your database container. This should match the name of the container under `services` as this is what Docker will use to refer to your database +- `ports`: Specify the port number for your database. The number on the left is the port number the container will access the database internally. The number on the right is the port number the Stirling PDF app will use to connect to the database externally. Ensure this matches the port number in the connection url for your database otherwise the app will not be able to access it. +- `POSTGRES_DB`: An environment variable for the database container. Specify the name of the custom database here +- `POSTGRES_USER`: An environment variable for the database container. Specify the username for the database +- `POSTGRES_PASSWORD`: An environment variable for the database container. Specify the password for the database + +You will also need to update the Docker configuration in your app in order to connect to the database: + +```yaml +services: + stirling-pdf: + depends_on: + - db + environment: + DISABLE_ADDITIONAL_FEATURES: "false" "true" + SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE: "true" + SYSTEM_DATASOURCE_CUSTOMDATABASEURL: "jdbc:postgresql://db:5432/stirling_pdf" + SYSTEM_DATASOURCE_USERNAME: "admin" + SYSTEM_DATASOURCE_PASSWORD: "stirling" + # further configuration +``` + +- `depends_on`: This specifies any services that your app will need in order to run. Ensure the name matches the container name for your database +- `DISABLE_ADDITIONAL_FEATURES`: Set this to `false` to enable security features +- `SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE`: An environment variable to connect to the database container. Set this to `true` to enable use of the external database +- `SYSTEM_DATASOURCE_CUSTOMDATABASEURL`: An environment variable to connect to the database container. Set the connection url for the database here. **Note: If you set this url you do not need to set the type, hostName, port and name (namely `SYSTEM_DATASOURCE_TYPE`, `SYSTEM_DATASOURCE_HOSTNAME`, `SYSTEM_DATASOURCE_PORT`, `SYSTEM_DATASOURCE_NAME`), they will all be automatically derived from the url.** +- `SYSTEM_DATASOURCE_USERNAME`: An environment variable to connect to the database container. Set the username for the database. Ensure this matches the corresponding property in your database container +- `SYSTEM_DATASOURCE_PASSWORD`: An environment variable to connect to the database container. Set the password for the database. Ensure this matches the corresponding property in your database container + +Below is an example of what your configuration should look like after configuring the custom database: + +```yaml +services: + stirling-pdf: + depends_on: + - db + environment: + DISABLE_ADDITIONAL_FEATURES: "false" "true" + SYSTEM_DATASOURCE_ENABLECUSTOMDATABASE: "true" + SYSTEM_DATASOURCE_CUSTOMDATABASEURL: "jdbc:postgresql://db:5432/stirling_pdf" + SYSTEM_DATASOURCE_USERNAME: "admin" + SYSTEM_DATASOURCE_PASSWORD: "stirling" + # further configuration + + db: + image: 'postgres:17.2-alpine' + container_name: db + ports: + - "5432:5432" + environment: + POSTGRES_DB: "stirling_pdf" + POSTGRES_USER: "admin" + POSTGRES_PASSWORD: "stirling" +``` + + + + +*Example configuration can be found in [exampleYmlFiles/docker-compose-latest-fat-security-postgres.yml](https://github.com/Stirling-Tools/Stirling-PDF/blob/428b4238e3a7280d71697d994a66174a250387a7/exampleYmlFiles/docker-compose-latest-fat-security-postgres.yml)* diff --git a/versioned_docs/version-1.5/Advanced Configuration/Extra-Settings.md b/versioned_docs/version-1.5/Advanced Configuration/Extra-Settings.md new file mode 100644 index 00000000..a64534c7 --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Extra-Settings.md @@ -0,0 +1,149 @@ +--- +sidebar_position: 12 +title: Custom Settings Configuration +--- + +# Custom Settings Configuration + +Stirling-PDF provides a `/configs/custom_settings.yml` file where users can configure additional settings beyond the standard configuration. This file follows standard YAML format and supports Spring Boot application properties, allowing you to customize the application without modifying core files. + +## Logging Configuration + +Control the verbosity of logs by adjusting log levels for different components: + +```yaml +logging: + level: + root: INFO + org.springframework: WARN + org.hibernate: WARN + org.eclipse.jetty: WARN + stirling.software.SPDF: INFO + # Enable debug logging for specific components when troubleshooting + # org.springframework.security.saml2: TRACE + # org.springframework.security: DEBUG + # org.opensaml: DEBUG +``` + +## Server Configuration + +Configure server behavior including port, address binding, and session timeout: + +```yaml +server: + port: 8080 # Default port + address: 0.0.0.0 # Bind to all interfaces + servlet: + context-path: / # Application context path + session: + timeout: 30m # Session timeout + jetty: + threads: + max: 200 # Maximum number of request processing threads + min: 10 # Minimum number of threads always kept running + connection-idle-timeout: 30000 # Connection idle timeout in milliseconds +``` + +## SSL/TLS Configuration + +Configure HTTPS for secure connections: + +```yaml +server: + port: 8443 # Standard HTTPS port + ssl: + enabled: true + key-store: classpath:keystore.p12 # Path to keystore file + key-store-password: your-keystore-password + key-store-type: PKCS12 # Type of keystore + key-alias: tomcat # Alias of the certificate +``` + +### Creating a Self-Signed Certificate + +To generate a self-signed certificate for development or testing: + +```shell +keytool -genkeypair -alias tomcat -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore keystore.p12 -validity 365 +``` + +> #### ⚠️ Note +> _For production use, it's recommended to use a certificate from a trusted Certificate Authority._ + +## Configuration Examples + +### Basic Configuration + +A simple configuration that changes the port and adjusts logging levels: + +```yaml +# custom_settings.yml +server: + port: 9000 + +logging: + level: + root: INFO + org.springframework: WARN + org.hibernate: WARN + stirling.software.SPDF: INFO +``` + +### HTTPS Configuration + +Enable HTTPS with a custom certificate: + +```yaml +# custom_settings.yml +server: + port: 8443 + ssl: + enabled: true + key-store: classpath:keystore.p12 + key-store-password: your-keystore-password + key-store-type: PKCS12 + key-alias: tomcat + +logging: + level: + root: INFO + org.springframework: WARN +``` + +## Troubleshooting Common Issues + +### Authentication Issues + +Increase security logging to diagnose authentication problems: + +```yaml +logging: + level: + org.springframework.security: DEBUG + stirling.software.SPDF.config.security: DEBUG +``` + +### SAML/OAuth Issues + +Increase SAML-related logging for SSO troubleshooting: + +```yaml +logging: + level: + org.springframework.security.saml2: TRACE + org.springframework.security.oauth2: DEBUG + org.opensaml: DEBUG +``` + +### General Application Issues + +For general application issues: + +```yaml +logging: + level: + stirling.software.SPDF: DEBUG +``` + +> #### ⚠️ Note +> _Debug-level logging can significantly increase log volume and may impact performance in production environments. Return logging to normal levels after troubleshooting._ \ No newline at end of file diff --git a/versioned_docs/version-1.5/Advanced Configuration/Fail2Ban.md b/versioned_docs/version-1.5/Advanced Configuration/Fail2Ban.md new file mode 100644 index 00000000..6be2c12c --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Fail2Ban.md @@ -0,0 +1,84 @@ +--- +sidebar_position: 8 +id: fail2ban +title: Fail2Ban Integration +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Fail2Ban Setup for Stirling-PDF +This document provides instructions on how to set up Fail2Ban with Stirling-PDF to protect against unauthorized login attempts. (Note Stirling-PDF blocks IPs after a set retry count regardless of Fail2Ban, This configuration is only useful for users specifically wanting Fail2Ban configuration) + +## How does Fail2Ban Work with Stirling-PDF +Stirling-PDF logs failed authentication attempts to a log file which Fail2Ban monitors. When it detects multiple failed login attempts from the same IP address, Fail2Ban automatically blocks that IP address for a configured period of time. + + +## Prerequisites +- Fail2Ban installed on your system +- Access to Stirling-PDF log directory +- Security settings configured in `/configs/settings.yml`: + ```yaml + security: + enableLogin: true # Login must be enabled for Fail2Ban integration + loginAttemptCount: -1 # Set to -1 when using Fail2Ban recommended but not required + ``` + +### Important Configuration Notes +- The `enableLogin` setting must be set to `true` as Fail2Ban integration requires authentication to be active +- When using Fail2Ban, set `loginAttemptCount` to `-1` to disable the built-in account locking mechanism and let Fail2Ban handle login attempt management +- For more details on security configuration options, refer to the [System and Security](./System%20and%20Security) documentation + +## Configuration + +### Log File Location +The log file location containing the failed authentication messages depends on your installation type: + +- **Default/Docker Installation**: ``./logs/invalid-auths.log`` +- **Windows Desktop**: ``%APPDATA%\Stirling-PDF\logs\invalid-auths.log`` +- **MacOS Desktop**: ``~/Library/Application Support/Stirling-PDF/logs/invalid-auths.log`` +- **Linux Desktop**: ``~/.config/Stirling-PDF/logs/invalid-auths.log`` + +### Example Fail2Ban Filter +`/etc/fail2ban/filter.d/stirling-pdf.conf` +```ini +[Definition] +failregex = Failed login attempt from IP: +``` + +### Example Jail Configuration +`/etc/fail2ban/jail.local` +```ini +[stirling-pdf] +enabled = true +filter = stirling-pdf +logpath = /logs/invalid-auths.log +maxretry = 5 +findtime = 300 +bantime = 3600 +``` + +Configuration parameters: +- `maxretry`: Number of failed attempts before ban (default: 5) +- `findtime`: Time window for failed attempts in seconds (default: 300 seconds / 5 minutes) +- `bantime`: Duration of the ban in seconds (default: 3600 seconds / 1 hour) + + +### Ensure access to Logs path + + + Modify your `docker-compose.yml` to expose the log directory: + ```yaml + services: + stirling-pdf: + volumes: + - ./logs:/logs + ``` + + + Add the volume mount to your Docker run command: + ```bash + -v ./logs:/logs + ``` + + diff --git a/versioned_docs/version-1.5/Advanced Configuration/FolderScanning.md b/versioned_docs/version-1.5/Advanced Configuration/FolderScanning.md new file mode 100644 index 00000000..5a58321d --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/FolderScanning.md @@ -0,0 +1,48 @@ +--- +sidebar_position: 7 +id: Folder Scanning +title: Folder Scanning +--- + +## User Guide for Local Directory Scanning and File Processing + +Folder scanning uses settings configured from our pipeline tool, it is advised you first read the [Pipeline Guide](./Pipeline) +### Setting Up Watched Folders + +- Create a folder where you want your files to be monitored. This is your 'watched folder'. +- The default directory for this is `./pipeline/watchedFolders/`. +- Place any directories you want to be scanned into this folder. This folder should contain multiple folders, each for their own tasks and pipelines. + +### Configuring Processing with JSON Files + +- In each directory you want processed (e.g., `./pipeline/watchedFolders/officePrinter`), include a JSON configuration file. +- This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them). This can be made, configured, and downloaded from the Stirling-PDF Pipeline interface. For JSON creation guide please see [Pipeline setup](./Pipeline) + +### Automatic Scanning and Processing + +- The system automatically checks the watched folder every minute for new directories and files to process. +- When a directory with a valid JSON configuration file is found, it begins processing the files inside according to the configuration. + +### Processing Steps + +- Files in each directory are processed according to the instructions in the JSON file. +- This might involve file conversions, data filtering, renaming files, etc. If the output of a step is a zip, this zip will be automatically unzipped as it passes to the next process. + +### Results and Output + +- After processing, the results are saved in a specified output location. This could be a different folder or location as defined in the JSON file or the default location `./pipeline/finishedFolders/`. +- Each processed file is named and organized according to the rules set in the JSON configuration. + +### Completion and Cleanup + +- Once processing is complete, the original files in the watched folder's directory are removed. +- You can find the processed files in the designated output location. + +### Error Handling + +- If there's an error during processing, the system will not delete the original files, allowing you to check and retry if necessary. + +### User Interaction + +- As a user, your main tasks are to set up the watched folders, place directories with files for processing, and create the corresponding JSON configuration files. +- The system handles the rest, including scanning, processing, and outputting results. diff --git a/versioned_docs/version-1.5/Advanced Configuration/Google Drive File Picker.md b/versioned_docs/version-1.5/Advanced Configuration/Google Drive File Picker.md new file mode 100644 index 00000000..823efd2d --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Google Drive File Picker.md @@ -0,0 +1,85 @@ +--- +sidebar_position: 5 +tags: [pro, enterprise, management, feature, advanced feature] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Google Drive File Picker +> **Tier**: Pro, Enterprise + +Stirling-PDF allows users to select Files for processing through tools via google drive. + +## Google Api Access +To enable this features for your users, you must first set up your Google environment. This includes creating a Google Cloud project. Follow the **Setting up your environment** section of [this guide](https://developers.google.com/workspace/drive/picker/guides/overview#setup) to do so. + +## Stirling PDF configuration + +```yaml +premium: + ... + enabled: true # Enable license key checks for pro/enterprise features + proFeatures: + ... + googleDrive: + enabled: true + clientId: + apiKey: + appId: +``` +- `premium.enabled`: Set to `true` to enable premium features. +- `googleDrive.enabled`: Set to `true` to enable google drive file picker features. +- `googleDrive.clientId`: Your Google web app's client ID. [Go to Credentials](https://console.cloud.google.com/apis/credentials) and Click **Create credentials > OAuth client ID**. +- `googleDrive.apiKey`: API key for google api access. [Go to Credentials](https://console.cloud.google.com/apis/credentials) and Click **Create credentials > API key**. +- `googleDrive.appId`: Google drive app ID also known as your Project Number Found in your [IAM&Admin Project Settings](https://console.cloud.google.com/iam-admin/settings) + + + > #### ⚠️ Note +> _You must set the Authroized Javascript origins for your OAuth client ID to include your Stirling PDF host domain or IP address._ + +## Configurations Examples +Below are examples of the full configuration for enabling the google Drive Picker: + + + + ```yaml + premium: + enabled: true # Enable license key checks for pro/enterprise features + proFeatures: + googleDrive: + enabled: true + clientId: + apiKey: + appId: + ``` + + + ```bash + export PREMIUM_ENABLED=true + export PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_ENABLED=true + export PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_CLIENT_ID="" + export PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_API_KEY="" + export PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_APP_ID="" + ``` + + + ```bash + -e PREMIUM_ENABLED=true \ + -e PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_ENABLED=true \ + -e PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_CLIENT_ID="" \ + -e PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_API_KEY="" \ + -e PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_APP_ID="" \ + ``` + + + ```yaml + environment: + PREMIUM_ENABLED: true + PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_ENABLED: true + PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_CLIENT_ID: + PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_API_KEY: + PREMIUM_PRO_FEATURES_GOOGLE_DRIVE_APP_ID: + ``` + + \ No newline at end of file diff --git a/docs/Advanced Configuration/How to add configurations.md b/versioned_docs/version-1.5/Advanced Configuration/How to add configurations.md similarity index 100% rename from docs/Advanced Configuration/How to add configurations.md rename to versioned_docs/version-1.5/Advanced Configuration/How to add configurations.md diff --git a/versioned_docs/version-1.5/Advanced Configuration/OCR.md b/versioned_docs/version-1.5/Advanced Configuration/OCR.md new file mode 100644 index 00000000..ec4f6d2c --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/OCR.md @@ -0,0 +1,109 @@ +--- +sidebar_position: 7 +id: OCR +title: OCR (Optical Character Recognition) +--- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# OCR Language Packs and Setup +This document provides instructions on how to add additional language packs for the OCR tab in Stirling-PDF, both inside and outside of Docker. + +## How does the OCR Work +Stirling-PDF uses Tesseract for its text recognition. All credit goes to them for this awesome work! + +## Language Packs + +Tesseract OCR supports a variety of languages. You can find additional language packs in the Tesseract GitHub repositories: + +- [tessdata_fast](https://github.com/tesseract-ocr/tessdata_fast): These language packs are smaller and faster to load but may provide lower recognition accuracy. +- [tessdata](https://github.com/tesseract-ocr/tessdata): These language packs are larger and provide better recognition accuracy, but may take longer to load. + +Depending on your requirements, you can choose the appropriate language pack for your use case. By default, Stirling-PDF uses `tessdata_fast` for English, but this can be replaced. + +### Installing Language Packs manually + +1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. +2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` (or equivalent) + +**DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED.** + +### Docker Setup + +If you are using Docker, you need to expose the Tesseract tessdata directory as a volume in order to use the additional language packs. + + + + Modify your `docker-compose.yml` file to include the following volume configuration: + + ```yaml + services: + your_service_name: + image: your_docker_image_name + volumes: + - /location/of/trainingData:/usr/share/tessdata + ``` + + + Add the following to your existing Docker run command: + + ```bash + -v /location/of/trainingData:/usr/share/tessdata + ``` + + + +### Non-Docker Setup + + + + For Debian-based systems, use the following commands to manage Tesseract languages: + + ```bash + sudo apt update &&\ + # All languages + # sudo apt install -y 'tesseract-ocr-*' + + # Find available languages: + apt search tesseract-ocr- + + # View installed languages: + dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g' + ``` + + + For Fedora systems, use the following commands: + + ```bash + # All languages + # sudo dnf install -y tesseract-langpack-* + + # Find available languages: + dnf search -C tesseract-langpack- + + # View installed languages: + rpm -qa | grep tesseract-langpack | sed 's/tesseract-langpack-//g' + ``` + + + Follow these steps to set up Tesseract languages on Windows: + + 1. Download desired `.traineddata` files from [tessdata](https://github.com/tesseract-ocr/tessdata) or [tessdata_fast](https://github.com/tesseract-ocr/tessdata_fast) + + 2. Place them in the tessdata folder within your Tesseract installation directory: + ``` + C:\Program Files\Tesseract-OCR\tessdata + ``` + + 3. Verify the installation by running: + ```powershell + tesseract --list-langs + ``` + + 4. Edit your `/configs/settings.yml` and update the `system.tessdataDir`: + ```yaml + system: + tessdataDir: C:/Program Files/Tesseract-OCR/tessdata # path to Tessdata files + ``` + + \ No newline at end of file diff --git a/versioned_docs/version-1.5/Advanced Configuration/Other Customisations.md b/versioned_docs/version-1.5/Advanced Configuration/Other Customisations.md new file mode 100644 index 00000000..c2556f9d --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Other Customisations.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 13 +--- +# Other Customisations + +Stirling PDF offers various other customisation options, such as: + +### Defaulting Language +Default language selection via the `SYSTEM_DEFAULTLOCALE` environment variable. Accepted values include `de-DE`, `fr-FR`, `ar-AR` and all other languages codes that are within Stirling-PDFs current list. + +### Google Search Visibility (robots.txt) +Enable or disable search engine visibility with the `ALLOW_GOOGLE_VISIBILITY` variable. + +### Custom Root path +Redirect the root path of the application using `APP_ROOT_PATH`. +This is for changing websites like stirlingtools.com to instead host the interface at stirlingtools.com/`APP_ROOT_PATH` like stirlingtools.com/demo + +### Enable/Disable Analytics +Analytics can be enabled/disabled with ``SYSTEM_ENABLEANALYTICS`` or +```yaml +system: + enableAnalytics: 'true' +``` +In configs/Settings.yml diff --git a/docs/Advanced Configuration/Pipeline.md b/versioned_docs/version-1.5/Advanced Configuration/Pipeline.md similarity index 84% rename from docs/Advanced Configuration/Pipeline.md rename to versioned_docs/version-1.5/Advanced Configuration/Pipeline.md index cc3206e4..cb2bbc46 100644 --- a/docs/Advanced Configuration/Pipeline.md +++ b/versioned_docs/version-1.5/Advanced Configuration/Pipeline.md @@ -34,7 +34,7 @@ title: Pipeline Automation - Use the **Validation** button to check your pipeline. A green indicator signifies correct setup; a pop-out error indicates issues. 8. **Download Pipeline Configuration** - - To use the configuration for [folder scanning](/Advanced%20Configuration/Folder%20Scanning) (or save it for future use and re-upload it), download a JSON file in this menu. You can also pre-load it for future use by placing it in `/pipeline/defaultWebUIConfigs/`. It will then appear in the dropdown menu for all users to use. + - To use the configuration for [folder scanning](./Folder%20Scanning) (or save it for future use and re-upload it), download a JSON file in this menu. You can also pre-load it for future use by placing it in `/pipeline/defaultWebUIConfigs/`. It will then appear in the dropdown menu for all users to use. 9. **Submit Files for Processing** - If your pipeline is correctly set up, close the configure menu, input the files, and hit **Submit**. diff --git a/versioned_docs/version-1.5/Advanced Configuration/Sign with custom files.md b/versioned_docs/version-1.5/Advanced Configuration/Sign with custom files.md new file mode 100644 index 00000000..e7abbfa2 --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Sign with custom files.md @@ -0,0 +1,95 @@ +--- +sidebar_position: 12 +--- + +# Visual Sign with Custom File Storage + +Stirling PDF provides functionality to store and reuse files across sessions, particularly useful for features like signatures and commonly used assets. This guide explains how to set up and use custom file storage. + +## Overview + +The custom file storage system allows you to: +- Store files persistently across sessions +- Share files between all users or restrict them to specific users +- Access stored files through the web UI +- Organize files in a structured way + +## Storage Location + +All custom files should be stored in the `/customFiles/` directory. For features like signatures, the specific path is: + +``` +/customFiles/signatures/ +``` + +## Access Levels + +The system supports two types of access levels for stored files: + +### 1. All Users Access +Files that should be accessible to all users should be placed in: +``` +/customFiles/signatures/ALL_USERS/ +``` +This is useful for: +- Organization-wide templates +- Shared assets +- Default signatures or watermarks +- Environments where authentication isn't used + +### 2. User-Specific Access +Files that should only be accessible to specific users should be placed in user-specific directories: +``` +/customFiles/signatures/{username}/ +``` +For example: +``` +/customFiles/signatures/john_doe/ +``` +These files will only be accessible to the specified user when logged in. + +## Usage in Docker + +When using Docker, make sure to mount the customFiles directory as a volume to persist the files: + +```yaml +volumes: + - ./customFiles:/customFiles/ +``` + +## Best Practices + +1. File Organization: + - Keep files organized in appropriate subdirectories + - Use clear, descriptive filenames + - Consider using date-based or category-based organization for large numbers of files + +2. Security: + - Only place files in ALL_USERS if they truly need to be accessible to everyone + - Regularly review and clean up unused files + - Monitor storage usage to prevent excessive accumulation of files + +3. Supported File Types: + - For signatures: common image formats (PNG, JPG, SVG) + - Ensure files are of appropriate size and format for their intended use + +## Example Structure + +Here's an example of how your custom files directory might look: + +``` +/customFiles/ +├── signatures/ +│ ├── ALL_USERS/ +│ │ ├── company-logo.png +│ │ └── default-signature.png +│ ├── john_doe/ +│ │ ├── personal-signature.png +│ │ └── department-stamp.png +│ └── jane_smith/ +│ └── signature-2024.png +``` + +## Accessing Files + +Files stored in these locations will automatically be available in the relevant features of the Stirling PDF web interface. For example, saved signatures will appear in the signature selection interface when using the Sign feature. \ No newline at end of file diff --git a/versioned_docs/version-1.5/Advanced Configuration/Single Sign-On Configuration.md b/versioned_docs/version-1.5/Advanced Configuration/Single Sign-On Configuration.md new file mode 100644 index 00000000..11a5361a --- /dev/null +++ b/versioned_docs/version-1.5/Advanced Configuration/Single Sign-On Configuration.md @@ -0,0 +1,331 @@ +--- +sidebar_position: 3 +tags: [pro, enterprise, management, feature, advanced feature] +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Single Sign-On (SSO) Configuration +> **Tier**: Pro, Enterprise + +Stirling-PDF allows login via Single Sign-On (SSO) using OAuth 2 OpenID Connect (OIDC) and SAML 2. This allows you to log in to the +app using an account you may have with another Provider such as Google or GitHub. + +## OAuth 2 Set Up +To enable OAuth 2 in Stirling-PDF there are a number of properties you must set. Begin by setting `security.enableLogin` +to `true` and `security.loginMethod` to `oauth2` in your `/configs/settings.yml`. + +```yaml +security: + enableLogin: true + ... + loginMethod: all | normal | oauth2 | saml2 +``` + +- `enableLogin`: Set to `true` to enable login +- `loginMethod`: Defines the type of login method that will be used on application start up. The available options are: + - `all`: Enables all login methods (username/password, OAuth 2, SAML 2). Can be used alternatively to `oauth2` + - `normal`: Enables the username/password login method + - `oauth2`: Enables the OAuth 2 login method. Use this if you only want to log in via OAuth 2 + - `saml2`: Enables the SAML 2 login method + +Next, you will need to configure the OAuth 2 properties for your chosen Provider. Start by setting +`security.oauth2.enabled` to `true`. Stirling-PDF supports multiple Providers, in particular +[Google](https://console.cloud.google.com/), [GitHub](https://github.com/settings/developers) and [Keycloak](https://www.keycloak.org/). +You also have the option to use a different Provider apart from the aforementioned if you wish. + +> #### ⚠️ Note +> _The `enableLogin` property must be set to `true` for SSO to work._ + + + + ```yaml + oauth2: + enabled: true + client: + google: + clientId: + clientSecret: + scopes: email, profile + useAsUsername: email | name | given_name | family_name + provider: google + ``` + + + ```yaml + oauth2: + enabled: true + client: + github: + clientId: + clientSecret: + scopes: read:user + useAsUsername: email | login | name + provider: github + ``` + + + ```yaml + oauth2: + enabled: true + client: + keycloak: + issuer: + clientId: + clientSecret: + scopes: openid, profile, email + useAsUsername: email | preferred_name + provider: keycloak + ``` + + + _Using Authentik for example:_ + ```yaml + oauth2: + enabled: true + issuer: + clientId: + clientSecret: + autoCreateUser: true + blockRegistration: false + useAsUsername: email | name | given_name | nickname | preferred_name + scopes: openid, profile, email + provider: authentik + ``` + + + +- `security.oauth2.enabled` Set this to `true` to enable login +- `security.oauth2.issuer` The URL for the Provider's OpenID Configuration. Set this to any Provider that supports an OpenID Connect Discovery `/.well-known/openid-configuration` endpoint +- `security.oauth2.clientId` Client ID from your Provider +- `security.oauth2.clientSecret` Client Secret from your Provider +- `security.oauth2.autoCreateUser` Set this to `true` to allow auto-creation of non-existing users +- `security.oauth2.blockRegistration`: Set to `true` to deny login with SSO without prior registration by an admin +- `security.oauth2.useAsUsername`: The value from the Provider to use as the username for the application. Check with your +Provider for specific options. The default is `email` +- `security.oauth2.scopes`: Specifies the list of scopes for which the application will request permissions. The available scopes +for Google and GitHub can be found [here](https://developers.google.com/identity/protocols/oauth2/scopes#oauth2) and + [here](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps#available-scopes) +- `security.oauth2.provider`: The name of the Provider + +The Callback URL (Redirect URL) for entering in your IdP is: `https:///login/oauth2/code/` eg `https:///login/oauth2/code/keycloak`. +It is highly recommended to use an SSL-enabled reverse-proxy, if the application is going to be exposed to the internet. + +After the OAuth 2 login is enabled, a new button will show up on the login page as per the screenshot below. Clicking the +'Login via Single Sign-On' button will present you with the login for your Provider of choice. Once you have clicked the button, +you will be redirected to your Provider in order to login and authorise Stirling-PDF to use your profile: + +| ![login-page.png](/img/login-page.png) | ![sso-login-option.png](/img/sso-login-option.png) | +|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------| + +## SAML 2 Set Up + +> #### ⚠️ Note +> _SAML 2 is an enterprise-only feature. To use it you must have `premium.enabled` set to `true` and have a valid license key._ + +Begin by setting `security.enableLogin` to `true` and `security.loginMethod` to `saml2` in your `/configs/settings.yml`. + +```yaml +saml2: + enabled: true + provider: + autoCreateUser: true + blockRegistration: false + registrationId: + idpMetadataUri: + idpSingleLoginUrl: + idpSingleLogoutUrl: + idpIssuer: + idpCert: classpath: + privateKey: classpath: + spCert: classpath: +``` + +- `security.saml2.enabled`: Set to `true` to activate SAML 2 SSO # Only enabled for paid enterprise clients (enterpriseEdition.enabled must be true) +- `security.saml2.autoCreateUser`: Set this to `true` to allow auto-creation of non-existing users +- `security.saml2.blockRegistration`: Set to `true` to deny login with SSO without prior registration by an admin +- `security.saml2.registrationId`: The registration ID for your Provider. Should match the name in the path for your +Assertion Consumer Service (ACS) URL The default is `stirling` +- `security.saml2.idpMetadataUri`: The location of the metadata file from your Provider. Can be a file or URI +- `security.saml2.idpSingleLoginUrl`: The URL given by your Provider to initiate the SSO flow +- `security.saml2.idpSingleLogoutUrl`: The URL given by your Provider to initiate the SLO flow +- `security.saml2.idpIssuer`: The name of your Provider +- `security.saml2.idpCert`: The signing certificate given by your Provider in `.pem` format. Place in `stirling-pdf/src/main/resources` +- `security.saml2.privateKey`: Your private key from your keypair in `.key` format. Place in `stirling-pdf/src/main/resources` +- `security.saml2.spCert`: classpath:certificate.crt from your keypair in `.crt` format. Place in `stirling-pdf/src/main/resources` + +### Generating a Keypair + +To generate a keypair for the app to use for signing and verification, enter this command in your terminal: +```shell +openssl req -newkey rsa:2048 -nodes -keyout private_key.key -x509 -days 365 -out certificate.crt +``` + +- `openssl req`: This starts the OpenSSL command to create or manage a certificate signing request (CSR) or certificate +- `newkey rsa:2048`: This generates a new key pair using the RSA algorithm with a key size of 2048 bits. RSA 2048 is a +common and secure key size +- `nodes`: Skips encrypting the private key (no passphrase). If omitted, you would be prompted to set a password for +the key, which would be required whenever using it. With -nodes, the private key is generated in plain text for easier use in automated systems +- `keyout private_key.key`: Specifies the file name where the private key will be saved +- `x509`: This tells OpenSSL to create a self-signed certificate instead of generating a certificate signing request (CSR) +A self-signed certificate is not verified by a Certificate Authority (CA), which is why browsers may display a security warning when using it +- `days 365`: Specifies the certificate's validity period (in days). In this case, the certificate is valid for 365 days +- `out certificate.crt`: Specifies the output file where the self-signed certificate will be saved + +After generating the keypair, the `.key` and `.crt` files should be located in the directory you executed the above command in. +Move the files to `stirling-pdf/src/main/resources`. + +Once you have added your configuration, you should see the button for your chosen Provider on the login page prompting you to log in: + +| ![sso-login-dark-mode.png](/img/sso-login-dark-mode.png) | ![sso-saml-login.png](/img/sso-saml-login.png) | +|----------------------------------------------------------------------|------------------------------------------------------------| + +### Auto-login +> #### ⚠️ Note +> _Auto Login is an enterprise-only feature. To use it you must have `premium.enabled` set to `true` and have a valid license key._ + +It is also possible to automatically log in to Stirling PDF on start-up using SSO. To enable this feature, set the +property `premium.proFeatures.SSOAutoLogin` to `true`. +This will redirect to your SSO's URL when any user navigates to Stirling-PDF's default login screen. If a login fails 3 times this redirection is disabled + +## Configurations Examples +Below are examples of the full configuration for both OAuth 2 and SAML 2: + + + + ```yaml + security: + enableLogin: true # set to 'true' to enable login + oauth2: + issuer: + clientId: + clientSecret: + autoCreateUser: true + blockRegistration: false + useAsUsername: email + scopes: openid, profile, email + provider: + saml2: + enabled: true + autoCreateUser: true + blockRegistration: false + registrationId: + idpMetadataUri: + idpSingleLoginUrl: + idpSingleLogoutUrl: + idpIssuer: + idpCert: classpath: + privateKey: classpath: + spCert: classpath: + ``` + + + ```bash + export DISABLE_ADDITIONAL_FEATURES=false + export SECURITY_ENABLELOGIN=true + export SECURITY_OAUTH2_ENABLED=true + export SECURITY_OAUTH2_AUTOCREATEUSER=false + export SECURITY_OAUTH2_ISSUER="" + export SECURITY_OAUTH2_CLIENTID="" + export SECURITY_OAUTH2_CLIENTSECRET="" + export SECURITY_OAUTH2_BLOCKREGISTRATION=false + export SECURITY_OAUTH2_SCOPES="openid, profile, email" + export SECURITY_OAUTH2_USEASUSERNAME=email + export SECURITY_OAUTH2_PROVIDER="" + + export SECURITY_SAML2_ENABLED=true + export SECURITY_SAML2_AUTOCREATEUSER=false + export SECURITY_SAML2_REGISTRATIONID="" + export SECURITY_SAML2_BLOCKREGISTRATION=false + export SECURITY_SAML2_IDPISSUER="" + export SECURITY_SAML2_IDPMETADATAURI=true + export SECURITY_SAML2_IDPSINGLELOGINURL="" + export SECURITY_SAML2_IDPSINGLELOGOUTURL="" + export SECURITY_SAML2_IDPCERT="" + export SECURITY_SAML2_PRIVATEKEY="" + export SECURITY_SAML2_SPCERT="" + ``` + + + ```bash + -e DISABLE_ADDITIONAL_FEATURES=false \ + -e SECURITY_ENABLELOGIN=true \ + -e SECURITY_OAUTH2_ENABLED=true \ + -e SECURITY_OAUTH2_AUTOCREATEUSER=false \ + -e SECURITY_OAUTH2_ISSUER="" \ + -e SECURITY_OAUTH2_CLIENTID="" \ + -e SECURITY_OAUTH2_CLIENTSECRET="" \ + -e SECURITY_OAUTH2_BLOCKREGISTRATION=false \ + -e SECURITY_OAUTH2_SCOPES="openid, profile, email" \ + -e SECURITY_OAUTH2_USEASUSERNAME=email \ + -e SECURITY_OAUTH2_PROVIDER="" \ + -e SECURITY_SAML2_ENABLED=true \ + -e SECURITY_SAML2_AUTOCREATEUSER=false \ + -e SECURITY_SAML2_BLOCKREGISTRATION=false \ + -e SECURITY_SAML2_REGISTRATIONID="" \ + -e SECURITY_SAML2_IDPISSUER="" \ + -e SECURITY_SAML2_IDPMETADATAURI="" \ + -e SECURITY_SAML2_IDPSINGLELOGINURL="" \ + -e SECURITY_SAML2_IDPSINGLELOGOUTURL="" \ + -e SECURITY_SAML2_IDPCERT="" \ + -e SECURITY_SAML2_PRIVATEKEY="" \ + -e SECURITY_SAML2_SPCERT="" \ + ``` + + + ```yaml + environment: + DISABLE_ADDITIONAL_FEATURES=false + SECURITY_ENABLELOGIN=true + SECURITY_OAUTH2_ENABLED=true + SECURITY_OAUTH2_AUTOCREATEUSER=false + SECURITY_OAUTH2_ISSUER="" + SECURITY_OAUTH2_CLIENTID="" + SECURITY_OAUTH2_CLIENTSECRET="" + SECURITY_OAUTH2_BLOCKREGISTRATION=false + SECURITY_OAUTH2_SCOPES="openid, profile, email" + SECURITY_OAUTH2_USEASUSERNAME=email + SECURITY_OAUTH2_PROVIDER="" + + SECURITY_SAML2_ENABLED=true + SECURITY_SAML2_AUTOCREATEUSER=false + SECURITY_SAML2_REGISTRATIONID= + SECURITY_SAML2_BLOCKREGISTRATION=false + SECURITY_SAML2_IDPISSUER="" + SECURITY_SAML2_IDPMETADATAURI=true + SECURITY_SAML2_IDPSINGLELOGINURL="" + SECURITY_SAML2_IDPSINGLELOGOUTURLSECURITY_SAML2_IDPSINGLELOGOUTURL="" + SECURITY_SAML2_IDPCERT="" + SECURITY_SAML2_PRIVATEKEY="" + SECURITY_SAML2_SPCERT="" + ``` + + + +# Disable Form Login + +Once you successfully enabled Single Sign-on (with OAuth2 or SAML), you might want to disable the form login. +This can be done by changing the ``loginMethod`` setting accordingly to your needs, like so: + + + + ```yaml + security: + ... + loginMethod: oauth2 # Accepts values like 'all' and 'normal'(only Login with Username/Password), 'oauth2'(only + ``` + + + ```bash + -e SECURITY_LOGINMETHOD="oauth2" # to enable oauth2 only + ``` + + + ```yaml + environment: + ... + SECURITY_LOGINMETHOD: "oauth2" # to enable oauth2 only + ``` + + diff --git a/docs/Advanced Configuration/System and Security.md b/versioned_docs/version-1.5/Advanced Configuration/System and Security.md similarity index 100% rename from docs/Advanced Configuration/System and Security.md rename to versioned_docs/version-1.5/Advanced Configuration/System and Security.md diff --git a/docs/Advanced Configuration/UI Customisation.md b/versioned_docs/version-1.5/Advanced Configuration/UI Customisation.md similarity index 100% rename from docs/Advanced Configuration/UI Customisation.md rename to versioned_docs/version-1.5/Advanced Configuration/UI Customisation.md diff --git a/docs/Advanced Configuration/Usage Monitoring.md b/versioned_docs/version-1.5/Advanced Configuration/Usage Monitoring.md similarity index 100% rename from docs/Advanced Configuration/Usage Monitoring.md rename to versioned_docs/version-1.5/Advanced Configuration/Usage Monitoring.md diff --git a/docs/Advanced Configuration/_category_.json b/versioned_docs/version-1.5/Advanced Configuration/_category_.json similarity index 100% rename from docs/Advanced Configuration/_category_.json rename to versioned_docs/version-1.5/Advanced Configuration/_category_.json diff --git a/versioned_docs/version-1.5/Analytics-and-telemetry.md b/versioned_docs/version-1.5/Analytics-and-telemetry.md new file mode 100644 index 00000000..758fcd5f --- /dev/null +++ b/versioned_docs/version-1.5/Analytics-and-telemetry.md @@ -0,0 +1,265 @@ +--- +sidebar_position: 9 +title: Analytics and Telemetry +id: analytics-telemetry +--- + +# Analytics and Telemetry + +> Please note all the following applies to version 1.5.0 onward due to be released 15th October + + +Stirling‑PDF uses analytics to understand usage patterns and improve the application. This page explains what data is collected, why we collect it, and how to disable analytics if desired. + +> **User control**: All analytics are **opt‑in via a consent banner** (Disabled unless user allows) unless a self‑hosted administrator disables analytics system‑wide. If analytics are disabled system‑wide, no banner is shown. + +## Overview + +Stirling‑PDF uses two analytics services: + +1. **[Scarf](https://scarf.sh)** — a privacy‑friendly tool designed for open‑source projects. +2. **[PostHog](https://posthog.com)** — an open‑source product analytics platform for detailed usage insights. + +Both services are designed with privacy in mind and can be completely disabled. + +--- + +## PostHog Analytics + +### What is PostHog? + +PostHog is an open‑source product analytics platform that provides detailed insights into how users interact with Stirling‑PDF. It's hosted on PostHog's European servers (`eu.i.posthog.com`) for GDPR alignment. + +### Data collected by PostHog + +PostHog collects comprehensive system and usage information **only when analytics are enabled and consented**: + +#### System information +- Operating system name and version +- Java version and vendor +- CPU cores and memory allocation +- Deployment type (Docker, JAR, EXE) +- Docker/Kubernetes environment details (if applicable) +- Timezone and locale settings + +#### Application configuration +- Security settings (login enabled, OAuth/SAML configuration status) +- UI customization settings +- Feature flags and enabled functionality +- Legal document URLs (terms, privacy policy, etc.) +- System limits and quotas + +#### Usage data +- Aggregate counts (e.g., total number of user accounts created) +- Feature/tool usage (which tools/operations are used) +- Error tracking +- Browser and device information (for the web interface) + +**Important privacy notes**: +- **No document content, PDF data, or file metadata is ever collected or transmitted.** +- PostHog is configured with: + - `opt_out_capturing_by_default: true` + - `mask_all_text: true` + - `mask_all_element_attributes: true` +- Users must accept cookies before any data is captured. +- Data is stored on EU servers. +- Each instance has a unique UUID (not tied to individuals). + +### Why we use PostHog + +PostHog analytics help us: +- Understand which features are most valuable +- Identify and fix bugs proactively +- Improve user experience based on actual usage patterns +- Prioritize feature development +- Ensure compatibility across different environments +- Monitor application health and performance + +--- + + +## Scarf + +### What is Scarf? + +[Scarf](https://scarf.sh) provides a simple tracking pixel (`pixel.stirlingpdf.com`) that collects basic, non‑personally identifiable information about Stirling‑PDF usage. + +### Data collected by Scarf + +The Scarf pixel collects the following information: + +- **Machine Type**: Deployment type (Docker, JAR, or EXE) +- **App Version**: The version of Stirling‑PDF you're running +- **License Type**: Whether you're using Community or Enterprise edition +- **Login Enabled**: Whether authentication is enabled +- **Page Endpoint Loaded**: Which Stirling‑PDF page was loaded (e.g., `/split-pdf`) + +**Important**: The Scarf pixel does **not** collect or store: +- Personal information (PII) +- IP addresses (IP addresses are not stored) +- User‑specific identifiers +- Document content or file metadata +- Fine‑grained user behavior beyond which page/endpoint was loaded + +### Why we use Scarf + +Scarf helps us understand: +- Which deployment types are most common +- Version adoption rates +- Which pages/tools are reached across different configurations + +This data helps prioritize development efforts and ensure compatibility across deployment scenarios. + +### How to disable Scarf + +Scarf is opt‑in by default (via the cookie consent banner). To disable the Scarf tracking pixel **system‑wide** and suppress the banner for it: + +**Environment variable** +```bash +SYSTEM_DISABLEPIXEL=true +``` + +**settings.yml** +```yaml +system: + disablePixel: true +``` + +--- + + + +## Configuration and Control + +Analytics are governed by a **global master toggle**, **component toggles**, and the **cookie consent banner**. + +### 1) Global analytics toggle (master switch) + +Controls **all** analytics and whether a consent banner appears. + +**Environment variable** +```bash +SYSTEM_ENABLEANALYTICS=false # true | false | (unset = null) +``` + +**settings.yml** +```yaml +system: + enableAnalytics: false # true | false | null (unset) +``` + +**Behavior** +- `false`: Disables **all** analytics (no consent banner; PostHog & Scarf are off). +- `true`: Allows analytics (banner still required for user consent before any capture). +- `null`/unset: **First‑run admin choice** — on the first ever connection to a self‑hosted instance, the first visitor (assumed admin) is prompted to choose, and that choice sets the global behavior for all users (either disabling analytics or enabling the consent banner for others). + +### 2) Component toggles + +Use these to selectively enable/disable providers **in addition** to the global toggle. + +**PostHog** +```bash +SYSTEM_ENABLEPOSTHOG=false +``` +```yaml +system: + enablePosthog: false # true | false | null +``` + +**Scarf tracking pixel** +```bash +SYSTEM_DISABLEPIXEL=true +``` +```yaml +system: + disablePixel: true # true | false +``` + +**Interaction** +- If `enableAnalytics` is `false`, everything is off regardless of component toggles. +- If `enableAnalytics` is `true`/`null`, the consent banner is shown (see below). After consent: + - PostHog runs only if `enablePosthog` is `true`/`null` **and** the user consented. + - Scarf runs only if `disablePixel` is `false` **and** the user consented. + +### 3) Cookie consent banner + +When analytics are allowed globally (`system.enableAnalytics: true` or resolved via the first‑run admin choice), users see a cookie consent banner on their first visit. Users can: + +- **Accept all** → enables PostHog (if `enablePosthog` is `true`/`null`) and Scarf (if `disablePixel: false`) +- **Accept only necessary** → disables PostHog and Scarf +- **Customize** → granular selection where applicable + +**User control details** +- Users can change preferences at any time. +- Consent choices are stored locally in the user's browser. +- PostHog and Scarf respect the consent decision immediately. +- No tracking occurs until explicit consent is given. + +--- + +## Complete analytics disable (shortcut) + +If you want to disable **all** analytics and telemetry (and suppress any consent prompts) at once: + +**Environment variable** +```bash +SYSTEM_ENABLEANALYTICS=false +``` + +**settings.yml** +```yaml +system: + enableAnalytics: false +``` + +**Docker Compose example** +```yaml +version: '3.8' +services: + stirling-pdf: + environment: + - SYSTEM_ENABLEANALYTICS=false + # ... other configuration +``` + +--- + +## Privacy and Data Security + +### Data retention +- PostHog data is retained according to PostHog’s configured retention policies. +- Scarf pixel data is aggregated and anonymized. +- No personal documents or content are ever transmitted. + +### GDPR alignment +- PostHog servers are located in the EU. +- Cookie consent is required before tracking. +- Users can opt out at any time. +- No cross‑site tracking or fingerprinting. +- Text and element masking helps prevent accidental PII collection. + +### Transparency +- All analytics‑related code is open source and visible in the repository. +- Analytics can be completely disabled with simple configuration changes. +- Users have full control over their data via cookie preferences (when analytics are allowed globally). + +--- + +## For Self‑Hosted Instances + +If you're running Stirling‑PDF on your own infrastructure: + +1. **Private networks**: Analytics from self‑hosted instances help us understand deployment patterns but don't expose your internal network. +2. **Air‑gapped environments**: Disable analytics; the application works perfectly without external connections. +3. **Corporate environments**: Disable analytics if your security policy requires it, or allow it to help improve the product. + +--- + +## Support + +If you have questions or concerns about analytics: + +- Check our [Privacy Policy](https://www.stirlingpdf.com/privacy-policy) +- Review the [source code](https://github.com/Stirling-Tools/Stirling-PDF) +- Ask questions on [Discord](https://discord.gg/HYmhKj45pU) +- Open an issue on [GitHub](https://github.com/Stirling-Tools/Stirling-PDF/issues) diff --git a/versioned_docs/version-1.5/Contribute.md b/versioned_docs/version-1.5/Contribute.md new file mode 100644 index 00000000..57e2955e --- /dev/null +++ b/versioned_docs/version-1.5/Contribute.md @@ -0,0 +1,15 @@ +--- +sidebar_position: 8 +id: Contribute +--- + +# Contribution guidelines +Thanks for taking a look at how to contribute to Stirling PDFs open-source codebase +Please checkout our GitHub documentation + +## Adding/Update translations +See [How To Add New Language guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) + +## Wanting to contribute to our codebase + +See our [CONTRIBUTING guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) diff --git a/versioned_docs/version-1.5/FAQ.md b/versioned_docs/version-1.5/FAQ.md new file mode 100644 index 00000000..3f864b76 --- /dev/null +++ b/versioned_docs/version-1.5/FAQ.md @@ -0,0 +1,37 @@ +--- +sidebar_position: 8 +title: FAQ +--- +# Frequently Asked Questions + +### Q1: Why are .htm files being downloaded when I use the application? +This is often caused by your NGINX configuration. NGINX's default file upload size is 1MB, and any file larger than this will cause an .htm file to be downloaded instead. To fix this issue, you should modify your NGINX configuration to increase the maximum file upload size. + +### Q2: Can I customize the appearance and language of the Stirling PDF application? +Yes, Stirling PDF provides several environment variables to allow customization of the application, custom HTML, CSS and other settings such as the visibility to search engines. Please refer to the [UI Customisation](./Advanced%20Configuration/UI%20Customisation) section for more details. + +### Q3: I want to add a new feature to Stirling PDF. How can I contribute? +We welcome contributions from the community! Please open an issue on our GitHub page to discuss any large features before making any changes. Any small changes are fully welcome without discussion! After the feature has been discussed and approved, you can make the changes and submit a pull request. + +### Q4: I have a cool idea can you add it? +All feedback and suggestions are appreciated. It is best to submit these via a Github issue ticket with [Feature Request] in the title. +You can also reach out in discord but without a ticket to track it the request can often get lost! + +### Q5: I found a bug in Stirling PDF. Where can I report it? +Please report any bugs or issues you encounter through our GitHub Issues page. Be sure to include as much detail as possible so we can diagnose and resolve the issue quickly. + +### Q6: My Stirling-PDF Using high RAM at idle, How can I optimize memory usage? +Stirling-PDF's memory usage can be optimized in several ways: + +Disable security features: Set DOCKER_ENABLE_SECURITY=false to reduce RAM consumption. This can significantly lower memory usage, especially during idle periods. + +Use the Ultra Lite version: Pull the latest-ultra-lite tag from Docker Hub or GitHub, which is specifically designed for lower-end hardware. + +### Q7: I'm experiencing connection errors when pulling from docker.stirlingpdf.com + +If you experience connection issues, use these alternative endpoints: + +- Docker Hub: `docker pull stirlingtools/stirling-pdf:latest` +- GitHub: `docker pull ghcr.io/stirling-tools/stirling-pdf:latest` + +All endpoints provide the same functionality. diff --git a/versioned_docs/version-1.5/Functionality/Convert/Convert.md b/versioned_docs/version-1.5/Functionality/Convert/Convert.md new file mode 100644 index 00000000..d839c273 --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Convert/Convert.md @@ -0,0 +1,34 @@ +--- +sidebar_position: 2 +description: List of all conversion related features +--- +# Features - Convert + +## To PDF + +- `img-to-pdf`: This functionality allows users to convert images into PDF documents. + +- `file-to-pdf`: This feature converts various file formats (like DOCX, XLSX, etc.) into PDF. + +- `html-to-pdf`: Converts HTML files (And their includes css and images if provided via zip) into a PDF file + +- `url-to-pdf`: Renders a URL and converts it to PDF + +- `markdown-to-pdf`: Converts a markdown (.md) file to PDF + +## From PDF +- `pdf-to-img`: This feature converts PDF documents into image files. + +- `pdf-to-word`: This feature allows users to convert PDF documents into Word files. + +- `pdf-to-presentation`: With this feature, users can convert PDFs into presentation formats like PPT. + +- `pdf-to-text`: This feature enables users to extract text from a PDF by converting it to a text file. + +- `pdf-to-html`: This functionality allows users to convert PDFs into HTML format. + +- `pdf-to-xml`: This feature enables users to convert PDFs into XML files. + +- `pdf-to-pdfa`: This feature transforms PDF files into PDF/A format for long-term archiving. + +- `pdf-to-csv`: This feature Tries to detect tables within a PDF which can be exported, This only works with digital PDFs not scanned and is a Work in progress feature due to its complexity diff --git a/versioned_docs/version-1.5/Functionality/Convert/_category_.json b/versioned_docs/version-1.5/Functionality/Convert/_category_.json new file mode 100644 index 00000000..997530c2 --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Convert/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Convert", + "position": 1, + "link": { + "type": "doc", + "id": "Functionality/Convert/Convert" + } +} \ No newline at end of file diff --git a/versioned_docs/version-1.5/Functionality/Features Pipeline.md b/versioned_docs/version-1.5/Functionality/Features Pipeline.md new file mode 100644 index 00000000..dabe8a7f --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Features Pipeline.md @@ -0,0 +1,38 @@ +--- +sidebar_position: 5 +description: Pipeline Feature overview +--- + +# Features - Pipeline + +The Pipeline feature in Stirling PDF enables automated, sequential processing of PDFs through multiple operations. This powerful automation tool allows you to: + +- `create-pipeline`: Create custom workflows combining multiple PDF operations into a single automated process. For example, you could create a pipeline that: + - Splits a PDF + - Adds watermarks to each part + - Compresses the results + - All in one automated sequence + +- `save-pipeline`: Save pipeline configurations for future use, share them with others, or use them in automated folder scanning processes + +- `folder-scanning`: Set up automated processing of files in watched folders using your pipeline configurations. The system will automatically process any files placed in these folders according to your pipeline rules + +## Additional Features + +- Web UI configuration interface for easy pipeline setup +- JSON-based configuration for advanced users +- Support for multiple pipeline configurations +- Automatic unzipping of intermediate results +- Error handling and validation +- Ability to save and load pipeline configurations + +For detailed information on setting up and using pipelines, see: +- [Pipeline Configuration Guide](../Advanced%20Configuration/Pipeline) +- [Folder Scanning Guide](../Advanced%20Configuration/Folder%20Scanning) + +## Current Limitations + +- Cannot have multiple instances of the same operation in a single pipeline +- Web UI does not support operations requiring multiple different types of inputs +- Files and operations run in serial mode +- Additional file inputs during processing are not supported via UI diff --git a/docs/Functionality/Miscellaneous/Miscellaneous.md b/versioned_docs/version-1.5/Functionality/Miscellaneous/Miscellaneous.md similarity index 94% rename from docs/Functionality/Miscellaneous/Miscellaneous.md rename to versioned_docs/version-1.5/Functionality/Miscellaneous/Miscellaneous.md index 49985573..7d7dca95 100644 --- a/docs/Functionality/Miscellaneous/Miscellaneous.md +++ b/versioned_docs/version-1.5/Functionality/Miscellaneous/Miscellaneous.md @@ -16,7 +16,7 @@ description: List of all miscellaneous features - `extract-image-scans`: This feature enables users to extract scanned images from PDF files. -- `sign`: This feature allows users to add their writen signature to PDF documents. This can also use pre-stored files see [here](/Advanced%20Configuration/Sign%20with%20custom%20files). For cert signing see [Features-Security](/Functionality/Security/) +- `sign`: This feature allows users to add their writen signature to PDF documents. This can also use pre-stored files see [here](../../Advanced%20Configuration/Sign%20with%20custom%20files). For cert signing see [Features-Security](../Security) - `flatten`: This functionality enables users to flatten a PDF, merging interactive form fields with the document. diff --git a/docs/Functionality/Miscellaneous/_category_.json b/versioned_docs/version-1.5/Functionality/Miscellaneous/_category_.json similarity index 100% rename from docs/Functionality/Miscellaneous/_category_.json rename to versioned_docs/version-1.5/Functionality/Miscellaneous/_category_.json diff --git a/versioned_docs/version-1.5/Functionality/Page-Operations/Page-Operations.md b/versioned_docs/version-1.5/Functionality/Page-Operations/Page-Operations.md new file mode 100644 index 00000000..560d0f4a --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Page-Operations/Page-Operations.md @@ -0,0 +1,37 @@ +--- +sidebar_position: 1 +id: Page-Operations +title: Page Operations +description: List of all Page related features +--- +# Features - Page Operations + +- `merge-pdfs`: With this feature, users can merge multiple PDF documents into a single PDF. + +- `split-pdfs`: This functionality enables users to split a single PDF document into multiple separate PDFs. + +- `pdf-organizer`: This feature gives users the ability to rearrange, add, or delete pages within a PDF document. + +- `rotate-pdf`: With this feature, users can rotate pages within a PDF document to their desired orientation. + +- `remove-pages`: This feature allows users to remove specified pages from a PDF document. + +- `multi-page-layout`: This functionality allows users to create a layout involving multiple pages of a PDF. + +- `scale-pages`: This feature enables users to adjust the scale of pages in a PDF document. + +- `auto-split-pdfs`: This allows a user to insert physical divider pages between their documents in their scanner to allow S-PDF to auto separate them + +- `adjust-contrast`: Lets the user adjust the contrast, brightness and saturation + +- `crop`: Allows user to crop the pages to set size + +- `extract pages`: Extracts the defined pages from the PDF into a new PDF document + +- `pdf-to-single-page`: Converts multi pages PDF files into a single long pdf page. + +- `split-by-size-or-count`: Splits one or multiple PDF files into parts consisting of a maximum file size or page count definde by the user. + +- `overlay-pdf`: Can merge multiple PDFs into one another (ontop/behind etc) in various ways + +- `split-pdf-by-sections`: Splits a page in multiple section vertically, horizontally or both. Can be used to split a page in half etc. diff --git a/versioned_docs/version-1.5/Functionality/Page-Operations/_category_.json b/versioned_docs/version-1.5/Functionality/Page-Operations/_category_.json new file mode 100644 index 00000000..58674989 --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Page-Operations/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Page Operations", + "position": 1, + "link": { + "type": "doc", + "id": "Functionality/Page-Operations/Page-Operations" + } +} \ No newline at end of file diff --git a/versioned_docs/version-1.5/Functionality/Page-Operations/redact.md b/versioned_docs/version-1.5/Functionality/Page-Operations/redact.md new file mode 100644 index 00000000..344ae518 --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Page-Operations/redact.md @@ -0,0 +1,118 @@ +--- +sidebar_position: 1 +title: Manual Redaction +parent: Page operations +--- + +# Redaction Tool User Guide + +## Overview +The Document Redaction Tool allows you to securely redact sensitive information from documents using three different methods: text selection, area drawing, or entire page redaction. + +## Redaction Methods + +### 1. Text Selection Redaction +Perfect for redacting specific words, sentences, or paragraphs. + +**How to use:** +1. Click the text selection icon in the toolbar + + ![image](https://github.com/user-attachments/assets/e66dbfc1-0b06-4f65-8f60-7277b8acca91) + +2. Select the text you want to redact +3. Apply the redaction by either: + - Pressing `Ctrl + S` + - Clicking the save icon in the toolbar + + ![image](https://github.com/user-attachments/assets/73d4b1f0-a454-452b-ab60-028b9728004b) + + +### 2. Area Drawing Redaction +Ideal for redacting images, tables, or irregular content blocks. + +**How to use:** +1. Click the drawing tool icon in the toolbar + + ![image](https://github.com/user-attachments/assets/8597abed-0992-48d3-baf4-0e7673fb500c) + +2. Click and hold at your starting point +3. Drag to create a rectangle over the area +4. Click again to confirm and apply the redaction + - A red border means unsaved + + ![image](https://github.com/user-attachments/assets/42809be3-34e6-4725-920b-b4d51eb72e4f) + + - A green border means saved and active + + ![image](https://github.com/user-attachments/assets/0711ff11-da1a-41c3-9d57-82067ee0f8b8) + + +### 3. Page Redaction +Used when you need to redact entire pages. + +**How to use:** +1. Open the page redaction dialog + + ![image](https://github.com/user-attachments/assets/fae58a19-1f54-463e-bc81-027bd4f403bf) + + ![image](https://github.com/user-attachments/assets/66c1b1aa-7da1-4262-a476-0551924ed509) + +3. Enter page numbers or ranges (e.g., "1,3-5,7") +4. Select your preferred color +5. Click "Apply" to save changes + +## Customizing Redactions + +### Changing Colors + +**For new redactions:** +1. Click the color palette icon in the toolbar + + ![image](https://github.com/user-attachments/assets/788fd325-489e-4404-8377-07ec500a77dd) + +2. Select your preferred color +3. Any new redactions will use this color + +**For existing redactions:** +1. Click the redacted area +2. Click the color palette icon that appears +3. Choose your new color + +![redaction_color](https://github.com/user-attachments/assets/0bc05461-6427-4a62-8cd4-745c3104c04f) + + +### Removing Redactions +1. Click the redacted area you want to remove +2. Either: + - Click the trash icon that appears + - Press the `Delete` key + +![redaction_removal](https://github.com/user-attachments/assets/9bd3be2a-d2ec-4468-a229-bf81efb36bcc) + +### Converting PDF to PDF-image (Used in removing text behind the box) +To enable PDF to PDF-image option: + 1. Click on the image icon + + ![image](https://github.com/user-attachments/assets/8c480923-05e1-46d3-8f59-5f78db6d87f8) + +To disable PDF to PDF-image option: + 1. Click on the image icon + + ![image](https://github.com/user-attachments/assets/e2e07e31-8eb0-41ac-80ab-ffd8520f5795) + + +- If the image icon is green, then the option is enabled, if it is red then it is disabled. + + + + +## Keyboard Shortcuts +- `Ctrl + S`: Save/apply redaction +- `Delete`: Remove selected redaction +- `Escape`: Cancel unsaved area drawing + +## Tips +- If you're in drawing mode and need to delete a redaction, temporarily disable drawing mode first +- You can combine different redaction methods in the same document +- Always review your redactions before finalizing the document +- Redaction colors can be changed at any time, even after applying diff --git a/versioned_docs/version-1.5/Functionality/Security/Security.md b/versioned_docs/version-1.5/Functionality/Security/Security.md new file mode 100644 index 00000000..a4d7602b --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Security/Security.md @@ -0,0 +1,25 @@ +--- +sidebar_position: 3 +description: List of all Security related features +--- +# Features - Security + +- `add-password`: This feature allows users to secure their PDFs by adding a password. + +- `remove-password`: With this feature, users can remove the password from a secured PDF. + +- `change-permissions`: This functionality allows users to change the permissions of a PDF, controlling how others can view and edit it. + +- `add-watermark`: This feature enables users to add custom watermarks to their PDFs. + +- `cert-sign`: This feature enables users to digitally sign their PDFs using a certificate. For (hand-)written signatures see Features - Additional Utilities --> `sign` + +- `validate-signature`: Verify digital signatures and certificates in PDF documents, checking against custom certificate files + +- `remove-cert-sign`: Removes digital signatures from any inputted PDF + +- `sanitize-pdf`: This allows the user to remove various things within the PDF which may cause security concern such as javascript, files, links, fonts and metadata. + +- `auto-redact`: This features lets the user input text (or regex) to be redacted/blacked out from the pdf document. + +- `get-info-on-pdf`: This grabs all info on a PDF such as version, font types, width height and any and all information it can find and puts it within a formatted JSON doc (or visual tables within UI) diff --git a/versioned_docs/version-1.5/Functionality/Security/_category_.json b/versioned_docs/version-1.5/Functionality/Security/_category_.json new file mode 100644 index 00000000..31d985cc --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/Security/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Security", + "position": 1, + "link": { + "type": "doc", + "id": "Functionality/Security/Security" + } +} \ No newline at end of file diff --git a/versioned_docs/version-1.5/Functionality/The Technologies.md b/versioned_docs/version-1.5/Functionality/The Technologies.md new file mode 100644 index 00000000..6dd4774a --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/The Technologies.md @@ -0,0 +1,29 @@ +--- +sidebar_position: 0 +description: List of all technologies Stirling-PDF uses! +--- +# The Technologies Behind Stirling PDF +Stirling PDF harnesses several technologies throughout its implementation. + +# Java +As part of the JAVA framework to host the WebUI itself we use Spring Boot and Thymeleaf. +Apache PDFBox is the core of the PDF functionality within Stirling-PDF. +They offer a variety of methods to edit PDFs which we have then built Stirling-PDF on. +We also show all licenses used within our Java application [here](https://stirlingpdf.io/licenses). + +# JavaScript +- [PDF.js](https://github.com/mozilla/pdf.js) +- [PDF-LIB.js](https://github.com/Hopding/pdf-lib) + +# Core Components +- [Spring Boot + Thymeleaf](https://spring.io/projects/spring-boot) for the web framework +- [PDFBox](https://pdfbox.apache.org/) for majority of PDF manipulation +- [qpdf](https://qpdf.sourceforge.io/) for some PDF operations +- [LibreOffice](https://www.libreoffice.org/discover/libreoffice/) for advanced file conversions + +# Additional Technologies +- HTML, CSS, JavaScript for the frontend +- Docker for containerization +- jcefmaven (specifically for portable non-server version) + +For a comprehensive list of all technologies within the java application and their licenses, please visit our [licenses page](https://stirlingpdf.io/licenses). \ No newline at end of file diff --git a/versioned_docs/version-1.5/Functionality/_category_.json b/versioned_docs/version-1.5/Functionality/_category_.json new file mode 100644 index 00000000..e472811f --- /dev/null +++ b/versioned_docs/version-1.5/Functionality/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Functionality", + "position": 2, + "link": { + "type": "generated-index", + "description": "All functionality and their categories within Stirling-PDF." + } +} diff --git a/versioned_docs/version-1.5/Getting Started.md b/versioned_docs/version-1.5/Getting Started.md new file mode 100644 index 00000000..77ca367c --- /dev/null +++ b/versioned_docs/version-1.5/Getting Started.md @@ -0,0 +1,65 @@ +--- +sidebar_position: 0 +slug: / +--- + +## Benefits of Stirling-PDF +- **Extensive PDF Functionality:** Access 50+ tools, including signing, converting, merging, and more. +- **Advanced Customization:** Deep customization, themes, and environment variables. +- **Enterprise Features:** SSO, user management, and permission controls. +- **Data Security:** Local file processing with automatic deletion post-task. +- **Scalability & Automation:** Batch processing with Docker and Kubernetes support. +- **API Integration:** Use APIs for automation and external integrations. +- **Open-Source:** Community-driven with frequent updates and GitHub support. +- **Multi-Language Support:** Available in 38+ languages with active translations. + +Please feel free to request new features or report bugs through our [GitHub](https://github.com/Stirling-Tools/Stirling-PDF/issues) or [Discord](https://discord.gg/Cn8pWhQRxZ). + + +## Introduction + +This guide will help you choose the right installation method based on your needs. +We prioritise and focus on our Server deployment options however we also offer a [Ultra-Lite model](/Installation/Versions) for desktop users + +## Choose Your Installation Type + +### For Desktop Users +If you want to run Stirling PDF on your personal computer: + +1. **Windows Users** + - Download our installer ([Stirling-PDF-windows-x86_64.msi](https://files.stirlingpdf.com/win-installer.exe)) for a simple, standalone experience + - Refer to our [Windows Installation Guide](/Installation/Windows%20Installation) for detailed setup instructions + +2. **Linux/Unix Users** + - Dedicated Linux installer to be released soon, Currently you must run Stirling-PDF as a java jar + - Follow our comprehensive [Unix Installation Guide](/Installation/Unix%20Installation) for a native installation + +2. **Mac Users** + - Download our installer ([Apple Silicon](https://files.stirlingpdf.com/mac-installer.dmg)/[Intel](https://files.stirlingpdf.com/mac-x86_64-installer.dmg)) for a simple, standalone experience + - Follow our comprehensive [Mac Installation Guide](/Installation/Mac%20Installation) for a native installation + +### For Server Deployments +If you're looking to host Stirling PDF as a service: + +1. **Docker Users** + - We recommend using our Docker images for the easiest deployment + - Check our [Docker Installation Guide](/Installation/Docker%20Install) for setup instructions + - Choose from three versions: + - Fat (latest-fat): Includes additional fonts and security features + - Standard (latest): Balanced features and size + - Ultra-Lite (latest-ultra-lite): Minimal size with core features + +2. **Manual Server Setup** + - For bare metal server installations + - Use Stirling-PDF.jar package + - Follow our [Unix Installation Guide](/Installation/Unix%20Installation) for setup steps + +## Quick Reference Table + +| Installation Type | Best For | Documentation Link | +|------------------|----------|-------------------| +| Stirling-PDF-windows-x86_64.msi | Windows desktop users | [Windows Guide](/Installation/Windows%20Installation) | +| Stirling-PDF.jar | Server deployments without Docker | [Unix Guide](/Installation/Unix%20Installation) | +| Docker Images | Server deployments with Docker | [Docker Guide](/Installation/Docker%20Install) | + +Choose the installation method that best suits your needs and environment. Each guide provides detailed instructions for getting Stirling PDF up and running on your system. diff --git a/versioned_docs/version-1.5/Installation/Docker Install.md b/versioned_docs/version-1.5/Installation/Docker Install.md new file mode 100644 index 00000000..53eec782 --- /dev/null +++ b/versioned_docs/version-1.5/Installation/Docker Install.md @@ -0,0 +1,58 @@ +--- +sidebar_position: 2 +id: Docker Install +title: Docker Guide +--- + +# Docker Images for Stirling-PDF + +The docker image for Stirling-PDF is available on Docker Hub at [stirlingtools/stirling-pdf](https://hub.docker.com/r/stirlingtools/stirling-pdf) or on Github at [stirling-pdf](https://github.com/Stirling-Tools/Stirling-PDF/pkgs/container/stirling-pdf). + +Please note that Stirling PDF offers three distinct versions tailored for various hardware configurations. Users seeking optimal performance on lower-end hardware can choose from the specific versions provided. For those who prefer the most recent features and updates, it is recommended to continue using the latest tag. + +| Version | Latest Tag | +| ---------- | ------------------- | +| Fat | `latest-fat` | +| Standard | `latest` | +| Ultra Lite | `latest-ultra-lite` | + +### Run docker container with `docker run` + +```bash +docker run -d \ + --name stirling-pdf \ + -p 8080:8080 \ + -v "./StirlingPDF/trainingData:/usr/share/tessdata" \ + -v "./StirlingPDF/extraConfigs:/configs" \ + -v "./StirlingPDF/customFiles:/customFiles/" \ + -v "./StirlingPDF/logs:/logs/" \ + -v "./StirlingPDF/pipeline:/pipeline/" \ + -e DISABLE_ADDITIONAL_FEATURES=true \ + -e LANGS=en_GB \ + docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest +``` + +### Run docker container with `docker compose` + +- `docker-compose.yml` +```yaml +version: '3.3' +services: + stirling-pdf: + image: docker.stirlingpdf.com/stirlingtools/stirling-pdf:latest + ports: + - '8080:8080' + volumes: + - ./StirlingPDF/trainingData:/usr/share/tessdata # Required for extra OCR languages + - ./StirlingPDF/extraConfigs:/configs + - ./StirlingPDF/customFiles:/customFiles/ + - ./StirlingPDF/logs:/logs/ + - ./StirlingPDF/pipeline:/pipeline/ + environment: + - DISABLE_ADDITIONAL_FEATURES=false + - LANGS=en_GB +``` + +### Extras + +For extra parameters and customization please check the [advanced configuration](https://docs.stirlingpdf.com/Advanced%20Configuration/How%20to%20add%20configurations) page! diff --git a/versioned_docs/version-1.5/Installation/Kubernetes.md b/versioned_docs/version-1.5/Installation/Kubernetes.md new file mode 100644 index 00000000..59a4790a --- /dev/null +++ b/versioned_docs/version-1.5/Installation/Kubernetes.md @@ -0,0 +1,25 @@ +--- +sidebar_position: 2 +id: Kubernetes Install +title: Kubernetes Guide +--- + +### Run stirling-pdf helm chart + +```bash +helm repo add stirling-pdf https://stirling-tools.github.io/Stirling-PDF-chart +helm repo update +helm install stirling-pdf stirling-pdf/stirling-pdf-chart --namespace stirling-pdf --create-namespace +``` + +### Override stirling-pdf default values + +Create a `values.yaml` file with the values you want to override from the [documentation](https://github.com/Stirling-Tools/Stirling-PDF-chart/tree/main/charts/stirling-pdf). +Then, add `-f values.yaml` to the `helm install` command. + +### Upgrade the helm chart + +```bash +helm repo update +helm upgrade stirling-pdf stirling-pdf/stirling-pdf-chart --namespace stirling-pdf --reuse-values +``` diff --git a/versioned_docs/version-1.5/Installation/Mac.md b/versioned_docs/version-1.5/Installation/Mac.md new file mode 100644 index 00000000..4c82bf0f --- /dev/null +++ b/versioned_docs/version-1.5/Installation/Mac.md @@ -0,0 +1,107 @@ +--- +sidebar_position: 2 +id: Mac Installation +title: Mac Installation Guide +--- + # MacOS Installation Guide for Stirling PDF + +Stirling PDF can be run on MacOS either by using the `.dmg` installer or directly from the `.jar` file. + +### Prerequisites: +- Java 17 or 21 (_21 preferred_) + - Install via Homebrew: `brew install openjdk@21` + +## Running via the installer +| [Apple Silicon chips](https://files.stirlingpdf.com/mac-installer.dmg) | [Intel chips](https://files.stirlingpdf.com/mac-x86_64-installer.dmg) | +|------------------------------------------------------------------------|-----------------------------------------------------------------------| + +Download the `.dmg` file and follow the instructions to install the app. A window should pop up allowing you to copy the +app to your Applications folder. + +![mac-installer.png](/img/mac-installer.png) + +The app should now be located in Applications. Head to your Applications folder to open the app. When you open the app +for the first time, it will be blocked by MacOS because it has not been officially verified by Apple yet. + +![mac-app-blocked.png](/img/mac-app-blocked.png) + +This is only temporary but in the meantime, open System Settings and go to Privacy & Security and then scroll down to the +Security section. You should see the same message indicating the app being blocked. Click 'Open Anyway', you may be +prompted to enter your password to allow the app. Once you have done this, head back to Applications and open the app +again. It should open with no issue this time. + +![mac-security-allow.png](/img/mac-security-allow.png) + +## Running via the `.jar` file +Download the `.jar` file [here](https://files.stirlingpdf.com/Stirling-PDF.jar). +1. Open Terminal +2. Navigate to the folder containing the JAR: + ```bash + cd /path/to/folder/containing/jar + ``` +3. Run the JAR file: + ```bash + java -jar Stirling-PDF.jar + ``` + +_For convenience, you can create a simple script:_ +1. Create a file named run-stirling.sh and add the following contents: + ```bash + #!/bin/bash + cd /path/to/folder/containing/jar + java -jar Stirling-PDF.jar + ``` +2. Make it executable: + ```bash + chmod +x run-stirling.sh + ``` +3. Run it with: + ```bash + ./run-stirling.sh + ``` + + +### Optional Dependencies +Install these via [Homebrew](https://brew.sh/) to enable additional features like advanced document conversion or PDF compression: + + ```bash + # Install Homebrew if needed + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + # Install dependencies as needed + brew install openjdk@21 # Required + brew install qpdf # PDF compression + brew install --cask libreoffice # Document conversion + brew install tesseract # OCR functionality + brew install tesseract-lang # Additional OCR languages + brew install poppler # PDF to HTML conversion + pip3 install weasyprint # URL to PDF conversion + pip3 install unoserver # File to PDF conversion + ``` + +For Tesseract OCR, add to `config/settings.yml` (generated once you first run the jar): + +```yaml +system: + tessdataDir: /usr/local/share/tessdata +``` + + ## Quick Troubleshooting + - Java not found? Add to `~/.zshrc`: + ```bash + export PATH="/usr/local/opt/openjdk@21/bin:$PATH" + ``` + - Verify installations with: `[command] --version` (e.g., `java --version`) + - LibreOffice issues? Ensure no LibreOffice processes are running + - Need help? Visit [GitHub Issues](https://github.com/Stirling-Tools/Stirling-PDF/issues) + +### Starting unoserver alongside Stirling PDF + +To ensure that unoserver is running alongside Stirling PDF, you need to start it with the following command: + +```bash +unoserver --port 2003 --interface 0.0.0.0 +``` + +You can add this command to your startup script or systemd service file to ensure it starts automatically with Stirling PDF. + diff --git a/versioned_docs/version-1.5/Installation/Path Structure.md b/versioned_docs/version-1.5/Installation/Path Structure.md new file mode 100644 index 00000000..1921b24e --- /dev/null +++ b/versioned_docs/version-1.5/Installation/Path Structure.md @@ -0,0 +1,38 @@ +# Path Structure + +## Server Deployment +When running in server mode, the base path defaults to `./` (current directory) + + +## Desktop Deployment +When running as a desktop application (non-server deployment), the base path is set according to the operating system: + +- **Windows**: `%APPDATA%\Stirling-PDF\` +- **macOS**: `~/Library/Application Support/Stirling-PDF/` +- **Linux/Unix**: `~/.config/Stirling-PDF/` + + +# Directory Structure + +All paths below are relative to the BASE_PATH. The File.separator ensures cross-platform compatibility. + +## Root Directories +- `logs/` - Application logs storage +- `configs/` - Configuration files +- `pipeline/` - Pipeline-related operations +- `customFiles/` - Custom assets and templates +- `clientWebUI/` - Web interface assets + +## Configuration Files +- `configs/settings.yml` - Main settings file +- `configs/custom_settings.yml` - User-specific settings + +## Pipeline Directories +- `pipeline/watchedFolders/` - Monitored directories for automated processing +- `pipeline/finishedFolders/` - Completed processing output location + +## Custom Files Structure +- `customFiles/static/` - Static assets +- `customFiles/templates/` - Template files +- `customFiles/signatures/` - Digital signature files + diff --git a/versioned_docs/version-1.5/Installation/Unix.md b/versioned_docs/version-1.5/Installation/Unix.md new file mode 100644 index 00000000..6e7f9da5 --- /dev/null +++ b/versioned_docs/version-1.5/Installation/Unix.md @@ -0,0 +1,374 @@ +--- +sidebar_position: 2 +id: Unix Installation +title: Unix Installation Guide +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Unix Installation + +To run the application without Docker/Podman, you will need to manually install all dependencies and build the necessary components. + +Note that some dependencies might not be available in the standard repositories of all Linux distributions, and may require additional steps to install. + +The following guide assumes you have a basic understanding of using a command line interface in your operating system. + +It should work on most Linux distributions and MacOS. For Windows, you might need to use Windows Subsystem for Linux (WSL) for certain steps. +The amount of dependencies is to actually reduce overall size, ie installing LibreOffice sub components rather than full LibreOffice package. + +You could theoretically use a Distrobox/Toolbox, if your Distribution has old or not all Packages. But you might just as well use the Docker Container then. + +### Step 1: Prerequisites + +Install the following software, if not already installed: + +- Java 17 or later (21 recommended) +- Gradle 7.0 or later (included within repo so not needed on server) +- Git +- Python 3.8 (with pip) +- Make +- GCC/G++ +- Automake +- Autoconf +- libtool +- pkg-config +- zlib1g-dev +- libleptonica-dev + + + + ```bash + sudo apt-get update + sudo apt-get install -y git automake autoconf libtool \ + libleptonica-dev pkg-config zlib1g-dev make g++ \ + openjdk-21-jdk python3 python3-pip + ``` + + + ```bash + sudo dnf install -y git automake autoconf libtool \ + leptonica-devel pkg-config zlib-devel make gcc-c++ \ + java-21-openjdk python3 python3-pip + ``` + + + ```bash + nix-channel --update + nix-env -iA nixpkgs.jdk21 nixpkgs.git nixpkgs.python38 \ + nixpkgs.gnumake nixpkgs.libgcc nixpkgs.automake \ + nixpkgs.autoconf nixpkgs.libtool nixpkgs.pkg-config \ + nixpkgs.zlib nixpkgs.leptonica + ``` + + + +### Step 2: Clone and Build jbig2enc (Only required for certain OCR functionality) + + + + ```bash + mkdir ~/.git + cd ~/.git &&\ + git clone https://github.com/agl/jbig2enc.git &&\ + cd jbig2enc &&\ + ./autogen.sh &&\ + ./configure &&\ + make &&\ + sudo make install + ``` + + + ```bash + mkdir ~/.git + cd ~/.git &&\ + git clone https://github.com/agl/jbig2enc.git &&\ + cd jbig2enc &&\ + ./autogen.sh &&\ + ./configure &&\ + make &&\ + sudo make install + ``` + + + ```bash + nix-env -iA nixpkgs.jbig2enc + ``` + + + +### Step 3: Install Additional Software + +Next we need to install LibreOffice for conversions, tesseract for OCR, and opencv for pattern recognition functionality. + +Install the following software: + +- libreoffice (libreoffice-core libreoffice-common libreoffice-writer libreoffice-calc libreoffice-impress) +- python3-uno +- unoserver +- pngquant +- tesseract +- opencv-python-headless + + + + ```bash + sudo apt-get install -y libreoffice-writer libreoffice-calc libreoffice-impress tesseract + pip3 install uno opencv-python-headless unoserver pngquant WeasyPrint --break-system-packages + ``` + + + ```bash + sudo dnf install -y libreoffice-writer libreoffice-calc libreoffice-impress tesseract + pip3 install uno opencv-python-headless unoserver pngquant WeasyPrint + ``` + + + ```bash + nix-env -iA nixpkgs.libreoffice nixpkgs.tesseract nixpkgs.poppler_utils + pip3 install uno opencv-python-headless unoserver pngquant WeasyPrint + ``` + + + +### Step 4: Grab latest Stirling-PDF Jar + +The JAR can be downloaded in two versions, [normal](https://files.stirlingpdf.com/Stirling-PDF.jar) and [security](https://files.stirlingpdf.com/Stirling-PDF-with-login.jar) + +### Step 5: Move jar to desired location + +You can move this file to a desired location, for example, `/opt/Stirling-PDF/`. +You must also move the Script folder within the Stirling-PDF repo that you have downloaded to this directory. +This folder is required for the python scripts using OpenCV. + + + + ```bash + sudo mkdir /opt/Stirling-PDF &&\ + sudo mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ &&\ + sudo mv scripts /opt/Stirling-PDF/ &&\ + echo "Scripts installed." + ``` + + + ```bash + sudo mkdir /opt/Stirling-PDF &&\ + sudo mv ./build/libs/Stirling-PDF-*.jar /opt/Stirling-PDF/ &&\ + sudo mv scripts /opt/Stirling-PDF/ &&\ + echo "Scripts installed." + ``` + + + ```bash + mv ./build/libs/Stirling-PDF-*.jar ./Stirling-PDF-*.jar + ``` + + + +### Step 6: OCR Language Support + +If you plan to use the OCR (Optical Character Recognition) functionality, you might need to install language packs for Tesseract if running non-english scanning. + + + + ```bash + sudo apt update &&\ + # All languages + # sudo apt install -y 'tesseract-ocr-*' + + # Find languages: + apt search tesseract-ocr- + + # View installed languages: + dpkg-query -W tesseract-ocr- | sed 's/tesseract-ocr-//g' + ``` + + + ```bash + # All languages + # sudo dnf install -y tesseract-langpack-* + + # Find languages: + dnf search -C tesseract-langpack- + + # View installed languages: + rpm -qa | grep tesseract-langpack | sed 's/tesseract-langpack-//g' + ``` + + + ```bash + nix-env -iA nixpkgs.tesseract + ``` + Note: Nix Package Manager pre-installs almost all the language packs when tesseract is installed. + + + 1. Download the desired language pack(s) by selecting the `.traineddata` file(s) for the language(s) you need. + 2. Place the `.traineddata` files in the Tesseract tessdata directory: `/usr/share/tessdata` + 3. Please view [tesseract install guide](https://tesseract.readthedocs.io/en/latest/installation.html) for more info. + + **IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED. + + + + +### Step 7: Run Stirling-PDF + + + + ```bash + java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar + ``` + + + ```bash + java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar + ``` + + + ```bash + java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar + ``` + Since libreoffice, soffice, and conversion tools have their dbus_tmp_dir set as `dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus"`, you get the following error: + `[Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory '/run/user/1501': Permission denied` + To resolve this, use: + `bash + mkdir temp + export DBUS_SESSION_BUS_ADDRESS="unix:path=./temp" + ` + + + +### Step 8: Adding a Desktop Icon + +This will add a modified Appstarter to your Appmenu. + +```bash +location=$(pwd)/gradlew +image=$(pwd)/docs/stirling-transparent.svg + +cat > ~/.local/share/applications/Stirling-PDF.desktop < + diff --git a/versioned_sidebars/version-1.5-sidebars.json b/versioned_sidebars/version-1.5-sidebars.json new file mode 100644 index 00000000..caea0c03 --- /dev/null +++ b/versioned_sidebars/version-1.5-sidebars.json @@ -0,0 +1,8 @@ +{ + "tutorialSidebar": [ + { + "type": "autogenerated", + "dirName": "." + } + ] +} diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..63fdda0e --- /dev/null +++ b/versions.json @@ -0,0 +1,3 @@ +[ + "1.5" +]