For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > November 2004 > Printing to printers on Win32









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Printing to printers on Win32
Johnny Google

2004-11-17, 3:58 pm

I want to see if I understand what is available here for printing a
report from a Tk app to a printer on a Win32 system.

1) I can use canvas->postrcipt() to create a postscript file of the
canvas. So, since I currently have a ROText widget for my report, can I
just make that widget an embedded window on a canvas parent and then be
able to use postcript as described? Or must I actually place the text
report onto the canvas?

2) How can I call the Win32 printer list to select the printer? Once
selected, can I send the text or the postscript conversion of the text
to that selected printer using a Tk (or perhaps a Win32) method?
Thanks,

John

Pit

2004-11-17, 3:58 pm

in Tk there is no module to select a printer.
the way is to transform the postscript file into a pdf-document with
ghostscript (ps2pdf) and print with the acrobat reader.

you also can use the modules Spreadsheet::WriteExcel or
Win32::OLE::Const 'Microsoft Excel' to create an excel-sheet and print
this with excel.

I use the second way, and it works fine

Pit


Johnny Google

2004-11-17, 3:58 pm

When you say you print with excel do you mean the user has to actually
launch Excel? Or can call the print command in Excel from the perl
module and then get the Printers Dialog box that you see when you
select print interactively?

Pit

2004-11-18, 8:57 am

in my application excel will be started by Win32::Process
the other possibility I've never tested

Pit

Shawn Zabel

2004-11-18, 8:57 pm

"Johnny Google" <john_pataki@yahoo.com> wrote in message
news:1100719497.337781.192940@c13g2000cwb.googlegroups.com...
> When you say you print with excel do you mean the user has to actually
> launch Excel? Or can call the print command in Excel from the perl
> module and then get the Printers Dialog box that you see when you
> select print interactively?
>



You could use the Win32::OLE module to open Excel in the background and
print the file to the default printer. The Excel application could be
completely hidden so the user never knows what's happening.

- Shawn



Slaven Rezic

2004-11-19, 8:58 am

"Johnny Google" <john_pataki@yahoo.com> wrote in message news:<1100709606.254484.120010@f14g2000cwb.googlegroups.com>...
> I want to see if I understand what is available here for printing a
> report from a Tk app to a printer on a Win32 system.
>
> 1) I can use canvas->postrcipt() to create a postscript file of the
> canvas. So, since I currently have a ROText widget for my report, can I
> just make that widget an embedded window on a canvas parent and then be
> able to use postcript as described? Or must I actually place the text
> report onto the canvas?


This works, at least on Unix. However, embedded widgets are handled by
taking
a snapshot of the widget, which means that the content show up as a
rasterized image. The quality would be probably worse than using
canvas text items.

Regards,
Slaven
sandor

2004-11-21, 3:58 am

You can use Win32::Printer to print "natively" from perl. It works
quite well. It is a wrapper around GDI. The docs are pretty good.
Take a look.
Pit

2004-11-29, 4:05 pm

Hi

I've tried to install the Win32-printer Module via ppm in ActivePerl
5.8.4.810.
the PPM says to me "Sucessfully installed Win32-Printer version 0.7 ", but
nothing will be downloaded.

Whats wrong ?

Pit

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com