【问题标题】:Blank pdf output using jsreport使用jsreport的空白pdf输出
【发布时间】:2020-11-27 15:58:39
【问题描述】:

我知道这必须有一些超级简单的答案,但我只是从这些东西开始并遵循本教程: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

各位聪明人能告诉我怎么回事吗?谢谢

【问题讨论】:

    标签: sql jsreport


    【解决方案1】:

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

    它完美地解决了我的教程问题。

    【讨论】:

      猜你喜欢
      • 2013-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2011-04-17
      • 1970-01-01
      相关资源
      最近更新 更多