Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE in layout when a problem occurs decoding an embedded image #474

Closed
AlexisCothenet opened this issue May 7, 2020 · 2 comments
Closed

Comments

@AlexisCothenet
Copy link

Hello,

It seems that if there is an embedded image inside a html and that cannot be decoded for some reason, an NPE occurs because, then, the resource.getImage() will be null:
https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxUserAgent.java#L77
and
https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/PdfBoxFastOutputDevice.java#L788

Shouldn't the image be ignored instead ?

@syjer
Copy link
Contributor

syjer commented May 25, 2020

@AlexisCothenet you are right, I'll do a PR to fix them. Do you have an example so I can try to reproduce the issue on my side?

@AlexisCothenet
Copy link
Author

AlexisCothenet commented May 25, 2020

Hello @syjer ,

One has to include inside a html content:
<img src="data:image/png;base64, YOUR_BASE_64_FALSE_ENCODING>

example:
<img src="data:image/png base64,iVBORw0KGgoAAAANSUhEUgAAAKcAAABZCAYAAABb@zimbra">

Thank you
Alexis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants