How to open documents in electron


#1

Need help to implement one requirement. i am working on electron application and want to open different types documents e.g. pdf, word, xls etc in browser. also once document is open in viewer, user should be able to add some comments and freehand writing on it and save it in some format.


#2

If you want to read files in Electron, you can use the built-in Node fs module.


#3

Leedohm, my requirement is different. I want to display document and allow user to add some comments and freehand writing on top of it.


#4

You will probably have to have a few different layers, one for the document, one for comment elements, and one that recognizes handwriting. In any case, opening and displaying the base document should be pretty standard.


#5

Okay, can you please provide me some pointers for these layers implementation?


#6

Just divs lying on top of one another with JS that figures out whether the user is scrolling, typing, or writing (you probably want keybindings to turn on writing and typing) and some sort of grid framework.


#7

I could find one pdfkit package in nodejs. it can be used to open pdf files. can I write wrapper on top of it to add toolbar and add functionalities like highlighting the text content, creating square/circle marking on text content, freehand writing like drawing on top of pdf?


#8

PDFKit is a PDF generator. A reader would be something like Hummus.