Re: PDF count pages
Andreas Lobinger wrote:
>
> Jose Benito Gonzalez Lopez wrote:
> > Does anyone know how I could do in order
> > to get/count the number of pages of a PDF file?
>
> Like this ?
[...]
> >>> import pdffile
> >>> pf = pdffile.pdffile('../rfc1950.pdf')
> >>> import pages
> >>> pp = pages.pages(pf)
> >>> len(pp.pagelist)
[...]
That's interesting. Here's my equivalent example:
Python 2.3.3 (#1, May 2 2004, 15:04:07)
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pdftools import pdffile
>>> doc = pdffile.PDFDocument("PDFSPEC.pdf")
>>> doc.count_pages()
518
The API shown above is from an unreleased version of pdftools
(http://www.boddie.org.uk/david/Projects/Python/pdftools/).
> This is an example of the usage of pdfplayground. pdfplayground
> is available via sourceforge. There is no package at the
> moment, but you should be able to check out via anon-cvs.
I browsed the code in CVS and it looks like a pretty comprehensive
implementation. Maybe we should join forces.
David
--
http://mail.python.org/mailman/listinfo/python-list
Re: PDF count pages
Andreas Lobinger wrote:
>
> Jose Benito Gonzalez Lopez wrote:
> > Does anyone know how I could do in order
> > to get/count the number of pages of a PDF file?
>
> Like this ?
[...]
> >>> import pdffile
> >>> pf = pdffile.pdffile('../rfc1950.pdf')
> >>> import pages
> >>> pp = pages.pages(pf)
> >>> len(pp.pagelist)
[...]
That's interesting. Here's my equivalent example:
Python 2.3.3 (#1, May 2 2004, 15:04:07)
[GCC 3.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pdftools import pdffile
>>> doc = pdffile.PDFDocument("PDFSPEC.pdf")
>>> doc.count_pages()
518
The API shown above is from an unreleased version of pdftools
(http://www.boddie.org.uk/david/Projects/Python/pdftools/).
> This is an example of the usage of pdfplayground. pdfplayground
> is available via sourceforge. There is no package at the
> moment, but you should be able to check out via anon-cvs.
I browsed the code in CVS and it looks like a pretty comprehensive
implementation. Maybe we should join forces.
David
--
http://mail.python.org/mailman/listinfo/python-list
Re: Python, Perl & PDF files
Robin Becker wrote: > 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. 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 > [EMAIL PROTECTED] 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 -- http://mail.python.org/mailman/listinfo/python-list
Re: scripting browsers from Python
Michele Simionato wrote: > I would like to know what is available for scripting browsers from > Python. > For instance, webbrowser.open let me to perform GET requests, but I > would like to do POST requests too. I don't want to use urllib to > emulate a browser, I am interested in checking that browser X really > works as intended with my application. Any suggestion? For Konqueror running on KDE, you can use DCOP to control the browser. There are a couple of different, but related, Python modules that you can use to do this. See the following page for more information: http://developer.kde.org/language-bindings/python/ I believe this approach has been used quite successfully with other KDE applications: http://www.kde-apps.org/content/show.php?content=18638 You should still be able to automate the browser with just popen2 and the "dcop" command line tool if you are really desperate. I once had to resort to this ad-hoc approach in the distant past but, these days, I'd recommend one of the above modules instead. David -- http://mail.python.org/mailman/listinfo/python-list
