|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Sample Application to load Adobe Acrobat ActiveX controlThis is my response to a query on perlmonks. It loads the default Adobe Acrobat ActiveX viewer in a Win32::GUI window via a file open menu. I used the Notepad.pl and GetOpenFileName.pl files for my base app.
#!perl -w use strict; use warnings; use Win32::GUI 1.06 qw(CW_USEDEFAULT); use Win32::GUI::AxWindow; # Define the application menu my @menu_defn = ( "File" => "File", ">OpenPDf" => { -name => "OpenPDF", -onClick => \&OpenPDF}, ">Exit" => { -name => "Exit", -onClick => \&QuitFile }, ); my $menu = Win32::GUI::Menu->new(@menu_defn); #Define the application window my $mw = Win32::GUI::Window->new( -title => "Open PDF File", -size => [400,400], -left => CW_USEDEFAULT, -menu => $menu, -onResize => \&resize, -onTerminate => \&QuitFile, ); # Add a Acrobat AxtiveX control my $PDFControl = new Win32::GUI::AxWindow ( -parent => $mw, -name => "PDFControl", -control => "AcroPDF.PDF.1", -pos => [0, 0], -size => [400, 400], ); #Show application window $mw->Show(); #Enter event loop Win32::GUI::Dialog(); #Hide windows on exit $mw->Hide(); undef $mw; exit(0); #Open standard windows file open dialog box sub OpenPDF { my ( @file, $file ); my ( @parms ); push @parms, -filter => [ 'PDF - Adobe Acrobat File', '*.pdf', ], -directory => "c:\\", -title => 'Select a PDF file'; @file = Win32::GUI::GetOpenFileName ( @parms ); # print "PDF File: $file[ 0 ]\n"; # Call Acorbat LoadFile Method $PDFControl->CallMethod("LoadFile", $file[ 0 ]); return 0; } #resize to fit user input sub resize { my ($self) = @_; my ($width, $height) = ($self->GetClientRect())[2..3]; $self->PDFControl->Resize($width+1, $height+1) if exists $self->{PDFControl}; } #Exit the application sub QuitFile { my $self = shift; #Set the Acrobat control to nothing $PDFControl->CallMethod("LoadFile", ""); #This line is needed to keep the PERL interperter from crashing $PDFControl->Release(); return -1; } |
|
|
Re: Sample Application to load Adobe Acrobat ActiveX controlHi,
Can you please tell me where from I can get Win32::GUI 1.06? I have the Theoryx repository set in ppm, but the latest available version is 1.03 there. I have also tried to compile Win32::GUI using the cpan shell (I have VS6) but as usually, it gave some compiling errors that I don't know how to solve. Thank you. Octavian ----- Original Message ----- From: "rpnoble" <rpnoble@...> To: <perl-win32-gui-users@...> Sent: Saturday, July 05, 2008 8:40 PM Subject: [perl-win32-gui-users] Sample Application to load Adobe Acrobat ActiveX control > > This is my response to a query on perlmonks. It loads the default Adobe > Acrobat ActiveX viewer in a Win32::GUI window via a file open menu. I used > the Notepad.pl and GetOpenFileName.pl files for my base app. > > #!perl -w > > use strict; > use warnings; > use Win32::GUI 1.06 qw(CW_USEDEFAULT); > use Win32::GUI::AxWindow; > > # Define the application menu > my @menu_defn = ( > "File" => "File", > ">OpenPDf" => { -name => "OpenPDF", -onClick => \&OpenPDF}, > ">Exit" => { -name => "Exit", -onClick => \&QuitFile }, > ); > > my $menu = Win32::GUI::Menu->new(@menu_defn); > > > #Define the application window > my $mw = Win32::GUI::Window->new( > -title => "Open PDF File", > -size => [400,400], > -left => CW_USEDEFAULT, > -menu => $menu, > -onResize => \&resize, > -onTerminate => \&QuitFile, > ); > > # Add a Acrobat AxtiveX control > my $PDFControl = new Win32::GUI::AxWindow ( > -parent => $mw, > -name => "PDFControl", > -control => "AcroPDF.PDF.1", > -pos => [0, 0], > -size => [400, 400], > ); > > #Show application window > $mw->Show(); > > #Enter event loop > Win32::GUI::Dialog(); > > #Hide windows on exit > $mw->Hide(); > undef $mw; > exit(0); > > > #Open standard windows file open dialog box > sub OpenPDF { > my ( @file, $file ); > my ( @parms ); > push @parms, > -filter => > [ 'PDF - Adobe Acrobat File', '*.pdf', > ], > -directory => "c:\\", > -title => 'Select a PDF file'; > @file = Win32::GUI::GetOpenFileName ( @parms ); > # print "PDF File: $file[ 0 ]\n"; > > # Call Acorbat LoadFile Method > $PDFControl->CallMethod("LoadFile", $file[ 0 ]); > > return 0; > } > > #resize to fit user input > sub resize { > my ($self) = @_; > my ($width, $height) = ($self->GetClientRect())[2..3]; > $self->PDFControl->Resize($width+1, $height+1) if exists > $self->{PDFControl}; > } > > > #Exit the application > sub QuitFile { > > my $self = shift; > > #Set the Acrobat control to nothing > $PDFControl->CallMethod("LoadFile", ""); > > #This line is needed to keep the PERL interperter from crashing > $PDFControl->Release(); > > return -1; > } > > -- > View this message in context: > http://www.nabble.com/Sample-Application-to-load-Adobe-Acrobat-ActiveX-control-tp18294501p18294501.html > Sent from the perl-win32-gui-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ |
|
|
Re: Sample Application to load Adobe Acrobat ActiveX controlI use the following PPM
http://www.bribes.org/perl/ppmdir.html
|
|
|
Re: Sample Application to load Adobe Acrobat ActiveX controlthanks for this rpnoble - i was looking for an example a long time ago. appreciate your sharing.
|
|
|
Re: Sample Application to load Adobe Acrobat ActiveX controlOn Sat, 05 Jul 2008, Octavian Rasnita wrote:
> Can you please tell me where from I can get Win32::GUI 1.06? > > I have the Theoryx repository set in ppm, but the latest available > version is 1.03 there. I have also tried to compile Win32::GUI using > the cpan shell (I have VS6) but as usually, it gave some compiling > errors that I don't know how to solve. You can download Win32::GUI 1.06 for both 5.8 and 5.10 from the new beta PPM repositories: http://ppm.activestate.com/beta/ These repositories are still beta, so please report any problems with them to the ppm mailing list, or to ActiveState support. Cheers, -Jan ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/ |
| Free Forum Powered by Nabble | Forum Help |