I sent you an email.
Matthew Ward
@Matthew Ward
Posts made by Matthew Ward
-
Increase Online Limits
Would it be possible to set up a separate billing price if I wanted to increase the account limits for jsreportonline?
For example, timeout times, parallel render requests etc.? -
RE: Download pdf or xlsx response so that I can email it.
I figured it out.
var file = res.toDataURI();
That gives me the base64 encoded pdf in a string. So, once I put that in the variable I just did an ajax call in javascript where I then handle the rest in .php.
$f = str_replace('data:application/pdf;base64,', '', $f);
file_put_contents( EMAIL_ATTACHMENTS .$file, $f);
$fp = fopen(EMAIL_ATTACHMENTS . $file, 'wb');
fwrite($fp, base64_decode($f));
fclose($fp);That saves the pdf to the attachments file where I temporarily store the file to attach to emails using sendgrid.
-
Download pdf or xlsx response so that I can email it.
Quick background. I'm using jsreportonline. I'm creating a bunch of custom templates on the fly based off various user data. I'm doing all of this in JavaScript as the whole program is client-side. So, all of the solutions that use NodeJS are no good. I am currently viewing the pdf in a new window where the user can download it. Now, if the user wants to email the file I think my best bet is to download the file temporarily then attach that file and email it over sendgrid like I do normally. But I can't find a way to save the file to a specific path instead of downloading it to the computer in the browser.
This is my current code to view the pdf. Any direction on where to go from here on downloading the pdf so I can email it.
var request = { template: { content: header + contentString, name: "invoice-main", engine: engine, recipe: recipe, helpers: helpers, chrome: { landscape: isLand, marginTop: '20px', marginRight: '20px', marginBottom: '20px', marginLeft: '20px' }, reports: { save: true } }, data: aa }; jsreport.renderAsync(request).then(function(res) { console.log( "in async...." ); var html = '<html>' + '<style>html,body {padding:0;margin:0;} iframe {width:100%;height:100%;border:0}</style>' + '<body>' + '<iframe type="application/pdf" src="' + res.toDataURI() + '"></iframe>' + '</body></html>'; var a = window.open( "" , "", "wReport', top=2, left=2, " + "toolbar=no, menubar=no, location=1, height=900, " + "width=960, scrollbars=yes" ); a.document.write(html); a.document.title = title; a.onload = function() { parent.close(); } a.document.close(); })
-
RE: API Timeout | JsReportOnline
I can't find any way to get the header "JO-Credits-Spent".
-
RE: API Timeout | JsReportOnline
Do you have an example of getting that? I keep getting "undefined" when I try a few different ways to access the response header.
My code looks like this..
jsreport.renderAsync(request).then(function(res) { console.log( "in async...." ); var html = '<html>' + '<style>html,body {padding:0;margin:0;} iframe {width:100%;height:100%;border:0}</style>' + '<body>' + '<iframe type="application/pdf" src="' + res.toDataURI() + '"></iframe>' + '</body></html>'; var a = window.open("about:blank", "Report") a.document.write(html) a.document.close();
-
RE: API Timeout | JsReportOnline
I talked to my boss about this. The 1000s throttle could also be an issue. If we had 300 users submit a request for a report within 5 minutes it would be an issue. Is the 1000s throttle something that could be changed? We might be able to live with the timeout issue.
Another question is since I am using the API is there a way to know how many credits a report is using? I'd like to have that value returned somehow so I can store it.
-
API Timeout | JsReportOnline
I am currently using the API for JsReport Online.
There is a 20s timeout for chrome-pdf and a 10s timeout for html-to-xlsx.
I'm using the free version right now for development but when this goes into production we were thinking we would AT LEAST need the silver $100 per month subscription. If we move off of the free version will that help with the timeout times?It's a school software so in the example of a school printing something that involves all the students the 20s timeout is not enough. Plus multiple users could be queering at the same time.