Closed Ackhuman closed 2 years ago
There was a wrong string type in Chrome.Scale
. I've pushed NuGet jsreport.Types@2.7.4
with the fix. Please update. The following should work then.
var res = rs.RenderAsync(new RenderRequest
{
Template = new Template
{
Engine = Engine.None,
Recipe = Recipe.ChromePdf,
Content = "main",
PdfOperations = new [] {
new PdfOperation
{
Type = PdfOperationType.Merge,
Template = new Template
{
Engine = Engine.None,
Recipe = Recipe.ChromePdf,
Content = "header",
Chrome = new Chrome
{
Scale = 2
}
}
}
}
}
}).Result;
I'm using the PdfOperations feature of JsReport.Client for headers and footers. I'm using ChromePdf and a Merge operation.
I tried to use the Scale parameter in the Chrome configuration for the header/footer template, and I get an error:
Error when processing render request 57 Protocol error (Page.printToPDF): Invalid parameters Failed to deserialize params.scale - BINDINGS: double value expected at position 122 Error: Protocol error (Page.printToPDF): Invalid parameters Failed to deserialize params.scale - BINDINGS: double value expected at position 122 at C:\dev\jsreport\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise ()
at CDPSession.send (C:\dev\jsreport\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16)
at Page.createPDFStream (C:\dev\jsreport\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:2028:50)
at Page.pdf (C:\dev\jsreport\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:2057:37)
at C:\dev\jsreport\node_modules\@jsreport\jsreport-chrome-pdf\lib\conversion.js:357:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async C:\dev\jsreport\node_modules\@jsreport\jsreport-chrome-pdf\lib\conversion.js:398:22 rootId=rdbuf0l5cy2aj0l, id=4lhfuyt34gpk8ok
This happens in both the production project I'm working on and in a minimal repro project I created to see if I caused the problem. It happens on both a local node server and on the official server, so I don't think it's a configuration issue. The Scale parameter works fine for the main template.
I'm able to work around this problem so it's not a critical issue.