Browser client

Standalone distributable jsreport browser sdk


You can use npm

npm install jsreport-browser-client-dist

Or download jsreport.js from the release page

The script itself should be compatible with webpack, requirejs and other script bundlers.


rendering based on submitting hidden form, this works on legacy browsers

jsreport.serverUrl = 'http://localhost:3000';

var request = {
  template: { 
    content: 'foo', engine: 'none', recipe: 'phantom-pdf'

//display report in the new tab
jsreport.render('_blank', request);

//display report in placeholder with id reportPlaceholder
jsreport.render('reportPlaceholder', request);

//display report in placeholder element
jsreport.render(document.getElementById('reportPlaceholder'), request);

//open download dialog for report'myReport.pdf', request);

rendering using ajax calls

//add custom headers to ajax calls
jsreport.headers['Authorization'] = "Basic " + btoa("admin:password")

//render through AJAX request and return promise with array buffer response
jsreport.renderAsync(request).then(function(res) {

  //open in new window

  //open download dialog'test.pdf')


You can find more details about the request argument jsreport-core repository.

Note that the render function serializes the input data into form and urlencoded request. This can easily hit the size limits if the input data set is large. In this case consider rather using renderAsync version. in chrome

The latest chrome currently throws error "Not allowed to navigate top frame to data URL" for call with pdf. This change is documented here. The current workaround is to embed an iframe to the new tab:

jsreport.renderAsync(request).then(function(res) {                        
    var html = '<html>' +
            '<style>html,body {padding:0;margin:0;} iframe {width:100%;height:100%;border:0}</style>' +
            '<body>' +                                
            '<iframe type="application/pdf" src="' +  res.toDataURI() + '"></iframe>' +
    var a ="about:blank", "Report")