Can I use electron without any GUI?


#1

Hello there,

I am actually working on a project that could make good use of the printToPDF() BrowserWindow’s method to print a PDF file from a loaded URL in a WYSIWYG fashion. I have succeeded using this with an invisible window and my question now is: Can I use electron in an environment with no GUI? Like a CentOS server.

Thanks for your help.


#2

PhantomJS is probably the better option in your situation.


#3

Node.js would be the one to use because it’s the core of Electron.


#4

Thanks for your input. I dug into PhantomJS and I believe it is the better
option.


#5

Node.js would be the one to use because it’s the core of Electron.

Well, vanilla node.js has no access to the Web API (of Chrome) but @eddydarell explicitly asked for that. :slight_smile:
Phantom.js is a node.js library and provides that. Was probably not clear in my initial post.


#6

Thank you @nylki. I will settle with PhantomJS just this once because I call to it from PHP.


#7

@eddydarell - you could look at https://github.com/fraserxu/electron-pdf


#8

Hello @maxg7. Thanks for your input. I have just one little problem: I do I do to get the PDF buffer (not the file) because I’d like to keep it in memory and deliver it to a php script without having to write on the disk.