kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:
Hello all
I'm using the following code to print PDF using my network printer. But the problem is that I need to Install Adobe Reader 6 to achieve my task. Is there any workaround that I can print PDF's by having acrobat reader version 6.0 or more
Or any Perl modules which prints the PDF's with any version of Acrobat installed ....
use strict; use warnings; use Win32::OLE; use Win32::OLE::Const "Acrobat"; my $acrobat = Win32::OLE->new("AcroExch.App", "Quit"); my $avdoc = Win32::OLE->new("AcroExch.AVDoc"); my $pdfs = getPDF("/from/some/folder"); foreach my $pdf( @{$pdfs} ) { $avdoc->Open( $pdf, "" ); my $pddoc = Win32::OLE->new("AcroExch.PDDoc"); $pddoc->Open($pdf); my $pp = $pddoc->GetNumPages; #index starts at 0 my $totalpages = $pp; if ( $pp ) { $pp--; } eval { print "Printing $pdf with $totalpages pages\n"; $avdoc->PrintPagesSilent(0,$pp,1,1,0); }; if ( $@ ) { print "PDF did not print due to Adobe error.\n"; } $acrobat->Exit; }
Thanks to original author for giving me a pointer to help achieve my task
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Print PDF using Win32::OLE and Acrobat Reader
by ww (Archbishop) on Feb 23, 2010 at 13:43 UTC | |
|
Re: Print PDF using Win32::OLE and Acrobat Reader
by molecules (Monk) on Feb 23, 2010 at 14:37 UTC | |
by kalyanrajsista (Scribe) on Feb 24, 2010 at 06:22 UTC |