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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|