jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.32k stars 780 forks source link

Can't add image with JPG #228

Closed devEntrega closed 5 years ago

devEntrega commented 5 years ago

Just the title says, I can't add picture with JPG format, it appears the error "not a PNG buffer", is JPG format supported or not?

Thanks.

jung-kurt commented 5 years ago

JPG images are supported, see this example. Might your JPG image file have the wrong extension, or the type argument to Image() be incorrect?

devEntrega commented 5 years ago

JPG images are supported, see this example. Might your JPG image file have the wrong extension, or the type argument to Image() be incorrect?

I see, now the problem is when I change png to jpg, I get panic error when I try to get ImageInfo, I "register" and same results (nil), with PNG works without problem even I don't register.

jung-kurt commented 5 years ago

Could it be corrupt JPG image? Does it display properly with a browser? When you run go testis the file pdf/Fpdf_Image.pdf generated properly?

jung-kurt commented 5 years ago

Please reopen if this problem can be pinpointed to a bug in gofpdf rather than just an invalid image.