skip to Main Content

I have a dumb idea to try to make a program that isn’t blocked on any computer, as it would be embedded in a PDF (I heard that Javascript can be run in a PDF). It would run HTML5 and Javascript(along with a little bit of CSS) inside the PDF file and would mostly use the canvas element in HTML5 and WebGL in Javascript. Is this possible?

3

Answers


  1. No.

    PDFs can embed JS in the same way that HTML can embed JS.

    PDFs can’t embed HTML. They do not have anything equivalent to a canvas element.

    Login or Signup to reply.
  2. Embedding HTML5, JavaScript, and WebGL in a PDF is possible but comes with limitations, security risks, and potential compatibility issues with different viewers. For interactive content, using web browsers is a more practical and reliable approach.

    Login or Signup to reply.
  3. This will help you, have a look at below paragraph.

    PDF (Portable Document Format) files are primarily designed for displaying and sharing documents across different platforms while preserving their formatting. PDFs are not inherently designed to support HTML5 and JavaScript interactivity like a web browser does.

    However, there are some limited ways in which PDFs can incorporate elements of HTML and JavaScript:

    Annotations: PDFs can include annotations, which can be used to add simple interactivity, links, and even some JavaScript actions. These actions can be triggered by clicking on a link or annotation in the PDF.

    Form Fields: PDFs can have interactive form fields (text fields, checkboxes, radio buttons, etc.) that can be filled out by users. These fields can have JavaScript actions associated with them to perform certain actions when filled out or clicked.

    Embedded Content: PDFs can embed various types of media, including images, audio, and video. While these can’t directly run HTML5 or JavaScript, they can provide a certain level of interactivity within the PDF.

    Rich Media Annotations: PDFs can include Rich Media Annotations (RMA), which can embed Flash content, 3D models, and interactive forms. However, support for Flash and interactive 3D content has become less common due to security concerns and the shift away from Flash technology.

    It’s important to note that the level of interactivity and functionality achievable within a PDF is much more limited compared to what can be achieved using HTML5 and JavaScript in a web browser. If you’re looking to create interactive and dynamic content, it’s generally better to use web technologies and platforms designed for that purpose, rather than relying solely on PDFs.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search