No description
  • C# 99.1%
  • Batchfile 0.9%
Find a file
2025-12-24 17:32:21 +00:00
.github/workflows fix: Embed all PDFtk DLL dependencies to resolve libiconv2.dll error 2025-12-17 13:42:52 +00:00
src/DocuMagic chore: bump version to 2.0.11 [skip ci] 2025-12-24 17:32:21 +00:00
.gitignore fix: Embed all PDFtk DLL dependencies to resolve libiconv2.dll error 2025-12-17 13:42:52 +00:00
DocuMagic.sln feat: Create DocuMagic Windows application 2025-12-16 19:50:43 +00:00
dump_pdf_fields.bat debug: Save FDF files to desktop and add field dump utility for troubleshooting DoC form filling 2025-12-17 15:56:11 +00:00
ICON_INSTRUCTIONS.md feat: Add magic wand icon embedded in executable 2025-12-17 19:13:14 +00:00
README.md feat: Switch from iText7 to PDFtk for PDF form filling 2025-12-16 20:59:32 +00:00
version.txt chore: bump version to 2.0.11 [skip ci] 2025-12-24 17:32:21 +00:00

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

  1. Download the latest DocuMagic_vX.X.X.exe from the Releases page
  2. Install .NET 8.0 Desktop Runtime if not already installed
  3. Ensure Microsoft Word is installed on your computer
  4. Run the executable

Usage

Basic Workflow

  1. Launch DocuMagic
  2. Enter Instrument Information:
    • Serial Number
    • Manufacturing Date (format: MMM-YYYY, e.g., JAN-2025)
    • Laser Serial Number
    • Head Size (16, 36, 56, or 91)
  3. Select Languages: Choose which Declaration of Conformity language translations to process (English is always processed)
  4. Click "Process Documents"
  5. 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

  1. Searches for the target instrument directory by serial number

  2. Creates necessary subdirectories:

    • data/
    • data/beta/SmallSignal/
    • data/LinearityPlots/
    • data/beta/0-7torr_seperation/
    • docs/
    • docs/Performance Reports/
    • docs/Manual Addenda/
  3. 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

  1. 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

  1. 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.txt and the .csproj file

Support

For issues or feature requests, please open an issue on the GitHub repository.