Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > PDF Printing support from Python

Reply
Thread Tools

PDF Printing support from Python

 
 
dcrespo
Guest
Posts: n/a
 
      04-22-2005
Hi all... Is there a way to print a PDF file directly from Python
without having Acrobat installed? I know about ReportLab. It's a python
module that lets you create almost any PDF document, but I still don't
know if it supports printing, so I'm looking for a Python module that
could do it. I want to print a PDF file just like if I were doing it
from Acrobat.

Daniel.

 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      04-22-2005
On 2005-04-22, dcrespo <(E-Mail Removed)> wrote:

> Hi all... Is there a way to print a PDF file directly from
> Python without having Acrobat installed?


Assuming your printing system was setup competently:

os.system("lpr %s" % filename)

> I know about ReportLab. It's a python module that lets you
> create almost any PDF document, but I still don't know if it
> supports printing, so I'm looking for a Python module that
> could do it. I want to print a PDF file just like if I were
> doing it from Acrobat.


Not sure what you mean by "just like if I were doing it from
Acrobat".

--
Grant Edwards grante Yow! I have seen these
at EGG EXTENDERS in my
visi.com Supermarket... I have read
theINSTRUCTIONS...
 
Reply With Quote
 
 
 
 
dcrespo
Guest
Posts: n/a
 
      04-22-2005
Hi Grant Edwards...

Your solution requires a previous installation of Acrobat. Internally,
the OS is sending the pdf file to the Acrobat PDF Driver and then it is
sent to the printer. So you have to have Acrobat installed. Don't you?
I want to avoid it installing a module that could do it (maybe I'm
dreaming ). If there's no solution, then I will be very sad :-S

This is what exactly I need to do:
Generate an invoice of 216cm width and 93cm height (1/3 of the height
of a letter paper size), and print it respecting these dimensions. So,
when I print this page on a dot matrix printer, it stops at those 93cm
of height for continuous printing.

What I tried:
I created a pdf file manually with these dimensions, and right-click on
the pdf file, and selected "print". It just work under Windows XP with
Acrobat Reader 7.0, but I want to do it from a Win98 as well.
Unfortunately, there's no Acrobat version under Win98 (the maximun is
5.1) that supports this kind of printing (what I had seen until now).
It prints, but the all paper at letter size

Any help? Any other tools? Any one like Cristal Report but for Python?
I heard that wxPython supports some kind of reporting, but I don't know
it. Anyone knows?

Daniel

 
Reply With Quote
 
Harry George
Guest
Posts: n/a
 
      04-22-2005
"dcrespo" <(E-Mail Removed)> writes:

> Hi Grant Edwards...
>
> Your solution requires a previous installation of Acrobat. Internally,
> the OS is sending the pdf file to the Acrobat PDF Driver and then it is
> sent to the printer. So you have to have Acrobat installed. Don't you?
> I want to avoid it installing a module that could do it (maybe I'm
> dreaming ). If there's no solution, then I will be very sad :-S
>
> This is what exactly I need to do:
> Generate an invoice of 216cm width and 93cm height (1/3 of the height
> of a letter paper size), and print it respecting these dimensions. So,
> when I print this page on a dot matrix printer, it stops at those 93cm
> of height for continuous printing.
>
> What I tried:
> I created a pdf file manually with these dimensions, and right-click on
> the pdf file, and selected "print". It just work under Windows XP with
> Acrobat Reader 7.0, but I want to do it from a Win98 as well.
> Unfortunately, there's no Acrobat version under Win98 (the maximun is
> 5.1) that supports this kind of printing (what I had seen until now).
> It prints, but the all paper at letter size
>
> Any help? Any other tools? Any one like Cristal Report but for Python?
> I heard that wxPython supports some kind of reporting, but I don't know
> it. Anyone knows?
>
> Daniel
>



When you say "OS", are you talking MS Windows by any chance? On *NIX
(e.g., CUPS+ghostview+foomatic), PDF printing is not via Adobe code.

You could also consider pdf2ps, pdftops, and XPDF.


--
http://www.velocityreviews.com/forums/(E-Mail Removed)
6-6M21 BCA CompArch Design Engineering
Phone: (425) 294-4718
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a
 
      04-22-2005
On 2005-04-22, dcrespo <(E-Mail Removed)> wrote:

> Your solution requires a previous installation of Acrobat.


Probably not. Most printing systems I'm familiar with use
ghostscript to render PDF into either postscript (the case on
my machines at home) or whatever raster format the printer
desires (the case at my office).

> Internally, the OS is sending the pdf file to the Acrobat PDF
> Driver and then it is sent to the printer.


Nope. It's usnig the foomatic print filters which in turn use
ghostscript to render PDF.

> So you have to have Acrobat installed. Don't you?


