Generated PDF has no style, no images.
See original GitHub issueHello,
The header of my HTML file looks like this:
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
Somewhere else in my HTML file, I have an image:
<img src="img/profile.jpg">
I am trying to compile with the following script (main.js):
let src = fs.readFileSync(`./src/in.html`, 'utf-8')
const options = {
"base": `file://${__dirname}/src/`,
"format": "A4",
"orientation": "portrait"
}
pdfc.create(src, options).toFile(`./out/out.pdf`, (err, res) => {
if (err) return console.log(err)
console.log(res)
})
Here is the file structure:
|- main.js
|- src/
|- in.html
|- style.css
|- img/
|- profile.jpg
|- out/
The resulting PDF has no style, no images… I’m guessing something is wrong with options.base
, but it is pointing to the right directory and the files are where the HTML file expects them to be. Am I passing the options wrong?
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
image is not displayed after generating the pdf ? #44 - GitHub
I'm in a mac and I still can't create the pdf with the images, the images are broken. My code is: <div class="col-lg-4"...
Read more >"Save as PDF" not showing all images. - Microsoft Community
Hi, I am using Excel and I want to use the "File > Save as PDF" feature. It used to work just fine....
Read more >python - Images not showing in PDF generated by WeazyPrint ...
I have a question related to generating PDF in a Django Project using Weazy Print. So the first thing I have done is...
Read more >File format options for PDF export - Adobe Support
Generates tags for files that are not already tagged, such as PDFs created using Acrobat 4.0 or earlier. If this option is not...
Read more >Annotate a PDF in Preview on Mac - Apple Support
(PDFs are also saved with editable annotations when they're saved ... The signature is no longer available to use in any app where...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same problem, I solved just adding the localUrlAccess option, this is my code:
I hope you find it helpful 👍
Leave this package if you want to nice ans easy css