Using pkfix to fix (some) old TeX-generated PDF (PS) files
Here’s an arcane bit of knowledge that may be applicable sometimes: there is a tool called pkfix
that can be used to improve the rendering of certain old PostScript files.
(Will add more details later.)
Example 1
Original: https://cs.uwaterloo.ca/~shallit/Papers/change2.pdf = https://shreevatsa.net/post/2023-pkfix/change2.pdf
Fix:
wget "https://cs.uwaterloo.ca/~shallit/Papers/change2.ps"
pkfix change2.ps change2-fixed.ps
ps2pdf change2-fixed.ps
Result: https://shreevatsa.net/post/2023-pkfix/change2-fixed.pdf
Side-by-side, it looks like (open image in new tab and see at 100%):
Example 2
Compare https://courses.cs.duke.edu/spring02/cps296.1/papers/H-SIGMOD1999.pdf and https://shreevatsa.net/post/2022-pkfix-etc/tr-98-033_pkfix-helper_pkfix_pstopdf.pdf
Example 3
Compare https://web.archive.org/web/20160418212350/https://www.cs.uml.edu/ecg/pub/uploads/OPLspr09/genesis-of-lisp-jmc.pdf and http://slackwise.net/files/docs/The%20Roots%20of%20Lisp.pdf
More details
(WIP)
-
This is for ps files generated by dvips, using “Type 3” (bitmap) fonts.
-
May need to use
pkfix-helper
first. -
Read the documentation (and man page) for
pkfix
andpkfix-helper
. -
My own old blog post: https://shreevatsa.wordpress.com/2011/05/05/converting-old-ps-files-generated-with-latex-to-searchable-pdfs/
-
Some HN comments about
pkfix
: -
(2012-08) By user
dunham
here -
(2021-04) By user
dunham
https://news.ycombinator.com/item?id=26675469 again, explaining the issue.There exists a utility called pkfix that can fix this if you happen to have the original ps file, and it has the right comments from dvips.
There is a second utility called pkfix-helper that will try to guess and inject those comments based on the metrics (character sizes) of the fonts. But it can’t really match a lot of the symbol fonts that only pull a couple of characters.
-
(2021-04) By user
svat
(me) https://news.ycombinator.com/item?id=26858400 -
(2022-01) By user
svat
https://news.ycombinator.com/item?id=29868574 -
(2023-12) By user
svat
https://news.ycombinator.com/item?id=38666535