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

Images not loading in headers and footers #347

Closed
jamesatplebble opened this issue Feb 22, 2022 · 8 comments
Closed

Images not loading in headers and footers #347

jamesatplebble opened this issue Feb 22, 2022 · 8 comments
Labels

Comments

@jamesatplebble
Copy link

jamesatplebble commented Feb 22, 2022

Hi,

I can't get images to load in headers and footers - see screenshot.
Screen Shot 2022-02-22 at 12 09 42

Here's my code for the header:

I'm a test Header

My options:

$browser = $browserFactory->createBrowser([ 'windowSize' => [882, 1248], 'ignoreCertificateErrors' => true, 'enableImages' => true, 'userAgent' => 'PlainlyBot', ]);

Is this a bug or something I'm doing wrong? (Once I understood that you need to set some inline CSS in a wrapper div for headers and footers, everything else seems to work well.)

Many thanks
James

@enricodias
Copy link
Member

You mean, during printing to pdf?

@jamesatplebble
Copy link
Author

Yes! Sorry, I should have said.

@jamesatplebble
Copy link
Author

Hi Enrico, any further thoughts on this?
Thanks

@enricodias
Copy link
Member

I didn't have time to test this yet. It's in my to-do list.

@stale
Copy link

stale bot commented Jul 10, 2022

This issue has been automatically marked as stale because there has been no recent activity. It will be closed after 30 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 10, 2022
@jamesatplebble
Copy link
Author

This is still an issue as far as I know?

@enricodias
Copy link
Member

So, there are a lot of sources around saying that both headerTemplate and footerTemplate can't load external resources, but I couldn't find why. I checked the chromium source code and saw that the header and footer are added using innerHTML, just like the content.

I couldn't find any way to load external images. The only thing that worked was injecting the image as base64 directly in the html: <img src="data:image/png;base64,..."/>

If anyone finds a better solution, feel free to reopen this issue.

@Entretoize
Copy link

Same issue, any news ?

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

No branches or pull requests

3 participants