0

I am preparing for exams and have found some very good resources for myself but they have one issue. All the answers are written right under each question in red ink. I'd like to print these out and do them by hand but that's not going to work if the answers are right under each question.

I could theoretically manually remove them by editing the pdfs but this is just not feasible for ~200 pages worth of questions.

I'm looking for some sort of script or automation that will turn all red text white to make it invisible or just straight up remove it, whichever works.

To make things more complicated, there are pages with multiple choice questions. Over here the correct answer is written in red text. This is where I'll need the code or automation to turn red text into black text.

Of course I don't mind separating out the MCQs to run a different code on them and recombining the pdf together, I just want to quickly remove all the answers.

I tried to use photoshop to select the colour red and turn it white and while it works well it has some major problems that makes it useless.

  • The change doesn't apply to all pages
  • All pages become separate PNGs making it a pain to recover the pdf again

The two problems above make it useless for me trying to do this for ~200 pages

I'd appreciate any and all help with this!

5
  • If you don't find a software solution you like, you could print this on red paper. Commented Aug 22, 2023 at 7:36
  • 1
    @KJ you can buy red printing paper. Probably cheaper in toner. Commented Aug 22, 2023 at 14:23
  • If it is RGB(255,0,0) then if you can figure out a way to print (or print-to-pdf) only the red channel, that could work: it would be greyscale with anything RGB(255,0,0) becoming white. The multiple choice, try printing only the G or B channel. There might be a subtle grey difference you can see though. Exactly how depends on the software. If it isnt a perfect red, then if you do what @kj suggested (matching the page to the red value) this could still work and make readability better (it would be a light grey)
    – Yorik
    Commented Aug 22, 2023 at 16:28
  • its not binary, it is a float. Easily converted: see for example stackoverflow.com/questions/53674869/…
    – Yorik
    Commented Aug 22, 2023 at 18:21
  • You say pedantic, I say moving the goalposts when you are wrong. The numeric representation that you provide is a float data type. Before you dig any further, I will note I specified a color using a common RGB notation for specificity in a basic explanation of why the red text in a red channel would appear white or light grey. I made no representation that that exact quoted color was either the expected representation in a PDF document nor indeed what might be expected as a chosen color value by the PDF maker.
    – Yorik
    Commented Aug 22, 2023 at 18:31

1 Answer 1

0

One suggestion is set the background for REaDing to match the undesired colour.

SumatraPDF-prerel.exe -set-color-range #000000 #f00b0a pdfoutput.pdf

enter image description here

The problem with single colours in a PDF is there are more than hundreds of ways they can be defined.

Take this non text example where red is ÿ if you remove all those there would be no other colours https://docs.google.com/viewer?url=https://github.com/GitHubRulesOK/MyNotes/raw/master/colours.pdf&embedded=true

%PDF-1.3
1 0 obj<</Type/Catalog/Pages 2 0 R>>endobj
2 0 obj<</Type/Pages/Count 1/Kids[3 0 R]>>endobj
3 0 obj<</Type/Page/MediaBox[0 0 72 72]/Rotate 0/Resources 4 0 R/Contents 5 0 R/Parent 2 0 R>>endobj
4 0 obj<</XObject<</Img3 6 0 R>>>>endobj
5 0 obj<</Length 46>>
stream
1 0 0 -1 -0 72 cm 72 0 0 -72 0 72 cm /Img3 Do
endstream
endobj
6 0 obj<</Length 27/Type/XObject/Subtype/Image/Width 3/Height 3/BitsPerComponent 8/ColorSpace/DeviceRGB>>
stream
ÿ   ÿ   ÿ ÿÿÿ ÿÿÿ    ÿÿÿ   
endstream
endobj

xref
0 7
0000000000 00001 f
0000000010 00000 n
0000000054 00000 n
0000000104 00000 n
0000000206 00000 n
0000000248 00000 n
0000000341 00000 n

trailer
<</Size 7/Root 1 0 R>>
startxref
502
%%EOF

For text it is different strokes as text has inner and outer colours (it is monocoloured outline and fill) so in some simpler cases you may find /C [1 0 0] and easily change that but what about /C [0.99 0.01 0.01] or what about CMYK [0 0.96 0.91 0] or CMYB(0%, 100%, 100%, 0%)

Thus convert to 16 colour images and filter out the redder components is perhaps easiest pixel method ?

The most common of all methods is the colour is pre set in the PDF as part of the page stream like this enter image description here if we use SED on the file as seen when decompressed we can set that to white like this
enter image description here

NOTE the white text is still readable above on an off white background but if the background is red it disappears fully. (unless you search for it like hell).

enter image description here

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .