16
\$\begingroup\$

I was thinking that it could be cool to have an interactive game in a digital resume. For the sake of this question, and scope of this site, let's ignore whether or not this is a good idea.

Is it possible to embed a game or some sort of interactive window inside of a PDF document? This could be using any sort of language or framework. For example, having a small area of the PDF with a CAPTCHA in it.

\$\endgroup\$
  • 8
    \$\begingroup\$ You could put a game on the paper version as well, like a sudoku or so. \$\endgroup\$ – Turion Nov 28 '15 at 20:35
  • \$\begingroup\$ You could also do a hypertext game (like a choose your own adventure story). If the JavaScript that is allowed has the ability to generate random numbers, and store and retrieve, then you should be able to make it more interactive. \$\endgroup\$ – Shule Nov 28 '15 at 21:53
  • 2
    \$\begingroup\$ It would be a lot easier to embed a PDF in a game, if you want a lot more flexibility. \$\endgroup\$ – Shule Nov 28 '15 at 21:55
  • 1
    \$\begingroup\$ You can make your resume be just a website, like this one. \$\endgroup\$ – mgarciaisaia Nov 29 '15 at 17:19
24
\$\begingroup\$

It's not easy to ignore whether or not this is a good idea, but I will do my best to suppress my need to facepalm and concentrate on the pure technical viability.

PDF has Javascript support to add interactive elements to a document. This could be used to implement simple games. But you can't just take a game you implemented in some other technology and embed it in the PDF file. No, not even a browser-based game you developed in Javascript. HTML-Javascript and PDF-Javascript use the same syntax, but have a completely different set of global objects and functions. You will have to use what the PDF API offers you and develop the game specifically for this purpose, and it's not an API intended for game development.

For more information, I recommend the Acrobat JavaScript Scripting Guide by Adobe.

Microsoft Office also has VBA macros which allow the same. There is also support for COM and ActiveX elements, which allows to interface with different technologies, so in some cases it might even be possible to get a game implemented in a different technology to play inside a .docx document. But any sane company would not allow to play macros from files with untrusted origin for security reasons: they allow to do some quite evil things.

\$\endgroup\$
6
\$\begingroup\$

You should be able to insert a flash .swf file from your computer or the internet into a PDF using adobe acrobat. The content can run on the PDF page or in a "floating window". Although there are different security settings from normal web based flash that may prevent your game from running. Here is an article on embedding flash content: https://blogs.adobe.com/pdfdevjunkie/the_flash_designers_guide_to_a

You can also use javascript as Philipp said.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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