Python, Perl & PDF files

R

rbt

Are there any plans in the near future to support PDF files in Python as
thoroughly and completely as Perl does?

http://cpan.uwinnipeg.ca/search?query=pdf&mode=dist

I love Python's clean syntax and ease of use, etc. But on some things
(PDF for example) as barbaric as Perl's syntax is, it does outshine
Python... I hate having to use Perl just to deal with PDF files. What do
others do???
 
M

Mike Meyer

rbt said:
Are there any plans in the near future to support PDF files in Python
as thoroughly and completely as Perl does?

http://cpan.uwinnipeg.ca/search?query=pdf&mode=dist

Claiming that CPAN represents Perl "supporting" something isn't really
accurate. Those are just third party libraries, not support in the
language. There is an extensive set of third party libraries available
for Python as well, but there's no central repository to make finding
them easy.

That said, you can check out both pdflib and reportlab. pdflib is a
library that includes bindings for python, and reportlab is a
python-coded library for generating PDF. Since you don't say what you
want to do with PDF, I can't tell you which, if either, of these will
do what you want.
I love Python's clean syntax and ease of use, etc. But on some things
(PDF for example) as barbaric as Perl's syntax is, it does outshine
Python... I hate having to use Perl just to deal with PDF files. What
do others do???

CPAN is a nice thing, and I'm sure that someone, somewhere, is working
on producing one for Python. Until it shows up, you have to learn to
search multiple places for third party libraries. Google works in this
case - the very first link on a search for "python pdf" is to an
article that talks about using reportlab with python.

<mike
 
C

Christos TZOTZIOY Georgiou

Are there any plans in the near future to support PDF files in Python as
thoroughly and completely as Perl does?

Before we let you know about our plans, what are *your* plans on this
subject? :) [0]
I love Python's clean syntax and ease of use, etc. But on some things
(PDF for example) as barbaric as Perl's syntax is, it does outshine
Python... I hate having to use Perl just to deal with PDF files.

There are two issues here: a) a language, b) its library. You imply
that the Perl syntax outshines Python's because it has _more thorough
and complete support for PDF_, as you say. I don't see a connection,
but rather I see a lure to provoke answers, which doesn't always work
for you. For example, my reply would be more helpful and to the point
if that reasoning was missing from your post.
What do others do???

Search google perhaps? Why do you feel that the first result of the
query "python pdf" does not help you?


[0] there's an ancient myth about a peasant's cart getting stuck in the
mud, so the peasant starts calling out for help from goddess Athena.
Another peasant passing by tells him: "Syn Athena kai kheira kinei",
which means, more or less, "keep on calling Athena, but start also using
your hands."
I don't know any related myth of anglo-saxon origin to quote.
 
R

rbt

Christos said:
Are there any plans in the near future to support PDF files in Python as
thoroughly and completely as Perl does?


Before we let you know about our plans, what are *your* plans on this
subject? :) [0]

I just want to read PDF files in a portable way (windows, linux, mac)
from within Python.
There are two issues here: a) a language, b) its library. You imply
that the Perl syntax outshines Python's because it has _more thorough
and complete support for PDF_, as you say. I don't see a connection,
but rather I see a lure to provoke answers

I do not seek to provoke. Sorry if my question comes across that way to you.
 
C

Christos TZOTZIOY Georgiou

I do not seek to provoke. Sorry if my question comes across that way to you.

Thanks for giving attention to my post, no need for apologies.

By the way, you didn't say in which way ReportLab and pdflib are not
helpful to you (packages suggested directly by Mike Meyer and indirectly
by me).
 
R

Robin Becker

rbt wrote:
.......
I just want to read PDF files in a portable way (windows, linux, mac)
from within Python.
.......

I suppose you mean extract PDF pages and do something with them.
http://www.reportlab.com does have a tool that handles that in Python. It's not
free though.

There are indeed a number of perl modules which do that and other modules which
allow you to overprint etc etc.

You can always hand translate one of the extract perl modules. They don't seem
that hard. Alternatively put a good case to (e-mail address removed).
 
A

Alex

rbt said:
I just want to read PDF files in a portable way (windows, linux, mac)
from within Python.


reportlab is an excelent tool for generating pdf files, but as far as I
know, it doesn't "read" pdf's.
http://www.reportlab.org/rl_toolkit.html

there's a project in sourceforge called pdf playground.
http://sourceforge.net/projects/pdfplayground

it's supposed to read/write pdf files..
I never tried it, you might want to check it out.

I don't think there's something like perl's pdf support on python.
but you can find tools and libs that might help.

regards,
Alex
 
D

Dennis Lee Bieber

[0] there's an ancient myth about a peasant's cart getting stuck in the
mud, so the peasant starts calling out for help from goddess Athena.
Another peasant passing by tells him: "Syn Athena kai kheira kinei",
which means, more or less, "keep on calling Athena, but start also using
your hands."
I don't know any related myth of anglo-saxon origin to quote.

The most commonly known phrasing would likely be "God only helps
those who help themselves".

--
 
R

Robin Becker

Dennis Lee Bieber wrote:
........
The most commonly known phrasing would likely be "God only helps
those who help themselves".
Of course for politicians and others with troughed snouts it should read "God
punish those that help themselves", never seems to work out in practice though :(

-guzzling-ly yrs-
Robin Becker
 
P

Peter Hansen

Dennis said:
The most commonly known phrasing would likely be "God only helps
those who help themselves".

