Mgosoft PDF Stamper Command Line Guide: Syntax, Examples, and Tips
Mgosoft PDF Stamper is a lightweight command-line utility for applying text, image, and date/time stamps to single or multiple PDF files. This guide covers the command syntax, common examples, useful options, and practical tips for automating PDF stamping tasks.
Quick overview
- Purpose: Add watermarks, headers/footers, timestamps, and images to PDFs via CLI.
- Use cases: Batch stamping, automated document workflows, adding confidentiality marks, page numbering, and timestamping scanned documents.
Basic syntax
Command structure (assume executable named PdfStamper.exe):
Code
PdfStamper.exe [options] input.pdf output.pdf
Common option forms:
-t “text”— add text stamp-f fontname— specify font-fs fontsize— specify font size-c color— text color (hex or named)-x xpos -y ypos— position (points; origin bottom-left)-r rotation— rotation in degrees-i image.png— image stamp-p pages— target pages (e.g.,1,1-3,odd,even,all)-op opacity— opacity (0–100)-l layer— stamp layer (foreground/background)-dt format— date/time format for dynamic timestamps-s— silent/overwrite output
Note: exact option names may vary by version; check the shipped help (PdfStamper.exe -?) for your install.
Examples
- Simple text stamp centered on all pages
Code
PdfStamper.exe -t “CONFIDENTIAL” -f Arial -fs 48 -c #FF0000 -x 300 -y 400 -r 45 -op 50 input.pdf output.pdf
Adds a red, semi-transparent diagonal “CONFIDENTIAL” stamp.
- Add date/time in footer on every page
Code
PdfStamper.exe -t “Printed: %DATE% %TIME%” -f TimesNewRoman -fs 10 -x 50 -y 20 -p all input.pdf output.pdf
Use the tool’s date/time token (e.g., %DATE%, %TIME%) or -dt to specify format if supported.
- Image logo in top-right on first page only
Code
PdfStamper.exe -i logo.png -x 450 -y 750 -p 1 -op 80 input.pdf output.pdf
- Page numbering in footer (page X of Y)
Code
PdfStamper.exe -t “Page %p of %P” -f Courier -fs 9 -x 260 -y 30 -p all input.pdf output.pdf
Common tokens: %p = current page, %P = total pages.
- Batch process multiple PDFs (Windows CMD loop)
Code
for %F in (*.pdf) do PdfStamper.exe -t “ARCHIVE” -f Arial -fs 36 -x 300 -y 400 -op 40 “%F” “stamped%~nF_stamped.pdf”
Common options explained
- Positioning: coordinates are typically in points (72 points = 1 inch); origin usually bottom-left. Adjust based on page size.
- Opacity: 0 = invisible, 100 = opaque.
- Pages selection: use ranges and keywords for flexible targeting.
- Layer: foreground places stamp over content; background behind content.
- Fonts & encoding: embedded fonts avoid substitution; ensure font exists on host system.
Troubleshooting & tips
- Verify exact CLI flags with
PdfStamper.exe -?as versions differ. - Use a small test PDF when experimenting with positions, rotation, and opacity.
- For consistent placement across varying page sizes, calculate coordinates relative to page width/height if the tool supports expressions or use page templates.
- Embed fonts or use common fonts to avoid rendering differences.
- When stamping many large PDFs, monitor disk space and run in batches to reduce memory spikes.
- For OCR’d scanned files, apply stamps after OCR to avoid interfering with text layers if needed.
- Use image stamps with transparent PNGs for clean overlays.
- Automate with scripting (PowerShell, Bash) and include error handling (check exit codes).
- Keep originals untouched—write stamped files to a separate folder or use versioned filenames.
Security and licensing notes
- Check Mgosoft’s license for deployment and redistribution terms.
- Stamping can alter PDFs; keep backups of originals when provenance is important.
Example workflow (automated nightly run)
- Move new PDFs to a watch folder.
- Run a script that applies a timestamp and “Processed” stamp:
- Apply timestamp in footer.
- Add “Processed” image logo on cover page.
- Move stamped files to archive and log results (filename, pages, timestamp, exit code).
- Alert on any non-zero exit codes.
If you want, I can generate ready-to-run scripts for Windows PowerShell or Bash tailored to your environment and the exact PdfStamper.exe version you have.
Leave a Reply