54

Some research papers available on the web have low-quality outputs. For example, see this. It seems that it was converted from a PS file and typeset in (La)TeX. However, it has all the font information. Is there any way to make the PDF file clearer?

  • 2
    The generic answer is "Yes". Find the source and typeset it directly in PDF using pdflatex or xelatex. Could be a bit more clear about the requirement here? What sources are you allowed to use or have access to? If this is purely about making the linked post "more clear", it would have be redone entirely since PDF is a binary format from which you cannot extract TeX code. There might be conversion tools, as mentioned in How to convert PDF to (La)TeX? and Converting a PDF document to PostScript/LaTeX. – Werner Jun 20 '13 at 18:46
  • 1
    Looks rather old. Even if you had the postscript version of the paper, things like pkfix wouldn't help. – Alex Jun 20 '13 at 19:02
75

1. Download PostScript output (dvips output)

Try to get the PostScript version, at least the cached version seems to work.

The file was generated with dvips with bitmap fonts. Therefore the "poor" quality.

2. Analyzing PostScript file

At the top of the page we find:

%%Creator: dvips 5.47 Copyright 1986-91 Radical Eye Software

That is too old for pkfix. That needs the font comments, written by version 5.58 or later. If there are font comments like

%DVIPSBitmapFont: Fa cmr7 7 6

then you can skip step 3. and can go straight to 4.

3. Preparing PostScript with pkfix-helper for pkfix

Thus it is a job for pkfix-helper that tries to identify the fonts with a heuristics (character boxes) and writes the missing font comments into the PostScript file for pkfix.

$ pkfix-helper crt.ps crt-helper.ps

finds:

Reading crt.ps ... done.
Number of Type 3 fonts encountered in included documents: 0
Total number of Type 3 fonts encountered: 21
pkfix-helper: Could not determine the target printer resolution; assuming 300 DPI
Finding character widths ... done.
Reading TFM files ... done (103 TFMs in 193 scaling variations).
Matching fonts:
    Processing Fp ... done (cmr10 @ 1X, mismatch=0.49957).
    Processing Fq ... done (cmr9 @ 1X, mismatch=0.27830).
    Processing Fi ... done (cmbx10 @ 1X, mismatch=0.34628).
    Processing Fo ... done (cmti10 @ 1X, mismatch=0.17562).
    Processing Fe ... done (cmr7 @ 1X, mismatch=0.40178).
    Processing Fr ... done (cmssbx10 @ 1X, mismatch=0.24687).
    Processing Fl ... done (cmmi10 @ 1X, mismatch=0.23339).
    Processing Fn ... done (cmr10 @ 1X, mismatch=0.24939).
    Processing Fm ... done (cmsy10 @ 1X, mismatch=0.13897).
    Processing Fg ... done (cmti9 @ 1X, mismatch=0.15207).
    Processing Fj ... done (cmmi7 @ 1X, mismatch=0.08061).
    Processing Fs ... done (cmss10 @ 1.2X, mismatch=0.25618).
    Processing Fb ... done (cmbx7 @ 1X, mismatch=0.06942).
    Processing Ft ... done (cmbx12 @ 1.2X, mismatch=5.94738).
pkfix-helper: Best match for Ft is rather poor
    Processing Fa ... done (cmr7 @ 1X, mismatch=0.07234).
    Processing Fh ... done (cmsy7 @ 1X, mismatch=0.01447).
    Processing Fc ... done (cmmi5 @ 1X, mismatch=0.00759).
    Processing Fd ... done (lasy10 @ 1X, mismatch=0.00005).
    Processing Ff ... done (cmex8 @ 1X, mismatch=0.00482).
    Processing Fk ... done (cmex10 @ 1X, mismatch=0.00181).
    Processing Fu ... done (cmbxti12 @ 2.0733X, mismatch=43.70349).
pkfix-helper: Best match for Fu is rather poor

Taken the warnings seriously, font Ft and Fu should to be excluded. It is better to have a bitmap font than the wrong font.

$ pkfix-helper -k Fu -k Ft crt.ps crt-helper.ps
Reading crt.ps ... done.
Number of Type 3 fonts encountered in included documents: 0
Total number of Type 3 fonts encountered: 21
pkfix-helper: Could not determine the target printer resolution; assuming 300 DPI
Finding character widths ... done.
Reading TFM files ... done (103 TFMs in 193 scaling variations).
Matching fonts:
    Processing Fp ... done (cmr10 @ 1X, mismatch=0.49957).
    Processing Fq ... done (cmr9 @ 1X, mismatch=0.27830).
    Processing Fi ... done (cmbx10 @ 1X, mismatch=0.34628).
    Processing Fo ... done (cmti10 @ 1X, mismatch=0.17562).
    Processing Fe ... done (cmr7 @ 1X, mismatch=0.40178).
    Processing Fr ... done (cmssbx10 @ 1X, mismatch=0.24687).
    Processing Fl ... done (cmmi10 @ 1X, mismatch=0.23339).
    Processing Fn ... done (cmr10 @ 1X, mismatch=0.24939).
    Processing Fm ... done (cmsy10 @ 1X, mismatch=0.13897).
    Processing Fg ... done (cmti9 @ 1X, mismatch=0.15207).
    Processing Fj ... done (cmmi7 @ 1X, mismatch=0.08061).
    Processing Fs ... done (cmss10 @ 1.2X, mismatch=0.25618).
    Processing Fb ... done (cmbx7 @ 1X, mismatch=0.06942).
    Retaining Ft as a bitmapped font.
    Processing Fa ... done (cmr7 @ 1X, mismatch=0.07234).
    Processing Fh ... done (cmsy7 @ 1X, mismatch=0.01447).
    Processing Fc ... done (cmmi5 @ 1X, mismatch=0.00759).
    Processing Fd ... done (lasy10 @ 1X, mismatch=0.00005).
    Processing Ff ... done (cmex8 @ 1X, mismatch=0.00482).
    Processing Fk ... done (cmex10 @ 1X, mismatch=0.00181).
    Retaining Fu as a bitmapped font.

