jsPDF icon indicating copy to clipboard operation
jsPDF copied to clipboard

PNG addImage corrupted

Open glebov21 opened this issue 2 years ago • 18 comments

Some images are corrupted. I was try wait for image loaded, try use blob, but nothing help Test code on page: http://raw.githack.com/MrRio/jsPDF/master/index.html

Issue: image

Require: image

glebov21 avatar Sep 01 '22 10:09 glebov21

call @jamesbrobb and @diegocr for help 😔

glebov21 avatar Sep 01 '22 10:09 glebov21

Have you tried setting the second argument of addImage to the correct image type? Does that help?

jamesbrobb avatar Sep 01 '22 13:09 jamesbrobb

Have you tried setting the second argument of addImage to the correct image type? Does that help?

Nothing. I was try to set "PNG", change compression level, change another arguments but nothing. Some images printing normally, some with this error...

glebov21 avatar Sep 01 '22 13:09 glebov21

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Dec 01 '22 02:12 github-actions[bot]

actual

glebov21 avatar Dec 01 '22 08:12 glebov21

bump

Dean-NC avatar Feb 06 '23 21:02 Dean-NC

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar May 08 '23 01:05 github-actions[bot]

active

glebov21 avatar May 08 '23 04:05 glebov21

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Aug 08 '23 01:08 github-actions[bot]

active

glebov21 avatar Aug 08 '23 08:08 glebov21

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

github-actions[bot] avatar Nov 08 '23 01:11 github-actions[bot]

active

glebov21 avatar Nov 08 '23 09:11 glebov21

I'm having the same issue. Trying to add png image in node.js. I tried already base64, base64 with uri prefix, Uint8Array, different formats of image. Not working.

All I get is this, instead of the checkbox icon: Screenshot 2024-02-02 at 15 54 10

dev-ton avatar Feb 02 '24 14:02 dev-ton

@dev-ton, we are experiencing this exact issue as well. PNG loaded into Uint8Array.

Screenshot 2024-04-23 at 16 40 37

toondkn avatar Apr 23 '24 14:04 toondkn

@dev-ton, I assume you are using this library with Node or Bun?

We have found a fix: you must call doc.output with argument 'arraybuffer': doc.output('arraybuffer'). PNGs will now render correctly. Without this fix, JPGs will be invisible. With the fix, they show up just fine.

This should definitely be mentioned in the documentation somewhere, this is too obscure to expect users to find.

toondkn avatar Apr 24 '24 09:04 toondkn

@toondkn, not working in my case. Maybe working for @dev-ton

glebov21 avatar Apr 29 '24 08:04 glebov21