Convert all text's color in PDF to black while ensuring text is selectable

1k views Asked by At

Looking for ways to change the color of all text in a PDF to black using an open-source command-line tool (or package) while ensuring that text is rendered as text.

Thanks to some answers on SO, found a command to convert the PDF to grayscale.

gs -o op.pdf -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -f ../ColorTest.pdf

Input PDF: enter image description here

Output PDF: enter image description here

PDF Sample here

However, the requirement is for the text to be black.

Any detailed steps or pointers on how this can be accomplished would be highly appreciated.

1

There are 1 answers

1
focog77269 On
cpdf -blacktext ColorTest.pdf -o out.pdf