4. Convert bitmap to vector fonts with pkfix

The the file crt-helper.ps is now processed with pkfix:

$ pkfix crt-helper.ps crt-fixed.ps
PKFIX 1.7, 2012/04/18 - Copyright (c) 2001, 2005, 2007, 2009, 2011, 2012 by Heiko Oberdiek.
*** Font conversion: `cmr7' -> `CMR7'.
*** Font conversion: `cmbx7' -> `CMBX7'.
*** Font conversion: `cmmi5' -> `CMMI5'.
*** Font conversion: `lasy10' -> `LASY10'.
*** Font conversion: `cmr7' -> `CMR7'.
*** Font conversion: `cmex8' -> `CMEX8'.
*** Font conversion: `cmti9' -> `CMTI9'.
*** Font conversion: `cmsy7' -> `CMSY7'.
*** Font conversion: `cmbx10' -> `CMBX10'.
*** Font conversion: `cmmi7' -> `CMMI7'.
*** Font conversion: `cmex10' -> `CMEX10'.
*** Font conversion: `cmmi10' -> `CMMI10'.
*** Font conversion: `cmsy10' -> `CMSY10'.
*** Font conversion: `cmr10' -> `CMR10'.
*** Font conversion: `cmti10' -> `CMTI10'.
*** Font conversion: `cmr10' -> `CMR10'.
*** Font conversion: `cmr9' -> `CMR9'.
*** Font conversion: `cmssbx10' -> `CMSSBX10'.
*** Font conversion: `cmss10' -> `CMSS10'.
*** Merging font `CMR7' (2).
*** Merging font `CMR10' (2).
==> 19 converted fonts.
==> 2 merged fonts.

5. Conversion to PDF

And the resulting PS is converted to PDF:

$ ps2pdf crt-fixed.ps

6. Check the fonts of the PDF file

The PDF mainly contains Type 1 (vector) fonts:

$ pdffonts crt-fixed.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
EXRKAF+CMR10                         Type 1C           Custom           yes yes no      31  0
XYBRJB+CMR9                          Type 1C           Custom           yes yes no      29  0
AIEJHE+CMSSBX10                      Type 1C           WinAnsi          yes yes no      27  0
VRVPVC+CMSS10                        Type 1C           WinAnsi          yes yes no      25  0
[none]                               Type 3            Custom           yes no  no      17  0
[none]                               Type 3            Custom           yes no  no       9  0
ECQATD+CMTI10                        Type 1C           Custom           yes yes no      38  0
GUCXJN+CMMI7                         Type 1C           Custom           yes yes no      46  0
QSBVLU+CMEX10                        Type 1C           Custom           yes yes no      44  0
KLJBVV+CMMI10                        Type 1C           Custom           yes yes no      42  0
WMLJNK+CMSY10                        Type 1C           Custom           yes yes yes     40  0
NXXIQZ+CMTI9                         Type 1C           WinAnsi          yes yes no      57  0
GWEEWQ+CMSY7                         Type 1C           Custom           yes yes yes     55  0
VSMLLB+CMBX10                        Type 1C           Custom           yes yes no      53  0
IQGMWX+LASY10                        Type 1C           Custom           yes yes yes     73  0
TOJKBS+CMR7                          Type 1C           Custom           yes yes no      71  0
OTLROK+CMEX8                         Type 1C           Custom           yes yes no      69  0
Times-Roman                          Type 1            Standard         no  no  no     120  0
MQZZBQ+CMBX7                         Type 1C           WinAnsi          yes yes no     133  0
GROEMQ+CMMI5                         Type 1C           WinAnsi          yes yes no     131  0

Caution: Do not forget to check the visual appearance, too. The heuristics of pkfix-helper might have found a wrong font, something might not be recognized by pkfix, there are bugs in some of the programs, or …

Comparison

As requested two sets of two screen shots of AR9/Linux with 200% and 650% magnification. The first set comes from the original PDF file (as cached version):

screen shot of crt.pdf

equations of crt.pdf

And the second set is taken from the same regions from the fixed PDF file (as generated, see above):

screen shot of crt-fixed.pdf

equations of crt-fixed.pdf

  • 12
    Shut up and take my money! – Soner Gönül Jun 21 '13 at 8:45
  • 8
    I suspect witchcraft. – Cam McLeman Jun 25 '13 at 22:16
  • 2
    Very nice answer! In the event that only a PDF is available, I'm wondering if you think anything can be done? – Tyler Jun 25 '13 at 22:43
  • 4
    @Tyler: I have some doubts that someone has written something in that direction. The parsing of PDF is more laborious. More or less easy accessible are the widths of the characters more ore less rounded. The heights might be extractable from the glyph descriptions. The encoding is not too clear. And the font cannot be directly identified. There are no comments about the font names and the embedded bitmap fonts are quite nameless. Thus a heuristic would be needed to guess the fonts. – Heiko Oberdiek Jun 25 '13 at 23:43

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.