Repository navigation
GUI Application
Marc Jones edited this page Dec 30, 2025
·
1 revision
This page documents the PdfEditor graphical user interface - a cross-platform PDF viewing and redaction application built with Avalonia UI.
PdfEditor is a desktop application for viewing, editing, and securely redacting PDFs. It runs on Windows, Linux, and macOS.
Key Features:
- Open and view PDF documents
- Page navigation with thumbnails
- Zoom and pan controls
- Text selection and search
- TRUE glyph-level redaction (removes text from PDF structure)
- Clipboard history of redacted text
- Batch text redaction via search
- Page manipulation (add, remove, rotate)
| Component | Technology | Purpose |
|---|---|---|
| UI Framework | Avalonia 11.1.3 | Cross-platform XAML UI |
| MVVM | ReactiveUI 20.1.1 | Reactive bindings, commands |
| PDF Rendering | PDFtoImage (PDFium) | Page display |
| Graphics | SkiaSharp | 2D drawing |
┌─────────────────────────────────────────────────────────────────┐
│ File Edit View Tools Help [_][□][X] │
├─────────────────────────────────────────────────────────────────┤
│ [Open] [Save] [Zoom+] [Zoom-] [Fit] │ Search: [________] [Find] │
├──────────┬──────────────────────────────────────────────────────┤
│ │ │
│ Page 1 │ │
│ ┌────┐ │ │
│ │ │ │ PDF Page Display │
│ └────┘ │ │
│ │ (rendered at current zoom) │
│ Page 2 │ │
│ ┌────┐ │ │
│ │ │ │ │
│ └────┘ │ │
│ │ │
│ Page 3 │ │
│ ┌────┐ │ │
│ │ │ │ │
│ └────┘ │ │
│ │ │
│ Thumbs │ │
├──────────┴──────────────────────────────────────────────────────┤
│ Status: Ready Page 1 of 10 │ 100% │
└─────────────────────────────────────────────────────────────────┘
- Open a PDF document
- Click and drag to select an area on the page
- Press
Deleteor use menu to redact - Text within the area is removed from PDF structure
- Black box is drawn for visual confirmation
- Save the document
- Open a PDF document
- Use Search (
Ctrl+F) to find text - Click "Redact All Matches"
- All instances are removed throughout the document
- Save the document
See GUI-Automation for Roslyn C# scripting.
PdfEditor/
├── Views/
│ ├── MainWindow.axaml # XAML UI definition
│ └── MainWindow.axaml.cs # Code-behind (event handlers)
├── ViewModels/
│ ├── MainWindowViewModel.cs # Main logic
│ └── MainWindowViewModel.Scripting.cs # Automation support
├── Services/
│ ├── PdfDocumentService.cs # Load/save documents
│ ├── PdfRenderService.cs # Page rendering
│ ├── RedactionService.cs # Redaction orchestration
│ ├── PdfSearchService.cs # Text search
│ └── PdfTextExtractionService.cs
└── Models/
└── PageThumbnail.cs # Thumbnail data
The GUI follows strict Model-View-ViewModel separation:
| Layer | Responsibility | Example |
|---|---|---|
| View | UI display, user input | MainWindow.axaml |
| ViewModel | State, commands, logic orchestration | MainWindowViewModel.cs |
| Model | Data structures | PageThumbnail.cs |
| Services | Business operations | RedactionService.cs |
// Document state
public PdfDocument? CurrentDocument { get; }
public int CurrentPageNumber { get; set; }
public int TotalPages { get; }
// Display state
public Bitmap? CurrentPageImage { get; }
public double ZoomLevel { get; set; }
public ObservableCollection<PageThumbnail> Thumbnails { get; }
// Selection state
public Rect? SelectionRectangle { get; set; }
public string SearchText { get; set; }
public ObservableCollection<SearchResult> SearchResults { get; }| Command | Action | Shortcut |
|---|---|---|
OpenCommand |
Open PDF file | Ctrl+O |
SaveCommand |
Save current document | Ctrl+S |
SaveAsCommand |
Save with new name | Ctrl+Shift+S |
RedactSelectionCommand |
Redact selected area | Delete |
RedactAllMatchesCommand |
Redact all search matches | - |
SearchCommand |
Find text | Ctrl+F |
ZoomInCommand |
Increase zoom | Ctrl++ |
ZoomOutCommand |
Decrease zoom | Ctrl+- |
NextPageCommand |
Go to next page | Page Down |
PreviousPageCommand |
Go to previous page | Page Up |
The GUI must convert between coordinate systems:
| System | Origin | Y Direction | Used For |
|---|---|---|---|
| Bottom-left | Up | Content stream operations | |
| Avalonia | Top-left | Down | UI rendering, mouse input |
| Image | Top-left | Down | Rendered page bitmaps |
Conversion: When the user clicks on the rendered page, coordinates are converted:
Avalonia Y → Image Y (scaled by zoom) → PDF Y (inverted)
PDF Y = PageHeight - AvaloniaY
See PDF-Coordinate-Systems and Coordinate-Conversion-Challenges for details.
Redacted text is captured to a clipboard history:
- Shows what was removed
- Helps verify correct content was redacted
- Does NOT persist after closing document (security)
| Scenario | Behavior |
|---|---|
| Invalid PDF | Show error dialog, don't crash |
| Encrypted PDF | Prompt for password (if supported) |
| Large PDF | Show progress indicator |
| Save failure | Show error, keep document open |
| Redaction failure | Show error, preserve original content |
| Shortcut | Action |
|---|---|
| Ctrl+O | Open file |
| Ctrl+S | Save |
| Ctrl+Shift+S | Save As |
| Ctrl+F | Search |
| Ctrl++ | Zoom in |
| Ctrl+- | Zoom out |
| Ctrl+0 | Reset zoom |
| Page Up | Previous page |
| Page Down | Next page |
| Home | First page |
| End | Last page |
| Delete | Redact selection |
| Escape | Clear selection |
- Requires
libgdiplusfor PDF rendering - Install:
sudo apt-get install libgdiplus
- Notarization may be required for distribution
- Code signing recommended
- No special requirements
- .NET 8.0 runtime or self-contained build
- Project-Architecture - Overall architecture
- Redaction-Engine - How TRUE redaction works
- GUI-Automation - Roslyn C# scripting
- CLI-Tool - Command-line alternative