4 ms·
Good, post! One caveat though: Regarded as a programming language, PDF is much less powerful than PostScript, because in contrast to PostScript, PDF is not Turi
by triska 5y ago
Good, post! One caveat though: Regarded as a programming language, PDF is much less powerful than PostScript, because in contrast to PostScript, PDF is not Turing-complete: PDF lacks looping constructs, conditionals etc. that are necessary to implement general programs. Even a comparatively simple calculation such as dynamically approximating π which you mention cannot be expressed in PDF.
Quoting from the PDF language reference:
"Unlike PostScript, however, PDF is not a full-scale programming language; it trades reduced flexibility for improved efficiency and predictability."
The PDF language reference is available from: https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/pdf_reference_archives/PDFReference.pdf https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/pd...
Every file that conforms to this specification is a PDF file. One can easily construct or adapt such a file and let it display any content one wants.
PostScript is technically and aesthetically superior in almost every way to PDF: It is human readable, it can express arbitrary computations, it allows incremental dynamic updates and can therefore be used to visualize simple animations via instructions read from a stream, its fonts can be described with the same language constructs as entire documents etc.
One of the reasons one may prefer to use PDF instead of PostScript is the support for transparency that PDF provides.
- db48x 5y agoYes, although I did not mention them specifically, loops and conditionals were removed to make PDF a tamer format. However that isn’t really enough. PDF doesn’t do line wrapping, so most programs create paragraphs by positioning individual lines of text on the page. There’s nothing stopping you from positioning individual words instead, or individual characters. Indeed, that may be necessary in order to achieve certain effects such as full justification of paragraphs, hand–tuned kerning, or mathematical notation. The individual lines, words, or characters do not even need to be in the correct order within the PDF. This means that in order for a converter to reconstruct the original paragraph it must position each piece of text correctly and then derive the original linear arrangement of characters from their positions on the page.