Hi Jan,
Thanks for the quick response. The issue I'm having with running 1.9.8 is getting images to render in the footer (even though I have added the display:none to the template as outlined in doc). Am I doing something wrong?
Hi Jan,
Thanks for the quick response. The issue I'm having with running 1.9.8 is getting images to render in the footer (even though I have added the display:none to the template as outlined in doc). Am I doing something wrong?
Hi,
When I try and use Phantom PDF version 2.1.1, it does not generate table headings on page break. It only works with version 1.9.8.
Any ideas?
Hi,
I am working with PhantomPDF 2.1.1 and when I put in a header, it seems to have a margin around it that I can not control. I have modeled it here:
https://playground.jsreport.net/w/anon/wE5wOs85
You can see that the border and the blue coloured sections are not the same size. How can I control the size of the blue section?
We have switched to jsreport-core and are now getting the error message as seen below.
Here is the server.js
var jsreport = require('jsreport-core')();
var express = require('express');
var app = express();
app.use(express.json());
jsreport.use(require('jsreport-express')({app: app}));
jsreport.use(require('jsreport-phantom-pdf')());
jsreport.use(require('jsreport-jsrender')());
jsreport.use(require('jsreport-templates')());
jsreport.use(require('jsreport-fs-store')());
jsreport.init().catch((e) => {
// error during startup
console.error('Error during startup');
console.error(e.stack);
process.exit(1);
});
// health check
app.get('/health', (req, res) => {
res.sendStatus(200);
})
// report posting
app.post('/api/report', function(req,res) {
console.log('\n');
console.log(req.body);
console.log('\n');
jsreport.render(req.body).then(function(res) {
console.log(res.content.toString());
}).catch((e) => {
// error during render
console.error('Error during render');
console.error(e.stack);
})
});
app.listen(5489);
Post (I have tried using both shortid and name to ensure that it is correct):
{
"template": {
"shortid": "HkVI7bmHE"
},
"data": {
...
}
}
Error:
Error: Unable to find specified template or user doesnt have permissions to read it: Main
at module.exports (/app/node_modules/jsreport-core/lib/util/createError.js:11:13)
at Reporter.createError (/app/node_modules/jsreport-core/lib/reporter.js:265:12)
at AsyncFunction.<anonymous> (/app/node_modules/jsreport-templates/lib/templates.js:142:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
Hi,
I am in the common situation where I am building dynamic tables that are overflowing to multiple pages. If I am correct there is no feature to detect the page breaks so ideally I would like to force page breaks after x
number of rows and repeat the table headings at the top of each page.
I tried to implement a counter using https://www.jsviews.com/#allowcodetag@sample as a guide. This did not seem to work with jsreports. Any ideas how I can do this in a clean way?
I am also looking for use of this as described https://www.jsviews.com/#allowcodetag@sample
Ok I will consider a couple options, thanks so much for all your help!
😳 Wow. That fixed it! Amazing amazing!
One last question... When uploading the PDF to S3, it sets random characters for the name. Is there another place I am supposed to be setting the name?
{
"template": {
"name": "Main"
},
"options": {
"reportName": "myreport",
"reports": { "save": true }
},
"data": {...}
}
Hi, I'm not sure if I have messed something else up, but this is the error I get when I run what you have requested:
error: Error when processing render request The authorization header is malformed; the Credential is mal-formed; expecting "<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request". AuthorizationHeaderMalformed: The authorization header is malformed; the Credential is mal-formed; expecting "<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request".
at Request.extractError (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/services/s3.js:583:35)
at Request.callListeners (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at callNextListener (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at IncomingMessage.onEnd (/app/node_modules/jsreport-aws-s3-storage/node_modules/aws-sdk/lib/event_listeners.js:294:13)
at IncomingMessage.emit (events.js:194:15)
at IncomingMessage.EventEmitter.emit (domain.js:441:20)
2019-03-25T16:58:04.405Z - error: Error during processing request at https://localhost:5489/api/report
I am walking through the s3.js file now to see if I can figure out where this is breaking.
Hmm ok that seems to have fixed some of it! It now loads my keys into aws-s3-storage
which is printing out in the logs. But when I log in to AWS, the PDF file is not uploaded to the S3 bucket. I know the bucket name and keys are correct since I am using them elsewhere to upload a CSV successfully and I did double check that {"save": true}
. Any other ideas?