question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

html-pdf npm library gives weird output on Linux Server?

See original GitHub issue

I am generating PDF from HTML and that worked fine on my local machine, which has Windows as OS. But now I deploy my application on a Linux server where it gives weird output:

const htmlPdf = require('html-pdf')
try{
    let html = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /></head><body><div>Managed APs</div><br /><table><th>AP Serial</th><th>AP Name</th><th>AP Model</th><th>Mac Address</th><th>IP</th><th>Connect Status</th><th>Cluster</th><tr><td>1010212112</td><td >AP_Test</td><td>RJ147</td><td>1.23.2.2</td><td>1.23.12.4</td><td>Connected</td><td>Dummy Cluster</td></tr></table></body></html>`

    htmlPdf.create(html).toBuffer(function(err, buffer){
        if(err){
            return res.json({
                success: false,
                message: dbErrorMessage
            });
        } else{
            const pdfData = buffer.toString('base64')
            return res.json({
                success: true,
                data: pdfData
            });
      }
    });
}
catch(e){
    return res.json({
        success: false,
        message: e 
    });
}

I have also posted query on stackoverflow: https://stackoverflow.com/questions/53866694/html-pdf-npm-library-gives-weird-output-on-linux-server

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Sairam-Chcommented, Feb 6, 2019

@ganeshpaiya I was faced the same issue, If you update the phantomjs in your server then you may not get this issue.along with that in your server update the below packages too. It was works fine to me now. sudo apt-get install libfreetype6 sudo apt-get install libfontconfig

0reactions
RobertDS07commented, Jul 26, 2021

And don’t forgot libconfig

Read more comments on GitHub >

github_iconTop Results From Across the Web

html-pdf npm library gives weird output on Linux Server?
I am generating PDF from HTML and that worked fine on my local machine, which has Windows as OS. But now I deploy...
Read more >
node-html-pdf - npm
HTML to PDF converter that uses phantomjs. Latest version: 3.0.1, last published: 2 years ago. Start using html-pdf in your project by ...
Read more >
Docs • Svelte
SvelteKit utilizes Vite to build your code and handle server-side ... With this, npm run build will generate HTML, JS and CSS files...
Read more >
CoffeeScript
coffee script into a .js JavaScript file of the same name. -t, --transpile, Pipe the CoffeeScript compiler's output through Babel before saving ...
Read more >
How to generate an HTML table and a PDF with Node ...
Puppeteer is a Node library which provides a high-level API to control headless ... You can even do form submissions via your NodeJS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found