"Matt Garrish" <> wrote in message
news:6EEJc.26179$ ...
>
> Acrobat supports all of the OLE automation methods
> listed in this chapter.
>
> The Acrobat Reader does not support OLE automation.
>
>
> For more info: http://partners.adobe.com/asn/acrobat/docs/iacovr.pdf
>
Success! Here is the code that opens up and prints a PDF using Win32::OLE
and Acrobat Exchange (v5.0.5 is the version I have). Thanks for the link to
Acrobat Exchange's OLE Objects and Methods. Too bad that Acrobat Reader
doesn't support OLE automation - I'm sure more people could have benefited
from this.
######################
#!perl
use strict;
use warnings;
use diagnostics;
use Win32::OLE;
use Win32::OLE::Const "Acrobat";
our $g_file_input = shift @ARGV;
die "Usage: $0 filename\n" unless $g_file_input;
sub process_main {
my $acrobat = Win32::OLE->new("AcroExch.App", "Quit");
my $avdoc = Win32::OLE->new("AcroExch.AVDoc");
$avdoc->Open( $g_file_input, "" );
my $pddoc = Win32::OLE->new("AcroExch.PDDoc");
$pddoc->Open( $g_file_input);
my $pp = $pddoc->GetNumPages; #index starts at 0
if ( $pp ) {
$pp--;
}
print "Num pages: $pp\n";
$avdoc->PrintPagesSilent(0,$pp,1,1,0);
$acrobat->Exit;
}
sub main {
print "PDF program\n";
&process_main();
print "Ending now\n";
}
&main();
exit 0;