Notes on PDF

To convert a PDF file that has letter papersize to 9x6 papersize using gs, so that we can print it on

~~~{.sourceCode .bash} gs -o mmds-9x6.pdf -sDEVICE=pdfwrite -dDEVICEWIDTHPOINTS=674 -dDEVICEHEIGHTPOINTS=912 -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.4 mmds-book-embed.pdf}

Using `pkfix` before running `ps2pdf` will improve the final output---it replaces bitmap fonts with Type 1 fonts. Example:


If pkfix fails with Error: Missing comment %DVIPSParameters, use pkfix-helper first. That is

~~~{.bash} $ pkfix-helper $ pkfix $ ps2pdf paper-b.pdf ~~~~

PDF Tools


PDFmake – Client/server side PDF printing in pure JavaScript

Prawn – is a pure Ruby PDF generation library.

gem install prawn

require "prawn"

Prawn::Document.generate("hello.pdf") do
  text "Hello World!"

JsPDF is another nifty JS based PDF generator. See my DHT application using JsPDF.