This is part 2 of a mini-series on PDF.
Part 1 – PDF syntax and file structure
Part 2 – Fonts
Part 3 - Vector graphics
Part 4 - Interactive features
Part 5 - Metadata
Part 6 - Tagged PDF
Please note that all of these examples are created manually. If you wish to experiment with the examples, you can do so yourself. For more information, visit https://github.com/speedata/fixxref which provides a small program that supports manual PDF editing.
In the previous article in this series, I introduced the basic structure of a PDF file and how to create a PDF file using a text editor.
My goal in this post is to add some text to the PDF (using the included fonts). I should mention that you can find all the details in the PDF specification. There is one for 1.7 (recommended, very readable) and for 2.0 (register to download, few PDF viewers support 2.0 at the time of writing).
Writing text
For this introduction, I don’t want to complicate things. So I will use one of the PDF viewer’s built-in fonts, a so-called “standard 14” font. These are Courier, Courier-Bold, Courier-BoldOblique, Courier-Oblique, Helvetica, Helvetica-Bold, Helvetica-BoldOblique, Helvetica-Oblique, Symbol, Times-Bold, Times-BoldItalic, Times-Italic, Times-Roman, ZapfDingbats.