#How do I send a PDF file from the main process to the renderer process?

22 messages · Page 1 of 1 (latest)

hazy geyser
#

pdfjs-dist gets a promise when you load a pdf file, which I'm trying to send to the renderer, but whatever I do, I always get error messages

worn arch
#

what is renderer.worker.js?

hazy geyser
#

It's some file in the pdfjs library

worn arch
#

then its problem with pdfjs?

hazy geyser
#

I think it throws an error because no valid promise was sent

worn arch
#

error say file not found

hazy geyser
#

Yeah, it can't load the file, and then maybe it still tries to perform some actions on the invalid file

#

I'm not sure

#

Are you aware of a way to store files of any kind in the main process such that they are accessible from the renderer?

#

I'd really like to get around sending files with ipc

worn arch
#

i dont understand

#

you can access files from main and from renderer same way

worn arch
#

and work with fs same way as main

#

from preload

hazy geyser
#

Ah

worn arch
#

i dont think sending pdf file via ipc is a good way

hazy geyser
#

So preload a function that gets a file from the disk using a file path?

worn arch
#

preload is a file that have access to nodejs api

hazy geyser
#

Cool