markpdf – a CLI tool for Watermarking PDF files

TL; DR: markpdf is a CLI tool for watermarking PDF that produces better PDF quality and dramatically smaller file size.

I’ve released a PHP library for Adding watermark on image or PDF with PHP last year. As of today, it has 43 stars and 15 forks and 16 issues (10 of which are closed).

The Problem with PHP-Watermark

Most of the issues in PHP-Watermark library were coming from one single point – file size and quality issue when watermarking PDF files. Actually, when using the imagemagick + ghostscript for extraction and joining pdf pages, it has a few drawbacks including file-size issue. And this is how this PHP library works internally with PDFs. Many developers were asking for a solution about the file size and PDF quality since releasing of this library.

The Solution – a new CLI tool

So, I’ve created a command line tool for PDF watermarking that will work without converting pages into images. As a result, you’ll get better PDF quality and dramatically smaller file size.

Here is this tool: markpdf. See the readme for usages, options and examples.

If you’re already a user of php-watermark, please note that it’s not a PHP library. So you’ve to use it using execshell_exec or Symfony Process Component.

Leave a Comment

Your email address will not be published.