change PDF font & background colour

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
javibbg6
Posts: 2
Joined: 2020-01-17T04:13:38-07:00
Authentication code: 1152

change PDF font & background colour

Post by javibbg6 »

Hi there,

I have been looking for an answer on how to do this, i've tried several things, but none of them worked for me.

I have a pdf, with blue background and white font colour. It's about 60 pages, and i want to print it, so it would be a total waste of ink. Here's just one page sample of it:
https://drive.google.com/open?id=1w4yDH ... QqIby6v4Gy

So, I want to do the following:
1. Change font colour to black
2. Change background colour to white.

What would be the correct syntax?

I thought on doing something like this:
convert input.pdf FROM "#ffffff" TO "#000000" result.pdf

But any other way is welcome.

Thanks in advance!

User avatar
fmw42
Posts: 26280
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: change PDF font & background colour

Post by fmw42 »

The syntax would be:

Code: Select all

convert input.pdf -alpha off -fuzz 10% -fill black -opaque white -fill white -opaque "rgb(7,25,58)" result.pdf
Note that ImageMagick uses Ghostscript to render PDF files as raster data. So you will lose all vector data in your new PDF. Adjust the fuzz value as desired. Add -density XXX before reading the input PDF for higher quality. Change convert to magick if using IM 7.

javibbg6
Posts: 2
Joined: 2020-01-17T04:13:38-07:00
Authentication code: 1152

Re: change PDF font & background colour

Post by javibbg6 »

Awesome!!

Thanks Mr/Mrs fmw42! It works perfectly!

Post Reply