Preview pdf report on browser



  • Hi, I'm newbe on jsreport.
    I'm just trying to get a sample report via Api. This is my code on a simple html file for a test:

    var data =  { 
      "template": { "name" : "invoice-template" },
      "data" : { "to": "Pavel Sladek", "from": "Jan Blaha",  "price": 800 }
      };
    
    $.post( "http://localhost:5488/api/report", data)
    .done(function( result ) {
    console.log('OK');
    })
    .fail(function( err ) {
    alert( "Errore: " + err );
    });
    

    The "result" variable contains the pdf result stream.
    I'd like to show this result in a "pdf preview" on the web page (like the preview in jsreport studio).
    is there a way to show the contents of the pdf?
    or is the only way to save it and to generate a pdf file on disk to upload it later?


  • administrators

    hi! we have a browser client that let you invoke a report and show it in the browser automatically, you can use that instead of writing your own logic to do it. if you are still curious of how to do it on your own you can take a look at the source code of browser client


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.