Blank pdf output using jsreport

I know this has got to have some super easy answer but I am just beginning with this stuff and followed this tutorial: https://jsreport.net/blog/pdf-reports-in-sql-server

Except it gives me a blank page as an output with no real error message.

I'm using handlebars and chrome-pdf to do this...

My database connection script is:

const sql = require('mssql');
const config = {
    "user": "user",
    "password": "password",
    "server": "server",
    "database": "database"
}

async function beforeRender(req, res) {
     await sql.connect(config)
    const sqlReq = new sql.Request();
    const recordset = await sqlReq.query(
        `SELECT DBVersion
      ,MinAppVersion
      

  FROM VersionTbl`
    )
    Object.assign(req.data, {Versions: recordset });         
}

I can see it running and connecting properly in the debug tab... and my sql query seems to be correct if I test it directly in the database server.

My template looks like this:

<table>
{{#each Version}}
    <tr>
        <td>{{DBVersion}}</td>
        <td>{{MinAppVersion}}</td>
    </tr>
{{/each}}
</table>

The debug log...

+0      Starting rendering request 27 (user: null)
+2      Rendering template { name: PQRTemplate, recipe: chrome-pdf, engine: handlebars, preview: true }
+2      Data item not defined for this template.
+9      Resources not defined for this template.
+10     Executing script Connection using dedicated-process strategy
+779    Base url not specified, skipping its injection.
+780    Rendering engine handlebars using dedicated-process strategy
+937    Compiled template not found in the cache, compiling
+951    Executing recipe chrome-pdf
+1041   Converting with chrome HeadlessChrome/79.0.3945.0 using dedicated-process strategy
+1115   Page request: GET (document) file:///C:/Users/********/AppData/Local/Temp/jsreport/autocleanup/264c975a-9ef2-4130-960c-84eeae2ec04a-chrome-pdf.html
+1122   Page request finished: GET (document) file:///C:/Users/*******/AppData/Local/Temp/jsreport/autocleanup/264c975a-9ef2-4130-960c-84eeae2ec04a-chrome-pdf.html
+1124   Running chrome with params {"printBackground":true,"margin":{}}
+1327   Skipping storing report.
+1327   Rendering request 27 finished in 1327 ms

Can any of you smart people tell me what's going wrong? Thanks



Read more here: https://stackoverflow.com/questions/64889811/blank-pdf-output-using-jsreport

Content Attribution

This content was originally published by crunchytoast at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: