danfickle / danfickle/openhtmltopdf

Rendering PDF document using `img` tag with Base64 content

Open
#829 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
2.2k
Forks
423
PR merge metrics
No merged PRs in 30d

Description

I want to display PDFs and images inline with the PDF I'm generating, but I only have the raw data for each file (and their associated MIME type). For images, I can do this with:

```html

```

However, when I do the same thing with a PDF (following the guidance in [this issue](https://github.com/danfickle/openhtmltopdf/issues/344#issuecomment-508524237)), the PDF can't be resolved.

This is the HTML that I used:
```html

```

And the error I get is:
> com.openhtmltopdf.load WARNING:: Unrecognized image format for: data:@file/pdf;base64,{base64 encoded data here} => java.io.IOException:: Unrecognized Image format

Is this expected behavior, or is this a bug with how PDFs are handled via the `img` tag?

Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.