electron

Silent printing in electron

独自空忆成欢 提交于 2019-12-09 06:10:49
问题 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? 回答1: 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

How to make Electron WebView fill specified size?

南笙酒味 提交于 2019-12-08 22:02:55
问题 I've tried adding an Electron WebView to a basic app and set minwidth and minheight on it as shown below. When it loads though it always ends up as 784px X 150px <webview id="webpage" src="https://www.duckduckgo.com/" autosize="on" minwidth="800px" minheight="1200px"></webview> 回答1: This is an issue other people have reported too. Here in atom discussion webview autosize. It seems that 'autosize' doesn't say the last word about the resulting window size; css parameters may interfere and

Can I use CoffeeScript to write my Electron (Atom Shell) application?

人盡茶涼 提交于 2019-12-08 19:31:51
问题 Does anything special have to be done to get Electron to run my main.coffee file? I have a main.js file (that works) that I converted to CoffeeScript (hence main.coffee ), but when I run Electron main.coffee I get an error like the following: App threw an error when running [SyntaxError: /Users/foo/develop/electron/main.coffee:13 app.on('window-all-closed', -> ^ Unexpected token >] I can only assume this is a CoffeeScript issue, since when I commented the offending code with CoffeeScript's

Dynamic variable @*INC not found

淺唱寂寞╮ 提交于 2019-12-08 18:51:06
问题 So I've been trying to get electron working with Perl6 and looks like after all my efforts of hacking things to get them to work, it just doesn't want to do it's thing. I have used the following script (one of the examples from the electron repo on git): #!/usr/bin/env perl6 use v6; use Electron; my $app = Electron::App.instance; LEAVE { $app.destroy if $app.defined; } say Electron::Dialog.show-open-dialog.perl; say Electron::Dialog.show-save-dialog.perl; say Electron::Dialog.show-message-box

Exit full screen when “esc” is pressed (using javascript with electron)

谁说我不能喝 提交于 2019-12-08 18:39:39
问题 I'm working on an app (with electron) and I would like users to be able to exit fullscreen mode when pressing "esc". I tried different methods, in vain. Here is the code who launch the app in a new browser window in fullscreen mode and display and HTML/CSS content : 'use strict'; const electron = require('electron'); // Module to control application life. const app = electron.app; // Module to create native browser window. const BrowserWindow = electron.BrowserWindow; // Keep a global

require() node module from Electron renderer process served over HTTP

与世无争的帅哥 提交于 2019-12-08 16:03:22
问题 Typically, in an Electron app, you can require node modules from both the main process and the renderer process: var myModule = require('my-module'); However, this doesn't seem to work if the page was loaded via HTTP instead of from the local filesystem. In other words, if I open a window like this: win.loadURL(`file://${__dirname}/index.html`); I can require a node module without problems. But if I instead open a window like this: win.loadURL(`http://localhost:1234/index.html`); I no longer

Electron - How to know when renderer window is ready

旧时模样 提交于 2019-12-08 14:50:27
问题 In my main process I create a renderer window: var mainWindow = new BrowserWindow({ height: 600, width: 800, x: 0, y: 0, frame: false, resizable: true }); mainWindow.openDevTools(); mainWindow.loadURL('file://' + __dirname + '/renderer/index.html'); Then I want to communicate with it in some way: mainWindow.webContents.send('message', 'hello world'); However the main window doesn't receive this message because it isn't fully done being created at the time I attempt to send it. I have

Angular Electron with Nodejs using (MEAN Stack)

回眸只為那壹抹淺笑 提交于 2019-12-08 13:48:29
问题 I have create a MEAN Stack Application (Angular 6). Now I want to convert my application into Desktop Application with the same. we can achieve that in electron so that i read this Article. by using this Article I have created my application. but I am not get request from the application to server(node.js). here is my angular req: postlogindata(body: any): Observable<any> { return this._http.post(`http://192.168.1.174:8085/login`, body, { observe:'body', withCredentials :true, headers:new

How to preload multiple js in electron webview

谁都会走 提交于 2019-12-08 11:35:25
问题 here is electron doc ex: <webview src="https://www.github.com/" preload="./test.js"></webview> how to preload multi js like: <webview src="https://www.github.com/" preload="./test.js,./test2.js"></webview> 回答1: In electron > webview > preload doc say: When the guest page doesn’t have node integration this script will still have access to all Node APIs, but global objects injected by Node will be deleted after this script has finished executing. so I can use nodejs require in js, following is

Angular & Electron - IPC communication between main & render processes

ⅰ亾dé卋堺 提交于 2019-12-08 07:24:23
问题 There are small model: export class SettingsModel { DbFileName: string; } Main process: ipcMain.on('getSettings', function(event) { event.sender.send('resultSettings', 'Test settings'); }); IpcService: import { Injectable } from '@angular/core'; import { ElectronService } from 'ngx-electron'; @Injectable() export class IpcService { constructor(private _electronService: ElectronService) {} public on(channel: string, listener: Function): void { this._electronService.ipcRenderer.on(channel,