Production servers that generate APM PDFs (activities, single memos, special memos, non-travel memos, change requests, etc.) should have tools to embed scanned or image-only PDF attachments in the printout appendix. mPDF alone cannot import many scanned PDFs.
| Package | Binary | Role |
|---------|--------|------|
| Ghostscript | gs | Primary: republish PDFs; rasterize pages to PNG for embedding |
| Poppler | pdftoppm | Fallback rasterization |
| LibreOffice | libreoffice, soffice | Convert Word (.doc, .docx) attachments to PDF for the annex |
| PHP Imagick (optional) | — | Optional rasterization via ImageMagick |
Debian / Ubuntu:
sudo apt update
sudo apt install ghostscript poppler-utils libreoffice-writer
RHEL / AlmaLinux / Rocky:
sudo dnf install ghostscript poppler-utils libreoffice-writer
Verify after install (as the same user PHP runs as, e.g. www-data):
which gs pdftoppm libreoffice
gs --version
libreoffice --version
If these commands are missing from PHP’s PATH, scanned PDFs may fail to embed, and Word attachments will not render in the annex (they still appear in the attachment index).
Implementation: App\Helpers\PrintHelper::appendAttachmentsAppendixToMpdf().
composer install --optimize-autoloader --no-dev
npm install --production
npm run build
cp .env.example .env
php artisan key:generate
php artisan migrate --force
php artisan uploads:link
php artisan config:clear
php artisan route:clear
php artisan view:clear
php artisan cache:clear
Use the composer script for complete deployment:
composer run deploy
This will:
The uploads:link command creates a symbolic link from /opt/homebrew/var/www/staff/uploads to public/uploads, making uploaded files accessible via web.
php artisan uploads:link
php artisan uploads:link --force
/opt/homebrew/var/www/staff/uploads/
├── staff/
│ └── signature/ # Staff signature images
├── summernote/ # Rich text editor uploads
└── ... # Other uploaded documents
mklink /J (junction)symlink()chmod -R 755 storage/app/uploads
chown -R www-data:www-data storage/app/uploads
ls -la public/uploads
# Should show: lrwxr-xr-x ... public/uploads -> /path/to/storage/app/uploads