VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Virtuemart 1.1 Development (Archiv) => Quality & Testing VirtueMart 1.1.x => Topic started by: akerman on April 17, 2008, 08:40:09 am

Title: fPDF printing error in Category listings
Post by: akerman on April 17, 2008, 08:40:09 am
Searched all Forum for PDF solutions and found several solutions spread over the last two years. None of them solved this.

Environment: Jomla! 1.5.2, VM 1.1.0 RC3

Problem
Using PDF button in a category listing (like 'Handtools') produce erroneous result in popup window.

Error code inside popup window (no 'application/pdf' text in window header)
FPDF error: Alpha channel not supported: http://www.mysite.com/components/com_virtuemart/themes/default//images/feed-icon-14x14.png

Comparison
PDF function on product detail is working.

Conclusion
This leads me to belive that FPDF have some kind of problem w PNG files.
Which also is proven by removal/renaming off the feed_icon...png to feed_icon...pog. = Voilá the PDF works!

Any solution? Has this not been discovered before?

Regards
Akerman / InfoClip.se
Title: Re: PDF error in Category listings
Post by: jenkinhill on April 17, 2008, 21:06:19 pm
It does not error for me J!1.5.2  VM build 1371 using FireFox 2.0.0.13
Title: Re: PDF error in Category listings
Post by: akerman on April 18, 2008, 16:36:58 pm
Hmm, interesting I'm also using that version off Firefox.

Although I don't think the problem is with the browser. The error message clearly states that the FPDF has problem to read the file due to 'Alpha channe is not supportedl'. Alpha channel is a part of the PNG file structure.

Removing / renaming the file or replacing the PNG with GIF solves the problem. But since the RSS icon in this instance is delivered with the VM installation, one could expect that this should work.

Do you have the RSS feed icon active on the category page from where you test the PDF function?

Regards
Akerman / InfoClip.se
 
Title: Re: PDF error in Category listings
Post by: aravot on April 18, 2008, 17:28:01 pm
Can not duplicate your issue, if you are using RC3 upgrade to nightly build.
Title: Re: PDF error in Category listings
Post by: jenkinhill on April 18, 2008, 17:34:31 pm
Do you have the RSS feed icon active on the category page from where you test the PDF function?

Yes, I do. Tested with PHP 4.4.4 and 5.2.4 but issues can be related to PHP version.

I see no product images with 5.2.4, though. Using 5.2.4 with VM 1.0.15 I always get an error with .gif files, but not when using PHP 4. Something not quite right?

For client sites I usually turn off the pdf icon.
Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: akerman on April 18, 2008, 19:14:14 pm
Ok, I will follow Aravot recommendation to run a later Nightly build or maybe wait ti'll after April 23rd? (.. if no more delays  ;)  )

I'm running PHP Version 5.2.3-1ubuntu6.3 and this problem have been with me since the first implementation of VM 1.1.0 RC1.
I was hoping for this to become solved during the development of the later RC's.

I'm no master programmer but I work professionally in the IT services and to my humble opinon it seems to be straightforward when it comes to the problemdetermination: FPDF does not like PNG format of the Feed icon included in the themes path.

The following code in the FPDF.php is processed until the point of the Alpha investigation (where it crashes)

Code: [Select]
function _parsepng($file)
{
//Extract info from a PNG file
$f=fopen($file,'rb');
//Extract info from a PNG file
if(!$f) $this->Error('Can\'t open image file: '.$file);
//Check signature
if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
$this->Error('Not a PNG file: '.$file);
//Read header chunk
fread($f,4);
if(fread($f,4)!='IHDR') $this->Error('Incorrect PNG file: '.$file);
$w=$this->_freadint($f);
$h=$this->_freadint($f);
$bpc=ord(fread($f,1));
if($bpc>8) $this->Error('16-bit depth not supported: '.$file);
$ct=ord(fread($f,1));
if($ct==0) $colspace='DeviceGray';
elseif($ct==2) $colspace='DeviceRGB';
elseif($ct==3) $colspace='Indexed';
else $this->Error('Alpha channel not supported: '.$file);       <-------------------- CRASH occurs here!!
if(ord(fread($f,1))!=0) $this->Error('Unknown compression method: '.$file);
if(ord(fread($f,1))!=0) $this->Error('Unknown filter method: '.$file);
if(ord(fread($f,1))!=0) $this->Error('Interlacing not supported: '.$file);
fread($f,4);
$parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';


I haven't changed the image or the code, its 'straight out of the box', so I think its odd that you guys don't experience the same problem.

Regards
Akerman / InfoClip.se

Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: iamalive on May 09, 2008, 15:16:14 pm
Hi

I'm getting this error too:

Quote
FPDF error: Alpha channel not supported: /home/customer/public_html/components/com_virtuemart/shop_image/vendor/customer_47cd40af189d5.png

This now the live Site at: http://neukom-electronic.ch (http://neukom-electronic.ch) on all of the virtuemart pages.

My details:
Virtuemart 1.1 stable build from 23 April 2008
Joomla 1.5.3
PHP 5.2.5
MySQL 5.0.45-community
Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635

This error occurs with both Firefox 2.0.0.14
and IE 7

Regards
David
Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: iamalive on May 09, 2008, 16:49:36 pm
Well I've investigated further:

It turns out that the logo which the shop uses, had aplpha transparency and now I've changed it to a jpg and that problem goes away. HOWEVER...

the next it thing it complined about was the feed image for the RSS link:
Quote
/themes/default/images/feed-icon-14x14.png
which also had alpha transparency.

So I converted that to something without transparency and the the next problem comes up:

Quote
FPDF error: Missing or incorrect image file: http://neukom-electronic.ch/components/com_virtuemart/shop_image/product/resized/resized%2FBK_Precision_879_47d5525f44cd9_90x90_90x90.jpg

Now I stop. It's clear that the PDF bit of Virtuemart which calls up FPDF needs to be able to work around all these limitations associated with images.

That's the bes information I can provide a input, folks.

Regards

David
Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: GTWillemsen on May 12, 2008, 14:50:50 pm
Is this problem already solved?

___

If not, maybe offer the option to choose not to display PNG images with alpha channels, but maybe show gif images instead, in the PDF?
Can be a workaround until this can be fixed?

___

It only happens with alpha channel PNG as far as I tested.
IMO it's not only a VM theme issue, but a problem for every alpha PNG...  thus for product imagery as well!
Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: akerman on May 14, 2008, 22:19:44 pm
Thanx for the feedback guys!

This made the issue a bit clearer for me. I will test to replace the RSS icon (which is my immediate problem area) with a .gif instead or a .png without 'Alpha-channel'

Looking at the code again its quite clear that it does not support Alpha channel.
(Suppose I had tunnel-vision while reading it before... ;) )

