electron

Silent printing in electron

徘徊边缘 提交于 2019-12-03 07:44:14
I am currently building an electron app. I have a PDF on my local file system which I need to silently print out (on the default printer). I came across the node-printer library, but it doesn't seem to work for me. Is there an easy solution to achieve this? artiebits I recently published NPM package to print PDF files from Node.js and Electron. You can send a PDF file to the default printer or to a specific one. Works fine on Windows and Unix-like operating systems: https://github.com/artiebits/pdf-to-printer . It's easy to install, just (if using yarn ): yarn add pdf-to-printer or (if using

Integrate jQuery into a electron app

风流意气都作罢 提交于 2019-12-03 07:38:01
I'm trying to add jquery functionality to a desktop app written in electron Using the electron-quick-start repo i'm adding the downloaded jquery file to the main.html file like so: <script> require("./jquery.min.js"); </script> or so: <script>window.$ = window.jQuery = require('./jquery.min.js');</script> Then in the index.js file i'm adding code in the createWindow function, since that seems the proper place, but to be honest any place i try gets me the same error more or less. mainWindow.$ is undefined and the same goes for BrowserWindow and app mainWindow is defined inside the createWindow

Live reload for electron application

痞子三分冷 提交于 2019-12-03 07:26:17
问题 I want to use a combination of VScode + Gulp + Electron to build an application. A nice feature of the development workflow would be to add an live reload task to my Gulp watch task, to reload the Electron application on every change. Any Idea how to achieve this? Your help is highly appreciated. 回答1: I was able to achieve this with the gulp-livereload plugin. Here is the code to livereload CSS ONLY. It's the same for everything else though. var gulp = require ('gulp'), run = require('gulp

How do i use mongodb with electron?

橙三吉。 提交于 2019-12-03 07:22:25
问题 I'm currently building a desktop application using Electron and MongoDB. The objective of this application is to collect and store information of various customers in the local scope of the application (not on a server). I've done some research into MongoDB with node.js; however I haven't found a way to use it in Electron. 回答1: This is an electron app for MongoDB management, you can check the code as an example on how to use mongodb and electron. https://github.com/officert/mongotron

'electron-packager' is not recognized as an internal or external command

杀马特。学长 韩版系。学妹 提交于 2019-12-03 07:16:29
I recently started using electron. I have successfully completed the 1st phase by creating a hello world app (included files index.html, main.js, package.json). Now I am trying to package the app using electron-packager but getting this error Steps I have followed: Created a project directory named helloworld. Initialized the project directory using npm init command. Then installed electron using npm install electron --save-dev . Then created the javascript and html files as main.js and index.html respectively. Then used npm start to execute the application. Then installed electron-packager

Mac Electron 应用的签名(signature)和公证(notarization)

孤街浪徒 提交于 2019-12-03 07:11:41
背景 在MacOS 10.14.5之前,应用如果没有签名,那么首次打开时就会弹出这种“恶意软件”的提示框。 这时只要应用签名了,就不会弹这个框。 但在MacOS 10.14.5之后,应用如果没有公证(简单说就是将安装包上传到Apple审查),那么就会弹出更严重的“恶意软件”提示框。 这时就需要在应用签名之后,再进行公证处理(notarize app)。 签名(signature) 签名的步骤,关键是生成一个签名证书,然后用这个证书来签名应用。 PS:开发者账号是必不可少的,这一步骤就不说了。 1、创建一个CertificateSigningRequest.certSigningRequest文件。 填必需的信息 这样就生成一个CertificateSigningRequest.certSigningRequest文件了。 2、生成Developer ID Application证书。 (1)、登陆 https://developer.apple.com/account/resources/certificates/add (2)、点击Certificates,选择添加证书。 (3)、选择 Developer ID Application 类型的证书。 (4)、导入第一步生成的CertificateSigningRequest.certSigningRequest文件

How connect to proxy in electron webview?

别说谁变了你拦得住时间么 提交于 2019-12-03 06:23:19
问题 as I can connect through a to a free proxy server (or pay), currently in use as electron JS solution as desktop application example proxy list servers http://proxylist.hidemyass.com/ 回答1: You can use .setProxy() method of session object. You're able to specify proxy directly like in example below: // in main.js var electron = require('electron'); var BrowserWindow = electron.BrowserWindow; mainWindow = new BrowserWindow({ "width": 970, "height": 500, "center": true, 'title': 'Main window', })

Print from an Electron application

三世轮回 提交于 2019-12-03 05:59:01
问题 I'm trying to use node printer from an Electron application, but as soon I add the lines to use the printer, the app crashes. The console outputs this: [1] 9860 segmentation fault (core dumped) node_modules/electron-prebuilt/dist/electron. This is the app I'm running: var app = require('app'); var BrowserWindow = require('browser-window'); var printer = require('printer'); require('crash-reporter').start(); app.on('ready', function() { var mainWindow = new BrowserWindow({width: 800, height:

Electron Packager - set App Icons for OSX & Windows

会有一股神秘感。 提交于 2019-12-03 05:50:55
I am building my electron application with electron packager for windows and OSX platform. package.json: "build": "electron-packager . $npm_package_productName --out=dist --ignore='^/dist$' --prune --all --icon=icon.icns" I run my build process with npm run build . Question: How can I use the electron packager script in my package.json to set the windows AND osx Icon? Problem: The above script sets the app icon for OSX only. It doesnt set the icon for the windows app (NPM throws failure). Solution: I had to install wine on my OSX. Otherwise it is not possible to build the windows exe with the

How to access BrowserWindow Javascript global from main process in electron?

你离开我真会死。 提交于 2019-12-03 04:46:34
问题 I want a menu, defined in the main process to call JS code inside the current browser window in an atom/electron application. Getting main process globals form the browser window is const remote = require('remote') const foo = remote.getGlobal('foo') What is the equivalent for the main process (aka get current window globals). This is what I want to do in pseudo-code // JS inside main process const BrowserWindow = require('browser-window') //... // Inside the menu callback let window =