3

With vision difficulties, my grandpa can't read text whenever backgrounded by dark color in the PDF in the screenshot beneath. Click here to download it, or see some of its pages at Google Books. It's too unproductive to remove each use of the dark background color one-by-one. Thus how can I, in one brisk stroke?

I've Adobe Acrobat DC Pro, Foxit PhantomPDF, and Nitro Pro. Acrobat states no background to be removed. They and SensusAccess converted the PDF to a Word file's that's too deformed.

enter image description here

0
+50

Testing on your document, I think I have managed to find a method that gives good results (although not perfect).

This requires converting the PDF file to a Word document. The best convertor I found is Adobe Acrobat Pro which is a commercial product with a 7-day trial.

Convert to Word

  • Start Adobe Acrobat Pro
  • Open the PDF file,
  • Use the menu File > Export To > Microsoft Word > Word document to export the file to a .docx document

Convert to macro-enabled document

  • Open the .docx document in Word
  • Use the menu File > Save As
  • Choose a folder
  • Set "Save as type" to .docm
  • Click Save

Create and run the VBA macro

  • Open the .docm document in Word
  • Press Alt+F11 to open the VBA editor
  • In the Insert tab click Module
  • Copy the following VBA code into the window:

    Sub DoShapes()
    For Each shp In ActiveDocument.Shapes
      If shp.WrapFormat.Type = wdWrapFront Then shp.WrapFormat.Type = wdWrapBehind
      If shp.Width > 216 And shp.Type <> msoGroup And shp.Type <> msoLine Then shp.Fill.ForeColor.RGB = RGB(250, 250, 250)
    Next shp
    End Sub
    

    Note that the background color of the text to very light gray. This is because the colored background is used to designate quotes. If you want to make it all white, change in the above to RGB(255, 255, 255).

  • Click the green triangle to run this code (this will take some time)

  • When finished, save the file as .docx or as PDF.

I have uploaded the document after the above manipulations to this link for you to see. When the document is displayed, click the three-points (...) icon and choose Download. I will delete this link in a few days.

  • Did you directly open the PDF using Word? Or don't you have Word? – harrymc Jan 2 at 8:43
  • I have Word. When I open the PDF using Word, Word requires me to consent to a conversion that's more deformed than the other converters used (see my post). – Greek - Area 51 Proposal Jan 3 at 5:44
  • 1
    It didn't happen for my PDF, so seems dependent on the PDF itself. If you can somehow pass it over I might have a look. – harrymc Jan 3 at 7:01
  • Got it - you may cancel the download. Word 2016 didn't ask any questions, but the conversion was slow and a bit inexact, although readable. The procedure above takes care of the shading of text, which is some but not all of the cases. It fails to take care of cases where the text is inside a dummy table and the shading is a property of the table and not of the text. I'll be away until the weekend and will take it up then. – harrymc Jan 3 at 8:43
  • I have rewritten my answer. – harrymc Jan 6 at 19:32
0

It should be possible to use Inkscape to process the PDF to remove the coloured background using the scripting APIs to automate the task. Inkscape can only process one page at a time, but since you'd be automating this anyway this shouldn't be too much of a problem.

To make it as easy as possible, I'd import each page, replace all instances of fill-opacity:1; with fill-opacity:0;, and export it again. Works! Partial solution; font also needs to be changed to be properly legible.

I'll see if I can hack together an extension to do this, but it won't be today.

If you can open a single highlighted page of the document in Inkscape (ensure that you have the fonts added to the system and play around with the text import settings to get this to work!) then this approach will work for your particular documents.

This works for the document you have provided.

  • ' I'd import each page': Isn't this more unproductive, surprisingly, than deleting all the dark color in the PDF? – Greek - Area 51 Proposal Jan 7 at 5:26
  • @Greek-Area51Proposal The extension would do the importing and replacing and font changing. – wizzwizz4 Jan 7 at 9:52
  • Actually, this would have to be done partially by a shell script, and then a program to combine the PDF pages into a complete PDF again. PDF shuffler might serve this purpose. – wizzwizz4 Jan 7 at 10:28
0

Thanks so much for all the other answers! Yet I found this to be the most straightforward one that requires only basic knowledge of Adobe Acrobat, and doesn't require other programs.

-1

UPDATED:

NEW REPLY

In Acrobate Pro.

Go to "Tools" and open the "Print Production" pane.

Choose "Output preview".

Uncheck "PANTONE 302 C" or "Spot Plates" (either works)

Now read the PDF exactly as it is but without the blue background. Do this without closing the Output Preview box.

OFF

By having the Output Preview open you can toggle the background on and off when needed.

ON



OLD REPLY

I would suggest that you open the PDF in Acrobate pro and then save it as an HTML page.

It's more or less like this:

  • In Acrobate go to File menu and choose Save as and in sub menu go to More Options and choose HTML.
  • You can read the file in your normal web browser.

I Saved the file as HTML and uploaded it here.

http://www.mediafire.com/file/r8uqab29dep1186/Criminal_Law_%25282018_8_ed%2529_-_Copy.html/file

If I open this in my browser I find it very easy to read and scroll. You can search with ctrl+f and increase and decrease text size if needed with ctrl+/-

Most important: NO COLORED TEXT BACKGROUNDS!

Check it out and tell me what you think!

  • 1
    Thanks. The PDF can be downloaded at mediafire.com/file/1iil649lu2he1ij/…. Doesn't your answer face the same difficulties as superuser.com/a/1389220/269574? – Greek - Area 51 Proposal Jan 6 at 4:51
  • I saved the PDF as HTML and its actually really easy to read in my browser. Being able to increase/decrease size of text with ctrl+ and ctrl- also makes it much easier to enhance any text thats smaller then you like. All the colored backgrounds are extracted as images and are not shown as text background, but rather as an separate image not by the text. If you remove all the images from the folder that is created when you save it as HTML no dark background images are shown at all. This I would say is an excellent solution for anyone visually challenged. – Don King Jan 7 at 12:00
  • Answer has been updated – Don King Jan 7 at 12:50
  • Thanks, but the resulting HTML looks too deformed? Words are spaced wrongly: Chapter 1's title is "A N INT RODUC T ION TO CR I M I NA L L AW", under which Central Issue #1 is "An im- portant distinction is drawn between the criminal law". – Greek - Area 51 Proposal Jan 7 at 16:33
  • Yeah some odd spacing occurs on some titles. The reason for im- portant is that in the pdf the width of the text section is limited while in the html it is not. It is definitely not the best way of reading the book, but if you cant see the sections with a blue or grey background you have an alternative that is relatively easy to make. The general text is easy to read imo. 'Save as html' and 'open in browser' requires very little energy spent from the user so I figured it was a quick way of reading the 'before unreadable' sections. – Don King Jan 9 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.