Anyhow, some kind of adjustment in FPDF in regards of inserting/converting the most common filetypes, is most welcome.


Regards
Akerman
Title: Re: [CAN NOT DUPLICATE] PDF error in Category listings
Post by: conticreative on September 14, 2008, 03:58:10 am
Please take the [cannot duplicate] out since many of us can indeed duplicate it :)

I did not have the initial problem in the post but I started out with the problem outlined in iamalive post. Namely my error looks just like this one:

FPDF error: Missing or incorrect image file: http://neukom-electronic.ch/components/com_virtuemart/shop_image/product/resized/resized%2FBK_Precision_879_47d5525f44cd9_90x90_90x90.jpg

Now, if you take a good look at the filename it says it cannot find
BK_Precision_879_47d5525f44cd9_90x90_90x90.jpg

I'll bet my lunch that the original filename ended in _90x90 on the server and not _90x90_90x90.jpg
at least that's how it is on my server when I went to check the filenames.

In any event, this is a real problem for me and a solution would be nice.

Incidentally, I installed an update to FPDF (1.6) which solved the problem but then the page was blank.
Title: Re: fPDF printing error in Category listings
Post by: SamTzu on March 17, 2009, 18:28:59 pm
On your (ubuntu) server as a root try this..

apt-get install php-fpdf

Works for me.

--------------------------------------------
Sam
Title: Re: fPDF printing error in Category listings
Post by: SamTzu on October 20, 2010, 15:14:25 pm
lol, Googled this again and found my own solution :)
Hurray for me.
Title: Re: fPDF printing error in Category listings
Post by: mus1402 on January 23, 2011, 07:20:35 am
Is there any solution to this problem?

I'm having similar issue.

Pls help. thx
Title: Re: fPDF printing error in Category listings
Post by: cmatte on April 30, 2011, 18:31:57 pm
lol, Googled this again and found my own solution :)
Hurray for me.

How did you do it?
Same problem here and no help on the forum till now. I'd like to mantain the logo with transparency!
I see fpdf 1.6 does support alpha channels. I tried inserting it right away but seems like it needs the modification someone did on it for vm because it returns nothing.
Title: Re: fPDF printing error in Category listings
Post by: dontflinch on May 04, 2011, 19:33:52 pm
http://www.fpdf.org/phorum/read.php?f=1&i=54837&t=54837
http://www.fpdf.org/en/script/script83.php

I think it would be nice if this was incorporated in next vm version.
Title: Re: fPDF printing error in Category listings
Post by: cmatte on May 04, 2011, 22:47:36 pm
Exactly what I found out!
Please...let's do it :-)
Title: Re: fPDF printing error in Category listings
Post by: dontflinch on May 05, 2011, 03:10:47 am
it is a difficult modification.  fpdf has been on version 1.6 since 2008, but the version in vm is a heavily modified 1.52 (from 2003 I think).  I overwrote the fpdf.php file with the newest version of it then went through the old one and pulled out all the mods and placed them in the new one, knocking down error after error line by line, then we added in the new alpha script.  we now have one that is 'working' but it is ugly and I am not sure everything is rendering as it should, I think the 'flow' part is still messed up.  I can tell I still have many more hours to put into this. 

I really hope in the new vm they use a more current fpdf.  alpha pngs are not really unusual nowadays and googling this issue shows tons of people asking for this type of fix.  the particular mods made to the vm version means the standard fix does not work as is evidenced by you (and I) getting a blank screen after applying it.
Title: Re: fPDF printing error in Category listings
Post by: jekkil on July 03, 2011, 16:32:42 pm
It seems that they have solved the problem, FPDF 1.7 is out , only problem i have , how and where to upgrade!! pls help!!

http://www.fpdf.org/en/dl.php?v=17&f=zip

Title: Re: fPDF printing error in Category listings
Post by: Roderick1 on October 10, 2011, 13:54:37 pm
Yes same problem here, running on VM 1.1.9 and getting error:FPDF error: Alpha channel not supported:
Tried to upgrade the FPDF manually but no go :( please help!