in reply to pdf files print utility on Win32
package VK::Acrobat; use strict; use Win32::OLE qw(EVENTS); use Win32::OLE::Const; use Win32::OLE::Variant; use Cwd qw(cwd abs_path); use File::Basename; use File::Path; sub new { my $class = shift; # || SUPER::??????? как тут правильно? my $self = bless { # defaults verbose => 1, # some predefined (and overridable) constants 'ole-name' => 'AcroExch.App', 'ole-doc-name' => 'AcroExch.AVDoc', 'typelib-name'=>'Adobe Acrobat 5.0 Type Library', # some predefined constants true => Variant(VT_BOOL,1), false => Variant(VT_BOOL,0), # initial values #... # specified values @_, }, $class; my $acro = Win32::OLE->new($self->{'ole-name'}, sub { #print STDERR "quitting Acrobat...\n" if $self->{verbose}; ##$_[0]->Exit; #print STDERR "done.\n" if $self->{verbose}; }) or die "Can't init $self->{'ole-name'}; please re-install Acrobat +"; my $acrodoc = Win32::OLE->new($self->{'ole-doc-name'}, sub { #print STDERR "quitting Acrobat-doc...\n" if $self->{verbose}; #print STDERR "done.\n" if $self->{verbose}; }) or die "Can't init $self->{'ole-name'}; please re-install Acrobat +"; #$self->{OLEconst} = Win32::OLE::Const->Load($acro); $self->{OLEconst}->{true} = $self->{true} unless exists $self->{OLEc +onst}->{true}; $self->{OLEconst}->{false} = $self->{false} unless exists $self->{OL +Econst}->{false}; $self->{OLEconst} = Win32::OLE::Const->Load($self->{'typelib-name'}) +; $self->{warner} = sub { print STDERR "ACROBAT Warner: [[".(join '===',@_)."]]\n"; }; $self->{acro} = $acro; $self->{acrodoc} = $acrodoc; Win32::OLE->Option(Warn=>$self->{warner}); #Win32::OLE->WithEvents($self->{acro}, \&Event); return $self; } sub Event { my ($Obj,$Event,@Args) = @_; print "Event triggered: '$Event'\n"; } =ignore sub AUTOLOAD { print STDERR "AUTOLOAD:[[".(join "+",@_)."]]\n"; &SUPER::AUTOLOAD; } =cut 1;
Courage, the Cowardly Dog.
|
|---|