3 ms·
There is no protection; PDF is simply a complex format derived from Postscript, which has much more in common with programming languages than with any mere desc
by db48x 5y ago
There is no protection; PDF is simply a complex format derived from Postscript, which has much more in common with programming languages than with any mere description of where pixels should go on a page. This means that in principle you can write a PDF which no conversion tool or editor can allow you to edit (see also the halting problem). The most common example of this is probably the Postscript file that computes pi as it prints. The file doesn’t store the digits that it will print out, it computes them on the fly. Some of the more obvious forms of that complexity were removed from Postscript when the PDF format was designed, but then other forms of complexity were added back in (such as Javascript support!).
In practice, however, PDFs are usually created by readily available software which produces very regular PDFs that you can write converters for.
- triska 5y agoGood, 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.