Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, they don’t. That’s like saying PNG files can contain postscript code because tools exist that convert postscript to .png.

The basic drawing operations in postscript and PDF are the same, but that’s about it.

An important difference between PDF and Postscript is that PDF isn’t Turing complete (1). Benefits of that are that, for example, you can determine how many pages are in a .pdf without rendering it in full.

Disadvantage for drawing fractals is that PDF doesn’t have a notion of looping or recursion. That postscript program to draw a fractal can, at render time, check the resolution of the output device and then decide how deep to recurse. A PDF file has to decide at file creation time, and has to contain every single drawing command, so it will be larger (I don’t remember PDF internals well enough to be sure about the latter. It may be possible to avoid the latter a bit by redrawing scaled parts of a drawing)

(1) possibly ignoring various extensions such as its embedded JavaScript interpreter (http://www.planetpdf.com/developer/article.asp?ContentID=662...). I would think/hope those can’t generate PDF content, but haven’t checked.



>> PDFs can, and typically do, contain postscript.

> No, they don’t. That’s like saying PNG files can contain postscript code because tools exist that convert postscript to .png.

It's clear you know the difference between PS and PDF, so don't you think your straw man example is a bit exaggerated? PDF is originally based on PS, and it has 1:1 correspondence for almost all it's rendering features with PS. PNG is completely different, since it's a raster format, it doesn't share any drawing operations with PS.

You could have offered a gentle nitpick that PDF is interpreted PS rather than source PS, but claiming @pletnes' comment is completely wrong, when it isn't, makes your comment seem both unnecessarily snarky and somewhat off base, FWIW.

"PDF contains tokenized and interpreted results of the PostScript source code, for direct correspondence between changes to items in the PDF page description and changes to the resulting page appearance."

https://en.m.wikipedia.org/wiki/PDF


As far as the graphics output is concerned, PDF is strict superset of PostScript.

In fact the "PDF page description language" is PostScript constrained to only drawing operations which have somewhat extended semantics, as PDF drawing model does Porter-Duff composition while PS does not.

In all, when you rewrite any piece of PS code delimited by /showpage into shortest PS reprasentation without control structures you get valid PDF representation of exactly same final page image.


Yes, they can, and the postscript portions are even stored in plain text for you to edit, unless you tell whatever pdf compilation tool you're using to encrypt the entire document. There is no conversion unless you're using a poorly written PDF compiler.

(this also makes your analogy pretty weak - it's more like "having a PNG include a bitmap image", in addition to all the other data it can contain)

of course, most _readers_ will ignore raw postscript because the PDF format is intended for print documents and having an insanely complex code instruction that draws "a picture" is crazy inefficient compared to just including the vector graphic (not the bitmap graphic, that would be quite dumb) that the postscript program is supposed to yield.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: