6

I am trying to generate PDF from HTML (output of a PHP file).

I am using FPDF to generate the PDFs.

I have three PNG transparent images (Alpha channel), that go on top of each other and it looks like one image.

The minute FPDF encounters the first image it give me "FPDF error: Alpha channel not supported:"

Is there a work arround this. Any help will be much appritiated.

Farid Siddiqui
  • 165
  • 2
  • 2
  • 13

5 Answers5

3

Actually, there is a fan-made extension that does allow alpha channels. Try it, it is just PHP code: http://www.fpdf.de/downloads/addons/1091/

user1111929
  • 6,050
  • 9
  • 43
  • 73
3

FPDF does not support alpha transparency but it does support index transparency. So just edit your PNG so that it is using index transparency instead. I am using Fireworks and this was an export option for both PNG8 and PNG24.

Chris
  • 31
  • 1
2

DOMPDF has done the trick for me. It supports the Alpha channels images very well. It manages the CSS floats quite well.

As compare to non-alpha channel images, it takes alot more time to process tranparent PNG (Alpha Channel images).

Because of the size of my HTML and the number of images, my script was taking couple of seconds more than, what is allowed by my host in terms of execution time.

By increasing the execution time and DOMPDF, now it all works to perfection.

I hope it will be helpfull to someone else.

Farid Siddiqui
  • 165
  • 2
  • 2
  • 13
0

As stated, FPDF does not support alpha channel, so there's no workaround.

Maybe you could render a single image and use that?

Edson Medina
  • 9,862
  • 3
  • 40
  • 51
  • One image or three, the minute FPDF sees an Alpha Channel it gave me an error. I thought I read some where that FPDF latest release is supporting Alpha Channel. But I guess it doesn't. Anyway this morning I tried dompdf and it worked like a charm. – Farid Siddiqui Oct 19 '12 at 08:38
0

As of version v1.7 (2011-06-18) it supports alpha channel on PNGs. View the changelog at http://www.fpdf.org/

So you should update your version of FPDF to solve the problem. That worked for me.

atilauy
  • 31
  • 2