FPDF error: Alpha channel not supported:
Asked Answered
O

5

7

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.

Orbital answered 17/10, 2012 at 15:59 Comment(0)
O
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.

Orbital answered 22/10, 2012 at 8:33 Comment(0)
W
4

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.

Woody answered 3/10, 2013 at 13:31 Comment(0)
T
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/

Transship answered 25/4, 2013 at 18:39 Comment(0)
O
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.

Orbital answered 22/10, 2012 at 8:33 Comment(0)
P
0

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

Maybe you could render a single image and use that?

Plume answered 18/10, 2012 at 9:5 Comment(1)
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.Orbital
S
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.

Strew answered 6/7, 2021 at 16:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.