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?
1 Answer
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):
And the second set is taken from the same regions from the fixed PDF file (as generated, see above):
-
12
-
8
-
2Very nice answer! In the event that only a PDF is available, I'm wondering if you think anything can be done?– TylerJun 25, 2013 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. Jun 25, 2013 at 23:43
pdflatex
orxelatex
. 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.pkfix
wouldn't help.