4 ms·
I've always found it amusing from a "bootstrapping" perspective that the PDF spec is itself a PDF. That said, if you're only writing and not reading existing o
by userbinator 5y ago
I've always found it amusing from a "bootstrapping" perspective that the PDF spec is itself a PDF.
That said, if you're only writing and not reading existing ones, it's as straightforward or as complex as you want to make it. I wrote a little program many years ago to convert plaintext to PDF in <1kLoC of C --- and its output was actually often many times smaller than what the commercial PDF-generators do, because I just used the defaults and bare-minimum necessary. I wrote it after being confronted with a requirement to use PDF, and the output of contemporary generators seemed rather bloated in comparison. The spec has an example of a bare-minimum; it's quite easy to programmatically generate.
- WalterBright 5y agoPlease make your code available on github!
- whitten 5y agoThe plain text to PDF is easy if you use defaults for the font, and how many words and characters are per line, exclude control characters, exclude Unicode, most of the fancy stuff like letterheads, or such.
- gettalong 5y agoJust make sure that you follow the spec. Many such programs actually leave out mandatory parts of some objects, making the whole PDF invalid.