Skip Menu |

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

Report information
The Basics
Id: 131887
Status: open
Priority: 0/
Queue: PDF-API2

People
Owner: Nobody in particular
Requestors: tturner [...] torrid-tech.com
Cc:
AdminCc:

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



Subject: Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Wed, 19 Feb 2020 21:56:16 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Hi, I have used PDF::API2 for at least 10 years or more. My web provider is forcing me to use a new server. Moving all my code over. and it's just not working. PDF::API2 is indeed installed and I can generate a PDF but problem is with adding a JPEG. First issue is that it doesn't recognize image_jpeg at all. I did not change the code and it barfs on image_jpeg. I get this message: Can't locate object method "image_jpeg" via package "PDF::API2" at /var/www/vhosts /httpdocs/cgi-bin/somepathSNIPPED/custom_setup.pl line 220 Google that error and find nothing of value. If I change the method to just image without the jpeg I get: 2020] dist.cgi: image '/var/www/vhosts/webcalcs.com/httpdocs/docs/SNIP/images/logo_PLifeVert_4_C.j pg' has unknown format with signature '000000000000' at /usr/local/share/perl5/PDF/API2.pm line 5914., referer: <https://www.webcalcs.com/cgi-bin/calcs/prod/distributions.cgi?client=pacifi clife&case=gen_72T> url removed Any help or advice appreciated. Other info below. Regards, -Tim ----------------- Be sure to include at least the following information: * Distribution name and version (For example, "DBIx-SearchBuilder-0.46") cpan -D PDF::API2 CPAN: Storable loaded ok (v2.20) CPAN: LWP::UserAgent loaded ok (v5.833) CPAN: Time::HiRes loaded ok (v1.9721) mkdir /root: Permission denied at /usr/share/perl5/CPAN/FTP.pm line 501 * Perl version (Find this by running the command perl -v) Perl v5.10.1 * Operating System vendor and version (Find this by running the command uname -a) Linux pluto.ourcontrolpanel.com 2.6.32-896.16.1.lve1.4.51.el6.x86_64 #1 SMP Wed Jan 17 13:19:23 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

Message body is not shown because it is too large.

