5 ms·
PDFs can, and typically do, contain postscript. Ps2pdf is one «compiler» you could use.
by pletnes 9y ago
PDFs can, and typically do, contain postscript. Ps2pdf is one «compiler» you could use.
- waynecochran 9y agoYep. But I am not sure what value PDF's add to PS.
- jlg23 9y agoBread and butter for developers who have to handle them ;)
- waynecochran 9y agoPDF is "bread and butter"? There is no fundamental reason why PDF's should be easier to process -- in fact, PS files are far more transparent being simple text files (also capable of holding binary data as well).
- jlg23 9y agoPDFs are hell to process, pretty much like all formats developed by Adobe that evolved through multiple versions... Edit: I wrote parsers for PDF and PSD in CL years ago and still cringe when remembering that ordeal.
- dfox 9y agoPDF is also plain text file, with one slight caveat that PDF page index contains byte offsets into the file. [Edit: this observation should probably be taken as relative to various other "plain-text with byte offsets as decimal ASCII number" I have seen, with PDF being the most sane from the set of such formats I've seen, with Netscape/Mozilla Mork beeing the most insane]
- derrasterpunkt 9y agoPDF is interpreted PostScript. It is not a programming language as PostScript is. Edit: PostScript has to be interpreted and rendered, PDF only has to rendered. You can't jump to page 100 in a PostScript if you haven't interpreted page 1 to 99 before. A PDF can do that.
- waynecochran 9y agoPDF is interpreted too -- actually a subset of PS -- in fact you can write programs that work in PostScript that PDF will not handle in the same transparent way. The PS2PDF translator will have to render those pieces ahead of time -- in PS, the printer can render/interpret the code in a way that is optimal for the printer. That's why I used it. Still, advantage PostScript.
- derrasterpunkt 9y agoYou cannot write programs in PDF. As I have written, it is not a programming language. It is already interpreted. For your use-case a PostScript file is better, that's why you used it. But most of the time all graphics for a given page are prerendered and therefore static. If all page content is vector based you can render a PDF in every resolution you need. In my little printing world I like to have control over the page, I don't like that the printer (RIP) can control the page "in a way that is optimal for the printer". I am responsible for the output, not the printer. If something goes wrong inside the RIP, the printer doesn't pay the damages, I am. And things can get costly. It is also pretty resource intensive to work with PS (because it has to be interpreted every time you want to have a look at it). All things considered (and there are a lot more differences) it is simply more pleasant to work with PDF instead of PS. That's why the majority uses it. But it definitely has flaws, too.
- fjsolwmv 9y agoDumb printer drivers don't print hundreds of pages of source when you send a PDF to print. If you went to college in the 1990s you might remember begging for printer fee refunds.
- agumonkey 9y agoYou can read interviews of Adobe's John Warnock about PDF http://www.eprg.org/G53DOC/pdfs/tsr_warnock.pdf http://www.eprg.org/G53DOC/pdfs/tsr_warnock.pdf PDF today might be a monstrosity, but I remember simple reasons for its creation. postscript is turing complete, and less a document. It's like having html replaced by javascript calls to dom.append(<expr>) everywhere. you have to evaluate the whole source to be able to know the actual output, PDF mitigate this by giving static structure (pages etc) so that a program can find its way out of the box. Allowing for showing the page N only, quickly. Such things.
- Someone 9y agoNo, 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=6622 http://www.planetpdf.com/developer/article.asp?ContentID=662...). I would think/hope those can’t generate PDF content, but haven’t checked.
- dfox 9y agoAs 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.
- TheRealPomax 9y agoYes, 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.