No you just need a good printing system. CUPS + foomatic works
great for me. It knows what to do with postcript, text, PDF,
dvi, and a whole boatload of other fileformats that I don't
ever use.

> I want to avoid it installing a module that could do it (maybe
> I'm dreaming ). If there's no solution, then I will be very
> sad :-S
>
> This is what exactly I need to do: Generate an invoice of
> 216cm width and 93cm height (1/3 of the height of a letter
> paper size), and print it respecting these dimensions. So,
> when I print this page on a dot matrix printer, it stops at
> those 93cm of height for continuous printing.
>
> What I tried: I created a pdf file manually with these
> dimensions, and right-click on the pdf file, and selected
> "print". It just work under Windows XP with Acrobat Reader
> 7.0, but I want to do it from a Win98 as well.


Ah. You're using Windows. I didn't know that. I've no clue
what to do under Windows.

--
Grant Edwards grante Yow! .. someone in DAYTON,
at Ohio is selling USED
visi.com CARPETS to a SERBO-CROATIAN
 
Reply With Quote
 
Peter Herndon
Guest
Posts: n/a
 
      04-22-2005
Grant's example is not for Windows, Daniel, but it does illustrate a
certain principle: if you have a printer driver that understands PDF,
or some other external software such as Acrobat Reader that understands
PDF, then printing the PDF is as simple as telling the OS to just print
the file.

If you are looking for some software that acts as a PDF-understanding
interpreter, that must run under Windows 98, I don't know of any
written in Python. However, you might want to research some of the
available non-Python utilities. Ghostscript, for example, is available
at http://www.cs.wisc.edu/~ghost/ and has a version for Win32. You
could easily use Python to drive GhostScript.

Does that fit your needs?

---Peter

 
Reply With Quote
 
John J. Lee
Guest
Posts: n/a
 
      04-22-2005
"dcrespo" <(E-Mail Removed)> writes:

> Hi Grant Edwards...
>
> Your solution requires a previous installation of Acrobat. Internally,
> the OS is sending the pdf file to the Acrobat PDF Driver and then it is
> sent to the printer. So you have to have Acrobat installed. Don't you?
> I want to avoid it installing a module that could do it (maybe I'm
> dreaming ). If there's no solution, then I will be very sad :-S

[...]
> Acrobat Reader 7.0, but I want to do it from a Win98 as well.
> Unfortunately, there's no Acrobat version under Win98 (the maximun is
> 5.1) that supports this kind of printing (what I had seen until now).
> It prints, but the all paper at letter size


That doesn't sound like a fundamental problem with AR 5.1 to me --
sounds like you just need to ask it more nicely

Have you tried the latest version of APFL ghostscript, though (8.51)?


> Any help? Any other tools? Any one like Cristal Report but for Python?
> I heard that wxPython supports some kind of reporting, but I don't know
> it. Anyone knows?


First, decide what qualities you need from your output format, then
decide which format you want, and how to generate and print it. Is it
important that you have one, other, or both of bitmap or vector
output, for example?


John
 
Reply With Quote
 
dcrespo
Guest
Posts: n/a
 
      04-22-2005
Thanks a lot... I'm attemping to give it a try

 
Reply With Quote
 
dcrespo
Guest
Posts: n/a
 
      04-22-2005
> That doesn't sound like a fundamental problem with AR 5.1 to me --
sounds like you just need to ask it more nicely

AR 7.0 has the function to print exactly the page size you set. AR 5.1
doesn't. Instead, it print it on an existing page size like letter, but
without changing the relative layout of the each line of text respect
each other.

Daniel

 
Reply With Quote
 
dcrespo
Guest
Posts: n/a
 
      04-22-2005
>> Your solution requires a previous installation of Acrobat.

> Probably not. Most printing systems I'm familiar with use
> ghostscript to render PDF into either postscript (the case on
> my machines at home) or whatever raster format the printer
> desires (the case at my office).


Acrobat (windows) and Ghostscript are PDF drivers.

>> Internally, the OS is sending the pdf file to the Acrobat PDF
>> Driver and then it is sent to the printer.


> Nope. It's usnig the foomatic print filters which in turn use
> ghostscript to render PDF.


What I mean is that the pdf file is sent to a pdf driver (some program
to interpret it)... In your case is ghostscript, and in my case is
Acrobat.

> No you just need a good printing system. CUPS + foomatic works
> great for me. It knows what to do with postcript, text, PDF,
> dvi, and a whole boatload of other fileformats that I don't
> ever use.


CUPS + foomatic are the whole megadriver... So it's just a manner of
saying PDF Driver for my study case.

Really thanks for all the information I didn't know about
Ghostscript.

Daniel

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:50 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:28 AM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-18-2007 10:11 AM



Advertisments