Iterating over PDF documents

Just just at xs4all.nl
Thu Nov 11 04:46:12 EST 2004


In article <cmv9j2$et5$1 at swifty.westend.com>,
 Peter Maas <peter at somewhere.com> wrote:

> Hi,
> 
> I'm trying to edit a PDF document line-wise. This is more difficult
> than I thought, because PDF uses a mixture of all line terminators
> available in *X, Mac and Win so that utilizing "for line in file"
> is difficult. I tried universal newline but that spoils the document
> apparently. What other options do I have besides writing my own PDF
> line iterator?. All options have to be quick hacks as I have already
> invested some time in existing code and the deadline is approaching
> fast :)

try this:

   for line in open(path, "U"):  # universal newline mode
      ...

Just



More information about the Python-list mailing list