6

(Edit: Somehow an addition I made to this question got lost before I pressed the bounty button. Apologies to whoever already answered partially.)

I occasionally come across old(ish) papers written in LaTeX, from around 20-25 years ago, such as:

  • this one: Made into a PDF with Aladdin GhostScript; so probably it was tex->dvi->ps->pdf or something like that.
  • this one: tex->dvi->ps->pdf , using dvips and then Acrobat Distiller 3.01 for Windows

Anyway, the on-screen legibility with several PDF readers I've tried is usually poor. Is it possible to reprocess the file somehow so as to improve it?

Specifically, is it possible to...

  1. Manipulate/massage the bitmap fonts to improve its readability?
  2. Determine which fonts (families, weights, sizes) are used - assuming it's one of the more commonly-used fonts and not something esoteric - and replace the bitmap font glyphs with scalable, hintend font glyphs?
  3. Extract the text of words/lines and re-typeset it using a more legible font?

Of course, if the authors are reachable and have the sources, you could just get them and rebuild (well, sort of); but let's assume this is not an option and we only have the PDF to work with.


Here's some more information regarding the fonts in the two example files:

$ pdffonts P29.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
[none]                               Type 3            Custom           yes no  no     173  0
[none]                               Type 3            Custom           yes no  no     166  0
Courier                              Type 1            Standard         no  no  no     471  0
Courier                              Type 1            Standard         no  no  no     470  0
Helvetica                            Type 1            Standard         no  no  no     122  0
[none]                               Type 3            Custom           yes no  no     123  0

$ pdffonts ng.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
[none]                               Type 3            Custom           yes no  no       4  0
[none]                               Type 3            Custom           yes no  no       5  0
[none]                               Type 3            Custom           yes no  no       6  0
[none]                               Type 3            Custom           yes no  no       7  0
[none]                               Type 3            Custom           yes no  no       8  0
[none]                               Type 3            Custom           yes no  no       9  0
Helvetica-Bold                       Type 1            Standard         no  no  no      15  0
Times-Bold                           Type 1            Standard         no  no  no      16  0
Times-Italic                         Type 1            Standard         no  no  no      17  0
Times-BoldItalic                     Type 1            Standard         no  no  no      18  0
[none]                               Type 3            Custom           yes no  no      22  0
[none]                               Type 3            Custom           yes no  no      23  0
[none]                               Type 3            Custom           yes no  no      24  0
[none]                               Type 3            Custom           yes no  no      28  0
[none]                               Type 3            Custom           yes no  no      29  0
Times-Roman                          Type 1            Custom           no  no  no      52  0
Times-Italic                         Type 1            Custom           no  no  no      53  0
Times-BoldItalic                     Type 1            Custom           no  no  no      54  0
[none]                               Type 3            Custom           yes no  no      55  0
  • 1
    sorry yes I noticed you'd linked to the pdf and was getting the same. sort of odd collection, it's the type3 (bitmap) fonts that are the issue but they are oddly nameless subsetted ones, used in conjunction with helvetica and courier, not the expected tex bitmap fonts (for which you could have tried to substitute equivalent type1) so not sure you can do much. – David Carlisle Feb 24 '18 at 20:30
  • 3
    however possibly more useful is that the pdf also has the email of the author which google suggests is still current you could just ask if the document is available in a newer format.. – David Carlisle Feb 24 '18 at 20:38
  • 1
    BTW if you print it out it may look fine. (Often the problem with bitmap fonts isn't so much their resolution itself, but the fact that they don't come with any hinting information for screen… on a printer there's enough resolution that things look better.) – ShreevatsaR Feb 24 '18 at 21:45
  • 3
    no, the problem with bitmap fonts is that they work best at the exact resolution they are designed for (eg a 300dpi laser printer) but on screen the viewer has to sample the bitmaps to the resolution and zoom that you are using, so you get all sorts of artifacts (although some viewers are better at sampling than others) – David Carlisle Feb 24 '18 at 22:02
  • 1
    @einpoklum No, that's not good enough actually. You're overestimating the number of pixels available on a typical screen at a typical zoom level, the amount of allowable distortion before a typical human eye detects differences etc. If you simply interpolate each pixel using its surroundings, you just get blurry text. There is decades of work on text rendering; it's not so simple. Note BTW that on your screen you have far fewer pixels than the 300 dpi or whatever the font assumed (print resolution is higher), so the problem on screen is how to render a pixel based on many pixels of the font. – ShreevatsaR Feb 24 '18 at 22:49
1
+100

I took the first page of the document. I opened it in Preview on macOS. I took a screen snapshot of that page without the page number. I created a new document in Preview using the screen snapshot. I saved the document as a PDF. I uploaded the PDF to GDrive. I used Google Docs to open the file. I opened the Google Docs file and printed it back to PDF. Here is an image of the results.

image of results page

This is a quick and dirty effort. The column ordering is lost. I imagine that significant improvements are possible to avoid this problem by paying closer attention to the snapshot (i.e. take one column at a time) and/or by using a professional-level application. To that end, I tried using PDFElement 6 Pro on the source PDF and its printed PDF copy. The conversion caught ONLY the page number. A fee is needed to test the OCR option of the app (and Google provided the conversion for free for a proof of concept).

I hope this demonstration of a quick and dirty effort to improve the readability of fonts in an "old" document provides enough satisfaction to suggest it as a viable answer.

In short, it is possible. Absent the .tex file, the trick is to run an OCR on an image of the document to re-convert the fonts to today's standards.

  • OCR, eh? Hmm. Interesting. It's too "costly" for me to lose the document structure and the less- or not-OCR'able material in the paper, but I suppose this could be a basis for a solution. I mean, if we were to somehow take the textual regions, OCR them (including inline LaTeX formulae), and render them back into the same location. But at the moment, what you suggest improves one aspect of readability at the expense of all others :-( Also - no need to update your answer due to the edit. – einpoklum Aug 29 '18 at 7:35
  • With a document that has two columns and math, OCR may cost more than one is willing to spend in time or expense. The fix that I see is that it erases issues of sloppy line-justification that make reading difficult. I suspect that no other approach will handle this problem. I am curious whether a commercial OCR package can render text "back to the same location" (i.e. in a two-column layout). As for math, tools exist to convert hand-written math to MathJaX/LaTeX. In any case, perhaps a scan of the document at 600dpi+ can afford at least better resolution the fonts than the raw PDF. – Jeffrey J Weimer Aug 29 '18 at 13:11
  • If memory serves me correctly, This was happening with commercial OCR (I think Adboe's) over 15 years ago, and you could get MS-Word documents with different frames on the page where the text was supposed to be. – einpoklum Aug 29 '18 at 17:47
  • So, you got the bounty. As you already know, I'm hoping for something beyond your suggestion - so I'm not accepting the answer - but it's certainly something, and you made the effort, so thanks again and enjoy your 25% reputation boost :-) – einpoklum Sep 4 '18 at 13:56
  • I'm also curious whether a something else is possible. One might hope for an app that would for example swap the fonts in the PDF directly. In any case, the bounty is appreciated. :-) !! – Jeffrey J Weimer Sep 4 '18 at 14:48

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.