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

Image file can't covert to pdf #222

Closed
danliu3458 opened this issue Mar 7, 2022 · 1 comment
Closed

Image file can't covert to pdf #222

danliu3458 opened this issue Mar 7, 2022 · 1 comment

Comments

@danliu3458
Copy link

danliu3458 commented Mar 7, 2022

Here is my code

options = {
      "enable-local-file-access": True,
      ...
}
pdfkit.from_string(html_file, pdf_file, options=options, ...)

since Im using Django template, here is my code to reference that

 <img src="{{ static_root }}{% static '../../target.svg' %}" alt="">

I use a local image file in html, It just shows a blank box in pdf output file

I also tried using "base64" to resolve my issue base on this link https://stackoverflow.com/questions/38329909/pdfkit-not-converting-image-to-pdf

It doesn't really work to me.

@danliu3458
Copy link
Author

I used png format instead svg format ima file resolves my issue in this case

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

1 participant