How to use wkhtmltopdf - 2 common examples

To help you get started, we’ve selected a few wkhtmltopdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zxc0328 / readme / server.js View on Github external
// Create a new Redux store instance
  const store = createStore(rootReducer, state)
  
  // Render the component to a string
  const html = renderToString(
    
    	<div>
      	
    	</div>
  	
  )

  const fileName =  uuid.v4() + '.pdf'

  wkhtmltopdf(renderFullPage(html), 
  { 
    output: './pdf/' + fileName,
    marginTop: 0,
    marginBottom: 0,
    marginLeft: 0,
    marginRight:0,
    disableSmartShrinking:true
  }, 
  function (code, signal) {
    res.send(JSON.stringify({fileName}))
  })
}
github dtysky / MoeNotes / src / components / file-exporter.js View on Github external
exportPDF(fp){
        wkhtmltopdf(this.getCurrentHTML(),
            {
                marginBottom: 0,
                marginTop: 20,
                marginLeft: 10,
                marginRight: 10
            },
            function(err) {
                console.log(err);
            }
        ).pipe(
            fs.createWriteStream(fp)
        );
    }

wkhtmltopdf

A wrapper for the wkhtmltopdf HTML to PDF converter using WebKit

Unknown
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular wkhtmltopdf functions