JSreport in a standalone desktop application.
-
Hi,
I am very new to jsreport, if anybody feel uncomfort with my question, sorry for that.
I have to generate a report through my desktop application which is been built with nodejs and electronjs. The thing is my application have to work offline and it also need to generate report offline. As per my understanding, to generate report with jsreport we need to connect with their server to generate it. But I actually want to generate the report in my premises itself. Help me with proper guide and solution.
Thanks.
-
hi!
As per my understanding, to generate report with jsreport we need to connect with their server to generate it
jsreport can run locally without internet connection, jsreport does not need to connect to our servers in order to generate reports. more information here.
about your case, you just need to start jsreport from the main process of your electron app, and then use the http api, make requests from your app to start rendering reports, another option for the rendering is to use the nodejs api if you find it more easy to use than http requests.
-
Thanks for your valuable reply @bjrmatos, now i am able to run the jsreport locally and able to generate the report. One more concern from my side is that every-time when I need to generate a report I have to start the server manually, but I need to start it automatically along with the application initialization. I had surfed a lot on internet for that but I didn't get the proper solution. If it is possible please guide me with some references.
-
One more concern from my side is that every-time when I need to generate a report I have to start the server manually, but I need to start it automatically along with the application initialization
hmm starting the server on each report call should not be necessary, i think you just need to call
jsreport.init
on the main process part of your electron app, i can try to guide you if you can setup a repository where i can look at, but try that the content of the repository have just the necessary and it should be minimal, this is the best so we don't get distracted by analyzing other code that is not related to the real problem
-
Thanks for your quick response.
That's great! it worked fine with the electron versions till "v1.7.13".
But when it goes to the latest versions of electron(v1.8.0 and above) it's getting crashed with the following log,
2018-04-25T09:04:07.142Z - info: Initializing jsreport@1.10.0 in development mode using configuration file: jsreport.config.json
2018-04-25T09:04:07.146Z - info: Setting process based strategy for rendering. Please visit http://jsreport.net/learn/configuration for information how to get more performance.
2018-04-25T09:04:07.156Z - info: Searching for available extensions in D:\Electron-jsreport
2018-04-25T09:04:07.300Z - info: Extensions location cache contains up to date information, skipping crawling in D:\Electron-jsreport\node_modules
2018-04-25T09:04:07.324Z - info: Found 30 extensions
2018-04-25T09:04:07.386Z - debug: Writing extension locations cache to C:\Users\BALASU~1\AppData\Local\Temp\jsreport\core\locations.json
2018-04-25T09:04:07.391Z - debug: Discovered 30 extensions
2018-04-25T09:04:07.394Z - info: Using extension import-export
C:\Users\balasubramani\AppData\Roaming\npm\node_modules\electron\dist\electron.exe: c:\projects\electron\vendor\node\src\async-wrap.cc:399: Assertion `env->async_hooks_init_function().IsEmpty()' failed.Please review the log and help me!
-
hmm this looks like an electron bug so we can do nothing about it until they resolve it, however if you have a repository with the same problem i can discard that there is nothing wrong in your code that is causing this. or you can also stick with electron 1.7.13 if you have to make progress with your app
-
Ah!, That's Okay! Will stick with 1.7.13 itself.
I really appreciate your work and quick response :) .