Google suggests that removing the word "only" produces a
phrase many times more commonly known...

-Peter
 
P

Peter Hansen

Peter said:
Google suggests that removing the word "only" produces a
phrase many times more commonly known...

And very interesting reading (to spawn another diversion
typical to c.l.p), such as the third link in Google
titled "Vessel of Honour: ..." (content available only
via the "Cached" link), which points out that this
biblical-sounding phrase was never in the bible,
but actually comes *from Greek mythology*, and specifically
(it claims) from the same story as Christos has
quoted, except that the "god" in question was Hercules
and other details differ somewhat...

Of course, the very next link then claims that it was
in fact the great god himself, Benjamin Franklin, who
gave us this phrase...

No doubt this is right up there with the origins of
"may you leave in interesting times". :)

-Peter
 
R

rbt

Peter said:
And very interesting reading (to spawn another diversion
typical to c.l.p)

OK, I'm seeking to provoke now... why don't you go hijack some other
thread?

OK, I'm done seeking to provoke. So, it's official. Perl has *much*,
*much* better support for dealing with PDF files than does Python.
Hopefully that'll change one day soon. If I had the programming
knowledge, I'd get on it right away, but alas I do not so I cannot ;)

Thanks to all who responded on topic.
 
M

Michael Hoffman

Christos said:
[0] there's an ancient myth about a peasant's cart getting stuck in the
mud, so the peasant starts calling out for help from goddess Athena.
Another peasant passing by tells him: "Syn Athena kai kheira kinei",
which means, more or less, "keep on calling Athena, but start also using
your hands."
I don't know any related myth of anglo-saxon origin to quote.

A man prays to God, very hard for a winning lottery ticket. He tells God
that he will use most of the money to do good works. Some he will use to
make life better for his family. He keeps praying and praying. He never
wins the lottery.

One day he is so angry, he goes to church and rants and raves to God
about not winning the lottery. Finally God comes and says to him "You
have to buy a ticket my son, for me to help you."
 
D

Dennis Lee Bieber

One day he is so angry, he goes to church and rants and raves to God
about not winning the lottery. Finally God comes and says to him "You
have to buy a ticket my son, for me to help you."

Well, at least that doesn't have the... finality... of the one
about the woman and the flood... Cutting most of the set-up noise, this
one essentially runs:

Flood waters rising severely, woman climbs out onto roof of
home, and prays to be saved. Various rafts, boats, (modernized)
helicopters come by offering to take her off. She turns them all down
saying God will save her...

Pearly Gates scene: woman asks God why he didn't save her. His
response "I sent rafts, boats, and helicopters to you; you didn't take
them"

--
 
C

Christos TZOTZIOY Georgiou

And very interesting reading (to spawn another diversion
typical to c.l.p), such as the third link in Google
titled "Vessel of Honour: ..." (content available only
via the "Cached" link), which points out that this
biblical-sounding phrase was never in the bible,
but actually comes *from Greek mythology*, and specifically
(it claims) from the same story as Christos has
quoted, except that the "god" in question was Hercules
and other details differ somewhat...

It seems that I mixed two myths (I should pay more attention probably to
mythology lessons at primary school :). The fable with Hercules is the
correct one, as far as a cart and mud is concerned. The one about
Athena and arm-motion, is that Aesop's fable:

http://www.mythfolklore.net/aesopica/oxford/480.htm

Now there's another phrase, "the smart bird gets caught by the beak",
and I don't know if I'm a smart bird, but my nose is big...
 
D

davidb

Robin said:
rbt wrote:
......
......

I suppose you mean extract PDF pages and do something with them.
http://www.reportlab.com does have a tool that handles that in
Python.
It's not free though.

I imagine that you pay for a reasonable level of support.
There are indeed a number of perl modules which do that and other
modules which allow you to overprint etc etc.

You can always hand translate one of the extract perl modules. They
don't seem that hard. Alternatively put a good case to
(e-mail address removed).

Before embarking on that route, it might be worth looking at this page:

http://phaseit.net/claird/comp.text.pdf/PDF_converters.html

There's a link to a (surprisingly recent) snapshot of my own package,
that can be used to read some PDF files, and another highly
recommended module. In the interests of balance, if not completeness,
I should also mention PDF Playground which has better support for
reading and writing PDF files:

http://sourceforge.net/projects/pdfplayground/

Maybe this should also be listed on the above resources page. Cameron?
Are you reading this? ;-)

David
 
R

rbt

I imagine that you pay for a reasonable level of support.




Before embarking on that route, it might be worth looking at this page:

http://phaseit.net/claird/comp.text.pdf/PDF_converters.html

There's a link to a (surprisingly recent) snapshot of my own package,
that can be used to read some PDF files, and another highly
recommended module. In the interests of balance, if not completeness,
I should also mention PDF Playground which has better support for
reading and writing PDF files:

http://sourceforge.net/projects/pdfplayground/

Maybe this should also be listed on the above resources page. Cameron?
Are you reading this? ;-)

David

Thanks David. I'll see what these tools can do for me. Wouldn't you
agree that it would be in Python's interest to have a standard way in
which it handles (reads, writes, etc) PDF files on multiple platforms?
It'd would *really* help me... I hate using Barbaric Perl scripts just
to deal with PDF files, but if I must, I must.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,237
Messages
2,571,189
Members
47,823
Latest member
eipamiri

Latest Threads

Top