- C# 99.1%
- Batchfile 0.9%
| .github/workflows | ||
| src/DocuMagic | ||
| .gitignore | ||
| DocuMagic.sln | ||
| dump_pdf_fields.bat | ||
| ICON_INSTRUCTIONS.md | ||
| README.md | ||
| version.txt | ||
DocuMagic - Instrument Document Deployment Tool
DocuMagic is a Windows desktop application that automates the document deployment process for FMS-CO2 instruments. It replaces the previous batch and PowerShell script workflow with a user-friendly GUI application.
Features
- User-Friendly GUI: Modern WPF interface for easy data entry
- Automated File Copying: Copies template files (Excel, ODS, Word) to appropriate instrument directories
- PDF Form Filling: Built-in PDF form filling for:
- Laser Safety Compliance Log
- Certificate of Origin
- Word Document Processing: Automated editing and PDF conversion of Declaration of Conformity documents in multiple languages:
- English (always processed)
- Spanish
- French
- Italian
- German
- Dutch
- Configurable Settings: Customize source file paths and destination settings
- Self-Contained: All PDF processing is built-in (no external PDFtk required)
- Version Management: Automatic version incrementing with each build
Requirements
System Requirements
- Windows 10 or Windows 11
- .NET 8.0 Runtime (Desktop)
- Microsoft Word (for Word document processing)
Installation
- Download the latest
DocuMagic_vX.X.X.exefrom the Releases page - Install .NET 8.0 Desktop Runtime if not already installed
- Ensure Microsoft Word is installed on your computer
- Run the executable
Usage
Basic Workflow
- Launch DocuMagic
- Enter Instrument Information:
- Serial Number
- Manufacturing Date (format: MMM-YYYY, e.g., JAN-2025)
- Laser Serial Number
- Head Size (16, 36, 56, or 91)
- Select Languages: Choose which Declaration of Conformity language translations to process (English is always processed)
- Click "Process Documents"
- Review the Log: Monitor progress and check for any errors
Settings Configuration
Click the Settings button to configure:
Source Paths Tab
- Base Instrument Path: Root directory where instrument folders are located
- DoC Source Path: Location of Declaration of Conformity templates
- Template Paths: Locations of all source template files
Destination Tab
- Enable custom destination path override if needed
- Specify alternative base path for target directories
General Tab
- Set technician initials (for Laser Safety Compliance Log)
What DocuMagic Does
File Operations
-
Searches for the target instrument directory by serial number
-
Creates necessary subdirectories:
data/data/beta/SmallSignal/data/LinearityPlots/data/beta/0-7torr_seperation/docs/docs/Performance Reports/docs/Manual Addenda/
-
Copies template files:
- CO2 Standards Template
- Low Signal 20CA Template
- Low Signal 1SYR Template
- Linearity Tool
- 0-7torr Separation Template
- Performance Report Template
- Manual Addenda Templates
PDF Processing
- Fills and creates PDF forms:
- Laser Safety Compliance Log: Auto-fills with serial number, head size, laser serial, date, and passes all safety checks
- Certificate of Origin: Auto-fills with model, serial number, and manufacturing date
Word Document Processing
- Processes Declaration of Conformity documents:
- Copies template for each selected language
- Removes obsolete model references
- Inserts serial number in language-appropriate location
- Exports to PDF
- Deletes original .docx file
Project Structure
DocuMagic/
├── src/
│ └── DocuMagic/
│ ├── DocuMagic.csproj
│ ├── App.xaml / App.xaml.cs
│ ├── MainWindow.xaml / MainWindow.xaml.cs
│ ├── SettingsWindow.xaml / SettingsWindow.xaml.cs
│ ├── Models/
│ │ ├── AppSettings.cs
│ │ └── ProcessingContext.cs
│ └── Services/
│ ├── FileOperationsService.cs
│ ├── PdfFormFillingService.cs
│ └── WordProcessingService.cs
├── .github/
│ └── workflows/
│ └── build-and-release.yml
├── version.txt
└── README.md
Development
Building from Source
# Clone the repository
git clone https://github.com/yourusername/DocuMagic.git
cd DocuMagic
# Restore dependencies
dotnet restore src/DocuMagic/DocuMagic.csproj
# Build
dotnet build src/DocuMagic/DocuMagic.csproj --configuration Release
# Run
dotnet run --project src/DocuMagic/DocuMagic.csproj
Publishing
dotnet publish src/DocuMagic/DocuMagic.csproj `
--configuration Release `
--output ./publish `
--runtime win-x64 `
--self-contained false `
/p:PublishSingleFile=true
CI/CD
DocuMagic uses GitHub Actions for automated builds:
- Automatic Version Increment: Each commit increments the patch version
- Automated Builds: Triggered on push to main or claude/* branches
- Artifact Generation: Executable named with version number (e.g.,
DocuMagic_v1.0.5.exe) - Release Creation: Automatic releases on main branch
Technologies Used
- .NET 8.0: Target framework
- WPF: User interface
- PDFtk Server: PDF form filling (GPL v2, bundled with application)
- Microsoft.Office.Interop.Word: Word document automation
- Newtonsoft.Json: Settings serialization
License
This project is proprietary software developed for internal use.
Author
Daniel Abrams
Original batch/PowerShell scripts: Version 4.3 Windows Application: Version 1.0.0+
Version History
See version.txt for current version number.
Migration from Batch Script
This application replaces the previous AutoInsDocScript batch file workflow:
- Before: Batch file + PowerShell script + manually installed PDFtk
- After: Single executable with bundled PDFtk (automatically included)
All functionality has been preserved and enhanced with:
- Better error handling
- Progress logging
- Configurable settings
- Modern user interface
Troubleshooting
"Could not start Microsoft Word"
- Ensure Microsoft Word is installed
- Try running DocuMagic as Administrator
- Check that Word is not in Safe Mode
"Source PDF not found"
- Open Settings and verify all source paths are correct
- Ensure network drives are accessible
- Check file permissions
"Could not find directory containing serial number"
- Verify the serial number is correct
- Check that the Base Instrument Path in Settings is correct
- Ensure you have access to the network location
Version not updating in executable
- Version is automatically managed by GitHub Actions
- For local builds, manually update
version.txtand the.csprojfile
Support
For issues or feature requests, please open an issue on the GitHub repository.