Git Product home page Git Product logo

Comments (4)

pofider avatar pofider commented on July 30, 2024

Released in 0.4.1

from jsreport-wkhtmltopdf.

Orvisky avatar Orvisky commented on July 30, 2024

I have just installed version 0.4.1 but it dont work. I set parameter, but library forces it to false, take a look:

  • lib/wkhtmltopdf.js, line 174, i added console.log :
HtmlToPdf.prototype.execute = function (request, response) {
  request.template.wkhtmltopdf = request.template.wkhtmltopdf || {};
  var options = request.template.wkhtmltopdf || {};
  console.log('options ', this.allowLocalFilesAccess, options);
  options.allowLocalFilesAccess = this.allowLocalFilesAccess;
....
  • result
2016-01-25T10:13:08.022Z - info: Rendering anonymous template { recipe:wkhtmltopdf,engine:handlebars}
    options  false { allowLocalFilesAccess: true,
      orientation: 'landscape',
      pageSize: 'A4',
      marginTop: '20',
      marginRight: '20',
      marginLeft: '20',
      marginBottom: '10',

and result was error because of --disable-local-faile-acces.

As you see, I think this part options.allowLocalFilesAccess = this.allowLocalFilesAccess; should be removed. If option allowLocalFilesAccess is not set, it is disabled on line 59:

if (!options.allowLocalFilesAccess) {
    params.push("--disable-local-file-access");
}

Solution.
I have tested it. I commented that one line:

HtmlToPdf.prototype.execute = function (request, response) {
  request.template.wkhtmltopdf = request.template.wkhtmltopdf || {};
  var options = request.template.wkhtmltopdf || {};
  console.log('options ', this.allowLocalFilesAccess, options);
  //options.allowLocalFilesAccess = this.allowLocalFilesAccess;
  • with param allowLocalFilesAccess: true
2016-01-25T10:18:58.510Z - info: Rendering anonymous template { recipe:wkhtmltopdf,engine:handlebars}
    options  false { allowLocalFilesAccess: true,
      orientation: 'landscape',
      pageSize: 'A4',
      marginTop: '20',
      marginRight: '20',
      marginLeft: '20',
      marginBottom: '10',
  • without param allowLocalFilesAccess
2016-01-25T10:21:19.290Z - info: Rendering anonymous template { recipe:wkhtmltopdf,engine:handlebars}
    options  false { orientation: 'landscape',
      pageSize: 'A4',
      marginTop: '20',
      marginRight: '20',
      marginLeft: '20',
      marginBottom: '10',

and result was error because of --disable-local-faile-acces.

Can you remove that one line ?
Thank you

from jsreport-wkhtmltopdf.

pofider avatar pofider commented on July 30, 2024

The wkhtmltopdf.allowLocalFilesAccess is intended to be global configuration value. You need to set it for example in the prod.config.json...

You seems to be passing it is as a per template option, do you need this? Isn't the global configuration affecting all templates sufficient for you?

from jsreport-wkhtmltopdf.

Orvisky avatar Orvisky commented on July 30, 2024

I set it like you wrote. So, "problem" solved. Globally set to access local files. Thank you for advice.

from jsreport-wkhtmltopdf.

Related Issues (6)

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.