Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #189

Re: Why ps2pdf can even fix pdf files?

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: Why ps2pdf can even fix pdf files?
Date 2011-05-04 18:01 +0100
Message-ID <MPG.282b96b0f8afe1ae98983c@usenet.plus.net> (permalink)
References <9f23a9cc-118f-492c-bf90-0c1304071de0@r33g2000prh.googlegroups.com>

Show all headers | View raw


In article <9f23a9cc-118f-492c-bf90-0c1304071de0
@r33g2000prh.googlegroups.com>, pengyu.ut@gmail.com says...

> However, if I run ps2pdf on it which generate a new pdf. This new pdf
> will not have the problem. I'm wondering how come ps2pdf can even fix
> pdf files even though it is designed for converting from ps to pdf
> files.

ps2pdf uses the Ghostscript pdfwrite device to *create* a new PDF file. 
Although ps2pdf implies that it can only accept PostScript in fact 
pdfwrite can be used with any PDL which the interpreter supports. The 
GhostPDL suite includes interpreters for PostScript, PDF, PCL, XPS and 
(limited support) SVG.

The interpreter reads the ionput, interprets it into a series of 
graphics operations, and pdfwrite rewrites those graphics operations in 
PDF syntac.

So the reason it can fix your file is that the Ghostscript PDF 
interpreter can read many types of broken PDF files, and pdfwrite always 
creates a brand new file from scratch, so it isn't fixing it, its making 
a new one.

 
> This brings to another question: whether ps2pdf can (or can be
> modified to) fix pdf files with other problems?

If Ghostscript can read your PDF file, pdfwrite should be able to write 
it.

 
> The following pdf has ^Z for '(' and ')'. (If you make an pdf index in
> acrobat, and search some text using the index, you will see ^Z). Is
> there a way to fix this pdf file by replacing ^Z with '(' or ')' with
> ps2pdf?

Basically, no. While this can be done it means altering the Encoding of 
the font as well as changing the character code in the PDF content 
stream, which would be non-trivial to do. Also, how is the application 
supposed to know that ^Z is a left bracket ? In another file it might be 
something quite different....



			Ken

Back to comp.lang.postscript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Why ps2pdf can even fix pdf files? Peng  Yu <pengyu.ut@gmail.com> - 2011-05-04 09:35 -0700
  Re: Why ps2pdf can even fix pdf files? ken <ken@spamcop.net> - 2011-05-04 18:01 +0100
  Re: Why ps2pdf can even fix pdf files? bonomi@host122.r-bonomi.com (Robert Bonomi) - 2011-05-06 13:51 -0500

csiph-web