Git Product home page Git Product logo

Comments (10)

marcbachmann avatar marcbachmann commented on July 18, 2024

Apparently phantomjs has a dependency on libfontconfig.
So you have to install it using apt-get install libfontconfig.

from node-html-pdf.

marcbachmann avatar marcbachmann commented on July 18, 2024

As stated on the phantomjs page, there are the following dependencies on centos:
sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
Did that work for you?

I tried to run the unit tests, only the first 5 are passing. It stucks on 'task watch..' I don't really know what to do now to make any progress.

The task watch watches for changes in the filesystem. I think it's the correct behaviour to wait for changes. It will execute the tests again when you edit some files.

from node-html-pdf.

jrm2k6 avatar jrm2k6 commented on July 18, 2024

Hi! Will try that asap. Keeping you updated.

from node-html-pdf.

jrm2k6 avatar jrm2k6 commented on July 18, 2024

The html I provide seems to be the issue now. Installing the libs fixed the pdf generation (working with one-line html string). Thanks and sorry for the trouble.

from node-html-pdf.

marcbachmann avatar marcbachmann commented on July 18, 2024

No problem. Thanks for digging into this. I'll update the readme with the dependencies.
Does multiline html not work? I don't have any problem with that.

from node-html-pdf.

jrm2k6 avatar jrm2k6 commented on July 18, 2024

No what I meant was that my big chunk of html that I was passing as a string contained something wrong. I tried out of the blue with a <div>trololol</div> as an input and it worked. I should have just have thought PBKAC instead of 'woot, this library is not working'

from node-html-pdf.

marcbachmann avatar marcbachmann commented on July 18, 2024

😄 Ok

from node-html-pdf.

dv29 avatar dv29 commented on July 18, 2024

I am facing same issue, my html is also correct, everything is ok but it does not work
html-pdf : 2.1.0

from node-html-pdf.

leonjiresse avatar leonjiresse commented on July 18, 2024

Increase the timeout value option (Eg.):
var options = { ..., timeout: 30000 };

from node-html-pdf.

atrvicky avatar atrvicky commented on July 18, 2024

I faced the issue recently on Ubuntu 22.04 LTS. Tried almost every solution here and nothing worked. Finally this helped me resolve it.

  1. Install phantomjs on your local machine (instructions)
  2. In the CreateOptions that you pass to pdf.create, add phantomPath
    Here is my updated CreateOptions
 const pdfOptions = {
    format: "A4", // allowed units: A3, A4, A5, Legal, Letter, Tabloid
    orientation: "portrait", // portrait or landscape
    // Rendering options
    // base: assetPath, // Base path that's used to load files (images, css, js) when they aren't referenced using a host
    localUrlAccess: true, // Prevent local file:// access by passing '--local-url-access=false' to phantomjs
    type: "pdf", // allowed file types: png, jpeg, pdf,
    phantomPath: "/usr/local/bin/phantomjs", // the local installation of phantomjs (use which phantomjs after step 1 to get this path)
  };

from node-html-pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.