Is there any way for you to check what the PDF::API2 version is? Maybe run $pdf->version(); and print the result? I take it that it is installed on a webserver and not your local PC. If your host is making you use Perl 5.10, which is incredibly ancient and out of support (5.18 is minimum supported, and 5.30 is current), I wouldn't be surprised if their PDF::API2 is either way back-level (2.037 is current) or was corrupted during installation. Have you brought this to their attention? If you have a PC (Windows, Linux, or Mac), consider installing and running PDF::API2 (or PDF::Builder) on it and running there. Unless you need unattended online (web) PDF creation, this would be better.
P.S. The "image" method is not for directly handling JPEG images. It needs as input something that has already gone through "image_jpeg". As I said before, either your server's copy of PDF::API2 is so old that it doesn't include JPEG support (I don't know if it ever didn't) or it was corrupted or misconfigured in some way.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Thu, 20 Feb 2020 13:02:47 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Phil, Thanks for responding. I will ask about the perl version but I don't think that is the issue. My old server that everything worked on used ancient Perl 5.8.8. It all worked so we left it alone. Here is the module version: -bash-4.1$ perl -MPDF::API2 -le 'print $PDF::API2::VERSION' 0.2.3.8 -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Thursday, February 20, 2020 9:36 AM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > Is there any way for you to check what the PDF::API2 version is? Maybe run $pdf->version(); and print the result? I take it that it is installed on a webserver and not your local PC. If your host is making you use Perl 5.10, which is incredibly ancient and out of support (5.18 is minimum supported, and 5.30 is current), I wouldn't be surprised if their PDF::API2 is either way back-level (2.037 is current) or was corrupted during installation. Have you brought this to their attention? If you have a PC (Windows, Linux, or Mac), consider installing and running PDF::API2 (or PDF::Builder) on it and running there. Unless you need unattended online (web) PDF creation, this would be better.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Thu, 20 Feb 2020 15:52:34 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
The version number does not make sense at 0.2.3.8 But I found this in the list of installed modules: PDF-API2-0.2.3.8_fix1/lib/Text/PDF/ImageJPEG.pm Not sure what this 0.2.3.8 fix is.... maybe that whole tree needs to be uninstalled? Also installed is the regular PDF-API2 tree /usr/share/perl5/vendor_perl/PDF/API2/Resource/XObject/Image/JPEG.pm etc. -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Thursday, February 20, 2020 9:36 AM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > Is there any way for you to check what the PDF::API2 version is? Maybe run $pdf->version(); and print the result? I take it that it is installed on a webserver and not your local PC. If your host is making you use Perl 5.10, which is incredibly ancient and out of support (5.18 is minimum supported, and 5.30 is current), I wouldn't be surprised if their PDF::API2 is either way back-level (2.037 is current) or was corrupted during installation. Have you brought this to their attention? If you have a PC (Windows, Linux, or Mac), consider installing and running PDF::API2 (or PDF::Builder) on it and running there. Unless you need unattended online (web) PDF creation, this would be better.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Thu, 20 Feb 2020 16:02:38 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Also what are the pre-requisites for PDF::API2 if any? Does Text/PDF need to be installed? I see it in my list of perl modules but a version check says it can't be located. I tried searching for Text::PDF -bash$ perl -MText::PDF -le 'print $Text::PDF::VERSION' Can't locate Text/PDF.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted. And then just Text -bash$ perl -MText -le 'print $Text::VERSION' Can't locate Text.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .). BEGIN failed--compilation aborted. Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Thursday, February 20, 2020 9:36 AM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > Is there any way for you to check what the PDF::API2 version is? Maybe run $pdf->version(); and print the result? I take it that it is installed on a webserver and not your local PC. If your host is making you use Perl 5.10, which is incredibly ancient and out of support (5.18 is minimum supported, and 5.30 is current), I wouldn't be surprised if their PDF::API2 is either way back-level (2.037 is current) or was corrupted during installation. Have you brought this to their attention? If you have a PC (Windows, Linux, or Mac), consider installing and running PDF::API2 (or PDF::Builder) on it and running there. Unless you need unattended online (web) PDF creation, this would be better.
I have no idea what 0.2.3.8 refers to. It's certainly not a PDF::API2 version from the last 10 or 15 years. It might be some packager's internal number. If they've modified PDF::API2 then they are on the hook for maintaining it. Perl 5.8.8 is so behind the times that it's dangerous to use. Certainly the current products will have problems running on something that old. If you choose to stay so far behind, I can't help you any further. Good luck!
Current and recent PDF::API2 releases had nothing to do with Text::PDF. Its runtime requirements are Font::TTF and Compress::Zlib. The installation and build package may require Test::Exception, Test::Memory::Cycle, and ExtUtils::MakeMaker. cpan.org contains all this information.
Looking a bit into the history of PDF::API2, it appears that it started with a wrapper around Text::PDF::API. That was at least 15, perhaps closer to 20, years ago! If you're trying to run a version of PDF::API2 that actually depends on Text::PDF, it means it is very very very old. Old as the hills and twice as dusty. Either kick your host in the butt to get the server updated to current levels (including current Perl), or do your work on a PC where you can control what's installed. There is no rational reason to be running on such old Perl or PDF::API2 levels. As I said before, unless you need online automated creation of PDFs as part of a website, take it off the server and run them on your PC.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Mon, 24 Feb 2020 12:39:13 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Hi Phil, We uninstalled and reinstalled and got the image_jpeg working. YES this is a web server app that is in production and used by clients so fixing it is a must do and PC is not an option. The only issue left now is text->paragraph in some cases has no spaces in the text when it is added to the document. I set the "lead" on the font. Still stumped by that one. It wasn't an issue before. All of this has worked for years and moving to an updated server is causing all of the issues. Anyway have you seen text written with no spaces between words before? Thx -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Sunday, February 23, 2020 10:19 AM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > Looking a bit into the history of PDF::API2, it appears that it started with a wrapper around Text::PDF::API. That was at least 15, perhaps closer to 20, years ago! If you're trying to run a version of PDF::API2 that actually depends on Text::PDF, it means it is very very very old. Old as the hills and twice as dusty. Either kick your host in the butt to get the server updated to current levels (including current Perl), or do your work on a PC where you can control what's installed. There is no rational reason to be running on such old Perl or PDF::API2 levels. As I said before, unless you need online automated creation of PDFs as part of a website, take it off the server and run them on your PC.
I have not seen a lack of spaces between words. Note I understand that paragraph() is not officially supported in PDF::API2, but is supported in PDF::Builder (fork of PDF::API2). It uses a single long string as input -- if you concatenated multiple substrings into one (. operator or join function), were you careful to put one space between each substring? Leading ("lead") is for vertical padding between one line and the next (so descenders and ascenders don't collide), not between words. If this does not resolve the problem, please provide a sample that shows the problem. What version of PDF::API2 (and Perl) did you end up with? The current PDF::API2 is 2.037 and the current Perl is 5.030 (PDF::API2 should work at least as far back as Perl 5.018). If you're using a reasonably recent version, perhaps your code is counting on some behavior that was changed at some point.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Mon, 24 Feb 2020 19:04:51 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
The latest version of 2.037 pf PDF::API2 is installed. The perl version though is 5.10.1 -bash-4.1$ perl -MPDF::API2 -le 'print $PDF::API2::VERSION' 2.037 -bash-4.1$ perl -v This is perl, v5.10.1 -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Monday, February 24, 2020 6:04 PM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > I have not seen a lack of spaces between words. Note I understand that paragraph() is not officially supported in PDF::API2, but is supported in PDF::Builder (fork of PDF::API2). It uses a single long string as input -- if you concatenated multiple substrings into one (. operator or join function), were you careful to put one space between each substring? Leading ("lead") is for vertical padding between one line and the next (so descenders and ascenders don't collide), not between words. If this does not resolve the problem, please provide a sample that shows the problem. What version of PDF::API2 (and Perl) did you end up with? The current PDF::API2 is 2.037 and the current Perl is 5.030 (PDF::API2 should work at least as far back as Perl 5.018). If you're using a reasonably recent version, perhaps your code is counting on some behavior that was changed at some point.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Mon, 24 Feb 2020 19:06:25 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Phil, As for your other questions... the call to paragraph just provides a long string of text that already includes the spaces. When placed on the document though the spaces are gone. Never seen that in 10+ years using the module. If I switch to PDF::Builder... do you have a guide of some sort of what code changes if any need to be made if not using PDF::API2??? -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Monday, February 24, 2020 6:04 PM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > I have not seen a lack of spaces between words. Note I understand that paragraph() is not officially supported in PDF::API2, but is supported in PDF::Builder (fork of PDF::API2). It uses a single long string as input -- if you concatenated multiple substrings into one (. operator or join function), were you careful to put one space between each substring? Leading ("lead") is for vertical padding between one line and the next (so descenders and ascenders don't collide), not between words. If this does not resolve the problem, please provide a sample that shows the problem. What version of PDF::API2 (and Perl) did you end up with? The current PDF::API2 is 2.037 and the current Perl is 5.030 (PDF::API2 should work at least as far back as Perl 5.018). If you're using a reasonably recent version, perhaps your code is counting on some behavior that was changed at some point.
Could you provide a small test case illustrating this problem? I'm not seeing it when I run with either PDF::API2 or PDF::Builder. And what version of Perl and PDF::API2 are you running now? PDF::Builder is intended to be largely compatible with PDF::API2. Obviously you need to change all "PDF::API2" to "PDF::Builder". If you're using some more esoteric features, especially deprecated names that have already been removed from Builder, you should look at INFO/DEPRECATED and INFO/KNOWN_INCOMP for known incompatibilities.
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Tue, 25 Feb 2020 21:58:24 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Phil, As I emailed before I have 2.3.7 version of API2 but older 5.10.1 version of Perl. Hosting company says that version is what is shipped with the server. Nevertheless, I found the problem and it was adding: align => 'justified' Removing that fixed the problem, but on older version of API2 that worked fine. I may at some point switch to Builder but for now I just have to get these scripts working in production again. Many thanks for your help. Regards, -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Tuesday, February 25, 2020 12:16 PM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > Could you provide a small test case illustrating this problem? I'm not seeing it when I run with either PDF::API2 or PDF::Builder. And what version of Perl and PDF::API2 are you running now? PDF::Builder is intended to be largely compatible with PDF::API2. Obviously you need to change all "PDF::API2" to "PDF::Builder". If you're using some more esoteric features, especially deprecated names that have already been removed from Builder, you should look at INFO/DEPRECATED and INFO/KNOWN_INCOMP for known incompatibilities.
PDF::API2 2.037 will supposedly still run on Perl 5.010. PDF::Builder requires 5.018 to install; I don't know if it will run on earlier Perls. I took a quick look at the "justified" code, and see something that MAY be an issue: in Content.pm's text_fill_justified method, there is a call to "scalar split /\s/, $line". I vaguely recall seeing error messages about such a construct in more recent Perl versions -- could it be that your host has configured Perl to suppress warning messages (especially deprecated functions)? Anyway, just to see if you can use "justified", try changing that line to "scalar(split(/\s/, $line))". You have only normal ASCII spaces between words? That's all I can think of at this point. If at some point you decide to install PDF::Builder, and have issues, please open a support ticket there instead of here, to keep from cluttering up the PDF::API2 support system. Good luck!
Subject: RE: [rt.cpan.org #131887] justified text in "PDF::API2"
Date: Wed, 26 Feb 2020 15:10:20 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Hey Phil, This code change fixed the problem with justified text in paragraph! Indeed this was the trouble all along. So is API2 not really supported anymore and that is why you started Builder? If API2 is supported, why would that item not be fixed in the latest version? Thank you so much for your help! Regards, -Tim Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Tuesday, February 25, 2020 11:24 PM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > PDF::API2 2.037 will supposedly still run on Perl 5.010. PDF::Builder requires 5.018 to install; I don't know if it will run on earlier Perls. I took a quick look at the "justified" code, and see something that MAY be an issue: in Content.pm's text_fill_justified method, there is a call to "scalar split /\s/, $line". I vaguely recall seeing error messages about such a construct in more recent Perl versions -- could it be that your host has configured Perl to suppress warning messages (especially deprecated functions)? Anyway, just to see if you can use "justified", try changing that line to "scalar(split(/\s/, $line))". You have only normal ASCII spaces between words? That's all I can think of at this point. If at some point you decide to install PDF::Builder, and have issues, please open a support ticket there instead of here, to keep from cluttering up the PDF::API2 support system. Good luck!
On Wed Feb 26 15:10:22 2020, tturner@torrid-tech.com wrote: Show quoted text
> Hey Phil, > This code change fixed the problem with justified text in paragraph! > Indeed this was the trouble all along.
That's great to hear! So your production system is now up and running? Show quoted text
> So is API2 not really supported anymore and that is why you started Builder? > If API2 is supported, why would that item not be fixed in the latest version?
I wouldn't say that API2 isn't supported any more -- 2.037 was just released a few weeks ago. For whatever reason, Steve has chosen not to fix it yet. I started Builder because I wasn't happy with the rate of fixing things on API2, and wanted to put other features in that Steve didn't want in it. Show quoted text
> Thank you so much for your help! > Regards, > -Tim
Subject: RE: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2"
Date: Wed, 26 Feb 2020 18:03:25 -0500
To: <bug-PDF-API2 [...] rt.cpan.org>
From: "Tim Turner" <tturner [...] torrid-tech.com>
Yes production system is back in running order! Show quoted text
-----Original Message----- From: Phil M. Perry via RT <bug-PDF-API2@rt.cpan.org> Sent: Wednesday, February 26, 2020 6:00 PM To: tturner@torrid-tech.com Subject: [rt.cpan.org #131887] Can't locate object method "image_jpeg" via package "PDF::API2" <URL: https://rt.cpan.org/Ticket/Display.html?id=131887 > On Wed Feb 26 15:10:22 2020, tturner@torrid-tech.com wrote:
> Hey Phil, > This code change fixed the problem with justified text in paragraph! > Indeed this was the trouble all along.
That's great to hear! So your production system is now up and running?
> So is API2 not really supported anymore and that is why you started Builder? > If API2 is supported, why would that item not be fixed in the latest version?
I wouldn't say that API2 isn't supported any more -- 2.037 was just released a few weeks ago. For whatever reason, Steve has chosen not to fix it yet. I started Builder because I wasn't happy with the rate of fixing things on API2, and wanted to put other features in that Steve didn't want in it.
> Thank you so much for your help! > Regards, > -Tim