使用 jsreport 的空白 pdf 输出

Blank pdf output using jsreport

我知道这必须有一些非常简单的答案,但我只是从这些东西开始,并遵循了本教程:https://jsreport.net/blog/pdf-reports-in-sql-server

除了它给我一个空白页作为输出,没有真正的错误消息。

我正在使用车把和 chrome-pdf 来执行此操作...

我的数据库连接脚本是:

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 });         
}

我可以在调试选项卡中看到它 运行 并正确连接...如果我直接在数据库服务器中测试它,我的 sql 查询似乎是正确的。

我的模板是这样的:

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

调试日志...

+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

你们哪位聪明人能告诉我哪里出了问题吗?谢谢

在此处查看 Jan_blaha 的答案...https://forum.jsreport.net/topic/1814/blank-pdf-output

教程完美解决了我的问题