Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Printing file with printer dialog

Reply
Thread Tools

Printing file with printer dialog

 
 
Marco Bonifazi
Guest
Posts: n/a
 
      10-25-2006
Hello!

I have a file (in my situation it is a Postscript file or a Pdf file,
but it isn't important).

I must send this file to a printer, using Python, and I need to select
the printer to which I want send this file.
Then I would use a Dialog Window.

I use PyGtk on Windows (but if I can open a dialog without PyGtk is
also good), I would know all methods to do it.

Thanks also if you don't answer!

Marco Bonifazi

http://www.bonifazi.eu

 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      10-25-2006
On 25 Oct 2006 09:32:06 -0700, "Marco Bonifazi"
<(E-Mail Removed)> declaimed the following in comp.lang.python:

> Hello!
>
> I have a file (in my situation it is a Postscript file or a Pdf file,
> but it isn't important).
>

Au contraire (pardon the slaughtered French)

On Windows, most files need to be printed by an application that can
render the file contents as bitmap pages. You might be able to send a
raw Postscript file to a Postscript aware printer, but unless the
printer also understands PDF syntax, you will probably have to invoke
Acrobat Reader to print it -- or some other program that can read and
render PDF.

>>> import subprocess
>>> x = subprocess.Popen([r"c:\Program Files\Adobe\Acrobat 7.0\Reader\acrord32.exe",

.... "/p", "aprs101.pdf"])
>>>


Is sufficient (on my machine) to have Acrobat Reader's print dialog
appear -- though one must then physically select the printer (if the
default is not desired) and activate the actual "print". It also has the
drawback of leaving a minimized Reader in the task bar.

> I must send this file to a printer, using Python, and I need to select
> the printer to which I want send this file.
> Then I would use a Dialog Window.
>
> I use PyGtk on Windows (but if I can open a dialog without PyGtk is
> also good), I would know all methods to do it.
>


In general though, I suspect you'll need to study the win32print
module in the Windows extensions -- and by the time you've gone that
far, you might find some way to activate the win32 common dialogs
without needing PyGtk.

>>> import win32print
>>> for p in win32print.EnumPrinters(win32print.PRINTER_ENUM_LO CAL, None, 1):

.... print p
....
(8388608, 'ScanSoft PDF Create!,ScanSoft PDF Create!,', 'ScanSoft PDF
Create!', '')
(8388608, 'Procomm Plus 32 Fax,Procomm Plus Fax Driver,', 'Procomm Plus
32 Fax', '')
(8388608, 'Intuit Internal Printer,Amyuni PDF Converter 2.07,Virtual',
'Intuit Internal Printer', 'Print to File!')
(8388608, 'hp deskjet 6122 series,hp deskjet 6122 series,', 'hp deskjet
6122 series', '')
(8388608, 'Fax,Microsoft Shared Fax Driver,', 'Fax', '')
(8388608, 'ESP 960 Color Managed,EPSON Stylus Photo 960,', 'ESP 960
Color Managed', '')
(8388608, 'EPSON Stylus Photo 960,EPSON Stylus Photo 960,Back of Rack',
'EPSON Stylus Photo 960', 'Look at all the pretty pictures')
>>>

--
Wulfraed Dennis Lee Bieber KD6MOG
http://www.velocityreviews.com/forums/(E-Mail Removed) (E-Mail Removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (E-Mail Removed))
HTTP://www.bestiaria.com/
 
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
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 2 11-27-2010 12:12 PM
brochure printing,online yearbook,printing,books printing,publishing elie Computer Support 0 08-21-2007 05:52 AM
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