102 lines
2.3 KiB
Markdown
102 lines
2.3 KiB
Markdown
# PDF Export Functionality
|
|
|
|
The gallery now includes the ability to export multiple plots to a merged PDF with grid layout.
|
|
|
|
## Features
|
|
|
|
- Select up to 4 plots from any gallery page
|
|
- Automatic grid layout (1x1, 1x2, 2x2)
|
|
- Export to PDF with proper scaling
|
|
- Keyboard shortcuts for easy access
|
|
|
|
## Usage
|
|
|
|
### Selecting Plots
|
|
|
|
1. Press **Ctrl+E** to enter selection mode
|
|
2. Click on up to 4 plot thumbnails to select them
|
|
3. Selected plots will show a checkmark overlay
|
|
4. A counter shows how many plots are selected (e.g., "2/4 selected")
|
|
|
|
### Exporting
|
|
|
|
1. After selecting plots, click the **📄** export button (appears in floating buttons)
|
|
2. The system will show export instructions with:
|
|
- JSON data for the export request
|
|
- Command to run the export script
|
|
3. Copy the JSON data and save it as `export_request.json`
|
|
4. Run the export command in your terminal
|
|
|
|
### Keyboard Shortcuts
|
|
|
|
- **Ctrl+E**: Toggle selection mode
|
|
- **Escape**: Clear all selections and exit selection mode
|
|
|
|
## Export Methods
|
|
|
|
The system supports two PDF merging methods:
|
|
|
|
### Method 1: pdfjam (Recommended)
|
|
```bash
|
|
# Install on Ubuntu/Debian
|
|
sudo apt-get install texlive-extra-utils
|
|
|
|
# Check if available
|
|
python export_plots.py --check-deps
|
|
```
|
|
|
|
### Method 2: Python libraries
|
|
```bash
|
|
# Install Python dependencies
|
|
pip install PyPDF2 reportlab
|
|
|
|
# Check if available
|
|
python export_plots.py --check-deps
|
|
```
|
|
|
|
## Export Script Usage
|
|
|
|
```bash
|
|
# Basic usage
|
|
python export_plots.py export_request.json
|
|
|
|
# Specify output file
|
|
python export_plots.py export_request.json --output my_plots.pdf
|
|
|
|
# Check available dependencies
|
|
python export_plots.py --check-deps
|
|
```
|
|
|
|
## JSON Request Format
|
|
|
|
```json
|
|
{
|
|
"plots": [
|
|
"/path/to/plot1.pdf",
|
|
"/path/to/plot2.pdf"
|
|
],
|
|
"layout": {
|
|
"rows": 1,
|
|
"cols": 2
|
|
},
|
|
"output_name": "merged_plots.pdf"
|
|
}
|
|
```
|
|
|
|
## Layout Options
|
|
|
|
- **1 plot**: 1x1 grid
|
|
- **2 plots**: 1x2 grid (horizontal)
|
|
- **3 plots**: 2x2 grid (one empty slot)
|
|
- **4 plots**: 2x2 grid (full)
|
|
|
|
## Technical Details
|
|
|
|
The export functionality consists of:
|
|
|
|
- **Frontend**: JavaScript selection UI and export manager
|
|
- **Backend**: Python script for PDF merging
|
|
- **CSS**: Styling for selection mode and overlays
|
|
|
|
The system is designed to work without requiring a web server, using file-based communication between the browser and Python script.
|