0

I'm building an app using Atom Shell, and I'm trying to open an iframe which would load a PDF file, and then, once the PDF file is fully loaded, run some JS from the scope of that iframe (I'm willing to run Browser->Print (https://github.com/atom/atom-shell/blob/master/docs/api/browser-window.md#browserwindowprintoptions).

Is that possible? If so, how?

1 Answer 1

1

Depends on where the PDF file is hosted, but usually the process goes like this:

  1. create a new browser window object with the size/configs desire for you 'iframe' that isn't going to be an actual iframe
  2. .show() the browser window
  3. .loadUrl(INSERT_PDF_URL) into the browser window
  4. listen on browser window webContents 'did-finish-loading' event, and then either run your JS if it is on the browser side, or .executeJavaScript(YOUR_JS_HERE) if you need it to be run on the renderer side (within the browser window)

Not the answer you're looking for? Browse other questions tagged or ask your own question.