How to reference HTML elements from embedded PDF?

  html, javascript, pdf

I have very basic knowledge of Javascript and webdev, in general, so please bear with me.

Is it possible for an embedded PDF to ‘communicate’ with the webpage’s elements and vice versa?

I have created a PDF file in Acrobat to test things. I then created a basic HTML file to embed the PDF into:

<!DOCTYPE html>
<html lang="en">
<embed type="application/pdf" src="test.pdf" style="min-height: 100vh; width: 100%;" /></embed>

I can see that I can do a Javascript alert of some hardcoded string via

app.alert("Some text")

Now, when I try to do the below:


I get nothing, not even an error. I’m thinking I just might be missing some keyword such as this.

Source: Ask Javascript Questions