SlimerJs PDF Render to file

I am considering SlimerJs (v0.9.6) as an option for rendering PDF files. I have highlighted the HTML from which the PDF is to be made and I run this command to display it:

slimerjs renderPdf.js

      

In my renderPdf.js

file I have defined:

var webpage = require('webpage').create();
webpage
  .open('page.html') // loads a page
  .then(function() {
    webpage.viewportSize = { width: 1240, height: 1754 };
    webpage.render('page.pdf', { 
                      format:'pdf',
                      onlyViewport:true 
                    });
    slimer.exit();
  });

      

I see that the window is open with the HTML-page displayed exactly as expected, but it does not display the specific file page.pdf

. Is there something I am missing to get it to display the file? Or maybe there is a known issue? Any help is greatly appreciated :)

+3


source to share


2 answers


As suggested by @three's comment, I was using the 0.10pre release version and was able to get the PDF. Be aware that this release is not super stable at the time of publication, so you may need to wait for the final build of the build.



0


source


Please note that pdf cups are required to print webpage in pdf slimer js. Install cups pdf using this command, then it will display the page to a local file. And you need a higher version than 0.9.6 (0.10. *).



sudo apt-get install cups-pdf

      

+2


source







All Articles