develooper Front page | perl.wxperl.users | Postings from March 2013

Sending Documents to The Printer

From:
Mark Dootson
Date:
March 30, 2013 06:04
Subject:
Sending Documents to The Printer
Message ID:
51568027.1090407@znix.com
Hi,

I've been trawling Google for references to wxPdfDocument to check on 
general questions / development as I have not looked at it in a while. I 
found a post asking how to send a pdf file directly to the printer, 
rather than opening it.

If your operating system supports associating document types with 
commands for printing and opening, the following will work for any 
document file type.

my $mtm = Wx::MimeTypesManager->new();
if( my $filetype = $mtm->GetFileTypeFromExtension('pdf') ) {
     my $cmd = $filetype->GetPrintCommand($filepath);
     Wx::ExecuteCommand($cmd) if $cmd;
}


Hope it is useful.

Mark




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About