Skip Menu |

This queue is for tickets about the CAM-PDF CPAN distribution.

Report information
The Basics
Id: 120793
Status: open
Priority: 0/
Queue: CAM-PDF

People
Owner: Nobody in particular
Requestors: abrahmia [...] physics.rutgers.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: rt.cpan.org #120773
Date: Wed, 29 Mar 2017 18:15:29 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
It works fine if the pdf file is loaded internally like my $file = "C:/path/file.pf"; But it fails when you load it using the Tk interface like: my $file= $mw->getOpenFile(-filetypes => \@whatever); This problem does not happen with PDF::API3 module.
On Wed Mar 29 14:15:52 2017, abrahmia@physics.rutgers.edu wrote: Show quoted text
> It works fine if the pdf file is loaded internally like > my $file = "C:/path/file.pf"; > > But it fails when you load it using the Tk interface like: > my $file= $mw->getOpenFile(-filetypes => \@whatever); > > This problem does not happen with PDF::API3 module.
It’s a little hard to go on that. Could you provide a complete script (but as small as possible) that demonstrates the problem?
Subject: RE: [rt.cpan.org #120793] rt.cpan.org #120773
Date: Thu, 30 Mar 2017 00:09:00 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
Apparently the module is not able to read pdf files generated by Microsoft Word (that's the only one I tested). Here is the script: #!/usr/bin/perl -w use Tk; use strict; use CAM::PDF; # Create necessary widgets my $mw = new MainWindow ( -title => '',-width=> 200,-background=>'') ; $mw->geometry("600x550"); $mw->resizable( 0, 0 ); #not resizable in either width or height my $frame1 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); $frame1->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => 'x'); my $pdf_file; $frame1-> Label(-text=>"")-> pack(-side => 'left',); $frame1->Button(-text => 'Select a pdf file', -borderwidth => 3, -height => 1, -width => 40, -command => \&get_file )->pack(-side => 'left', -padx => 5 , -pady => 0); my $file_entry = $frame1 -> Entry(-textvariable => "", -width=>30)-> pack(-side => 'left', -padx => 10 , -pady => 0); my $frame2 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); $frame2->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => 'x'); button($frame2, "TEST IT", "TEST File",'top','cyan', \&read_file)->pack(-padx => 30 , -pady => 10, -side => 'bottom'); MainLoop; sub button { my ($this, $text, $help, $position, $bgcolor, $command) = @_; my $button = $this->Button(-text => $text, -command => $command, -font=>"default 14 bold", -background=> $bgcolor, -activeforeground => "red"); my $hotkey = "<Alt-" . lc(substr($text, 0, 1)) . ">"; $mw->bind($hotkey, $command ); $button->configure(-underline => '0'); # Alt-first char as hotkey $button->pack(-side => $position,-padx => 0 , -pady => 10); return $button; } sub read_file { if ($pdf_file) { my $pdf = CAM::PDF->new($pdf_file); print $pdf->numPages(); } } sub get_file { my @types = (["PDF files", [qw/.pdf/]], ["All files", '*'], ); $pdf_file = $mw->getOpenFile(-filetypes => \@types) or return(); if( $pdf_file ) { $file_entry->configure(-text => $pdf_file); } return($pdf_file); } Show quoted text
-----Original Message----- From: Father Chrysostomos via RT [mailto:bug-CAM-PDF@rt.cpan.org] Sent: Wednesday, March 29, 2017 6:45 PM To: Abdelbaki Brahmia <abrahmia@physics.rutgers.edu> Subject: [rt.cpan.org #120793] rt.cpan.org #120773 <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > On Wed Mar 29 14:15:52 2017, abrahmia@physics.rutgers.edu wrote:
> It works fine if the pdf file is loaded internally like my $file = > "C:/path/file.pf"; > > But it fails when you load it using the Tk interface like: > my $file= $mw->getOpenFile(-filetypes => \@whatever); > > This problem does not happen with PDF::API3 module.
It’s a little hard to go on that. Could you provide a complete script (but as small as possible) that demonstrates the problem?
Download pdf_file.pdf
application/pdf 149.3k

Message body not shown because it is not plain text.

On Wed Mar 29 23:56:24 2017, abrahmia@physics.rutgers.edu wrote: Show quoted text
> Apparently the module is not able to read pdf files generated by > Microsoft Word (that's the only one I tested).
Hmm. What do you get if you try this? my $pdf = CAM::PDF->new($pdf_file) or die "Cannot open $pdf_file: $!"; (I’m running on a system that doesn’t support Tk out of the box, so it is hard to debug this myself.) Show quoted text
> > Here is the script: > #!/usr/bin/perl -w > use Tk; > use strict; > use CAM::PDF; > > # Create necessary widgets > my $mw = new MainWindow ( -title => '',-width=> 200,-background=>'') ; > $mw->geometry("600x550"); > $mw->resizable( 0, 0 ); #not resizable in either width or height > > my $frame1 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); > $frame1->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => > 'x'); > > my $pdf_file; > $frame1-> Label(-text=>"")-> pack(-side => 'left',); > $frame1->Button(-text => 'Select a pdf file', > -borderwidth => 3, > -height => 1, > -width => 40, > -command => \&get_file )->pack(-side => 'left', -padx => 5 , > -pady => 0); > > my $file_entry = $frame1 -> Entry(-textvariable => "", -width=>30)-> > pack(-side => 'left', -padx => 10 , -pady => 0); > > my $frame2 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); > $frame2->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => > 'x'); > > button($frame2, "TEST IT", "TEST File",'top','cyan', \&read_file)-
> >pack(-padx => 30 , -pady => 10, -side => 'bottom');
> > MainLoop; > > sub button > { > my ($this, $text, $help, $position, $bgcolor, $command) = @_; > my $button = $this->Button(-text => $text, -command => $command, > -font=>"default 14 bold", -background=> $bgcolor, -activeforeground => > "red"); > my $hotkey = "<Alt-" . lc(substr($text, 0, 1)) . ">"; > > $mw->bind($hotkey, $command ); > $button->configure(-underline => '0'); # Alt-first char as hotkey > $button->pack(-side => $position,-padx => 0 , -pady => 10); > > return $button; > } > sub read_file > { > if ($pdf_file) > { > my $pdf = CAM::PDF->new($pdf_file); > print $pdf->numPages(); > } > } > sub get_file > { > my @types = > (["PDF files", [qw/.pdf/]], > ["All files", '*'], > ); > $pdf_file = $mw->getOpenFile(-filetypes => \@types) or return(); > if( $pdf_file ) > { > $file_entry->configure(-text => $pdf_file); > } > return($pdf_file); > } > > -----Original Message----- > From: Father Chrysostomos via RT [mailto:bug-CAM-PDF@rt.cpan.org] > Sent: Wednesday, March 29, 2017 6:45 PM > To: Abdelbaki Brahmia <abrahmia@physics.rutgers.edu> > Subject: [rt.cpan.org #120793] rt.cpan.org #120773 > > <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > > > On Wed Mar 29 14:15:52 2017, abrahmia@physics.rutgers.edu wrote:
> > It works fine if the pdf file is loaded internally like my $file = > > "C:/path/file.pf"; > > > > But it fails when you load it using the Tk interface like: > > my $file= $mw->getOpenFile(-filetypes => \@whatever); > > > > This problem does not happen with PDF::API3 module.
> > It’s a little hard to go on that. Could you provide a complete script > (but as small as possible) that demonstrates the problem? > >
Subject: RE: [rt.cpan.org #120793] rt.cpan.org #120773
Date: Fri, 31 Mar 2017 16:16:29 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
Here is the error that you get when you use pdf files created on windows systems. Tk::Error: Cannot open C:/path/pdf_file.pdf: at C:\campdf.pl line ... Those pdf files created on a unix box are read fine. Show quoted text
-----Original Message----- From: Father Chrysostomos via RT [mailto:bug-CAM-PDF@rt.cpan.org] Sent: Friday, March 31, 2017 1:24 AM To: Abdelbaki Brahmia <abrahmia@physics.rutgers.edu> Subject: [rt.cpan.org #120793] rt.cpan.org #120773 <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > On Wed Mar 29 23:56:24 2017, abrahmia@physics.rutgers.edu wrote:
> Apparently the module is not able to read pdf files generated by > Microsoft Word (that's the only one I tested).
Hmm. What do you get if you try this? my $pdf = CAM::PDF->new($pdf_file) or die "Cannot open $pdf_file: $!"; (I’m running on a system that doesn’t support Tk out of the box, so it is hard to debug this myself.)
> > Here is the script: > #!/usr/bin/perl -w > use Tk; > use strict; > use CAM::PDF; > > # Create necessary widgets > my $mw = new MainWindow ( -title => '',-width=> 200,-background=>'') ; > $mw->geometry("600x550"); $mw->resizable( 0, 0 ); #not resizable in > either width or height > > my $frame1 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); > $frame1->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => > 'x'); > > my $pdf_file; > $frame1-> Label(-text=>"")-> pack(-side => 'left',); > $frame1->Button(-text => 'Select a pdf file', > -borderwidth => 3, > -height => 1, > -width => 40, > -command => \&get_file )->pack(-side => 'left', -padx => 5 , > -pady => 0); > > my $file_entry = $frame1 -> Entry(-textvariable => "", -width=>30)-> > pack(-side => 'left', -padx => 10 , -pady => 0); > > my $frame2 = $mw->Frame(-relief => 'flat', -bd => 2, -background=>''); > $frame2->pack(-side => 'top', -anchor => 'n', -expand => 1, -fill => > 'x'); > > button($frame2, "TEST IT", "TEST File",'top','cyan', \&read_file)-
> >pack(-padx => 30 , -pady => 10, -side => 'bottom');
> > MainLoop; > > sub button > { > my ($this, $text, $help, $position, $bgcolor, $command) = @_; > my $button = $this->Button(-text => $text, -command => $command, > -font=>"default 14 bold", -background=> $bgcolor, -activeforeground => > "red"); > my $hotkey = "<Alt-" . lc(substr($text, 0, 1)) . ">"; > > $mw->bind($hotkey, $command ); > $button->configure(-underline => '0'); # Alt-first char as hotkey > $button->pack(-side => $position,-padx => 0 , -pady => 10); > > return $button; > } > sub read_file > { > if ($pdf_file) > { > my $pdf = CAM::PDF->new($pdf_file); > print $pdf->numPages(); > } > } > sub get_file > { > my @types = > (["PDF files", [qw/.pdf/]], > ["All files", '*'], > ); > $pdf_file = $mw->getOpenFile(-filetypes => \@types) or return(); > if( $pdf_file ) > { > $file_entry->configure(-text => $pdf_file); > } > return($pdf_file); > } > > -----Original Message----- > From: Father Chrysostomos via RT [mailto:bug-CAM-PDF@rt.cpan.org] > Sent: Wednesday, March 29, 2017 6:45 PM > To: Abdelbaki Brahmia <abrahmia@physics.rutgers.edu> > Subject: [rt.cpan.org #120793] rt.cpan.org #120773 > > <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > > > On Wed Mar 29 14:15:52 2017, abrahmia@physics.rutgers.edu wrote:
> > It works fine if the pdf file is loaded internally like my $file = > > "C:/path/file.pf"; > > > > But it fails when you load it using the Tk interface like: > > my $file= $mw->getOpenFile(-filetypes => \@whatever); > > > > This problem does not happen with PDF::API3 module.
> > It’s a little hard to go on that. Could you provide a complete script > (but as small as possible) that demonstrates the problem? > >
On Fri Mar 31 12:16:48 2017, abrahmia@physics.rutgers.edu wrote: Show quoted text
> Here is the error that you get when you use pdf files created on > windows systems. > Tk::Error: Cannot open C:/path/pdf_file.pdf: at C:\campdf.pl line ... > > Those pdf files created on a unix box are read fine.
I don’t know how to explain what you are getting then. I can open the PDF file that you attached with CAM::PDF and no problems arise. Could it be that we are using different versions? $ perl -S pmvers CAM::PDF 1.60 $ perl -MCAM::PDF -le 'print new CAM::PDF "/private/var/folders/48/6ysnwsz12ync5qd2xyc3p2c00000gq/T/WebKitPDFs-CJregy/pdf_file.pdf"' CAM::PDF=HASH(0x7feccb02bbf8) $ perl -MCAM::PDF -le 'print new CAM::PDF "/private/var/folders/48/6ysnwsz12ync5qd2xyc3p2c00000gq/T/WebKitPDFs-CJregy/pdf_file.pdf" =>->numPages' 1
Subject: Re: [rt.cpan.org #120793] rt.cpan.org #120773
Date: Mon, 3 Apr 2017 03:10:49 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
It opens fine for me too, but not when you load it through a tk interface. Sent from my iPad Show quoted text
> On Apr 2, 2017, at 10:58 PM, Father Chrysostomos via RT <bug-CAM-PDF@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > >
>> On Fri Mar 31 12:16:48 2017, abrahmia@physics.rutgers.edu wrote: >> Here is the error that you get when you use pdf files created on >> windows systems. >> Tk::Error: Cannot open C:/path/pdf_file.pdf: at C:\campdf.pl line ... >> >> Those pdf files created on a unix box are read fine.
> > I don’t know how to explain what you are getting then. I can open the PDF file that you attached with CAM::PDF and no problems arise. Could it be that we are using different versions? > > $ perl -S pmvers CAM::PDF > 1.60 > $ perl -MCAM::PDF -le 'print new CAM::PDF "/private/var/folders/48/6ysnwsz12ync5qd2xyc3p2c00000gq/T/WebKitPDFs-CJregy/pdf_file.pdf"' > CAM::PDF=HASH(0x7feccb02bbf8) > $ perl -MCAM::PDF -le 'print new CAM::PDF "/private/var/folders/48/6ysnwsz12ync5qd2xyc3p2c00000gq/T/WebKitPDFs-CJregy/pdf_file.pdf" =>->numPages' > 1 >
On Sun Apr 02 23:11:05 2017, abrahmia@physics.rutgers.edu wrote: Show quoted text
> It opens fine for me too, but not when you load it through a tk > interface.
I’m afraid I’m not in a position to debug this any further.
Subject: Re: [rt.cpan.org #120793] rt.cpan.org #120773
Date: Mon, 3 Apr 2017 15:54:54 +0000
To: "bug-CAM-PDF [...] rt.cpan.org" <bug-CAM-PDF [...] rt.cpan.org>
From: Abdelbaki Brahmia <abrahmia [...] physics.rutgers.edu>
That's fine. I am now using the PDF::API3 module which reads the PDF files fine. Thank you. Sent from my iPad Show quoted text
> On Apr 3, 2017, at 2:59 AM, Father Chrysostomos via RT <bug-CAM-PDF@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=120793 > >
>> On Sun Apr 02 23:11:05 2017, abrahmia@physics.rutgers.edu wrote: >> It opens fine for me too, but not when you load it through a tk >> interface.
> > I’m afraid I’m not in a position to debug this any further.