I was applying for an information security analyst position recently and thought it would be appropriate to embed some JavaScript in the PDF version to make fun of anyone that opened it in Adobe Reader with JavaScript enabled.
This article provides instructions on how to embed JavaScript into a PDF without using Adobe Reader.
The tools
Download and install Scribus, an open source desktop publishing application.
Embedding the JavaScript
- Once you have your document created or imported, click on Edit -> JavaScripts.
- Click on Add in the Edit JavaScripts window.
- Enter the following code (completely replace the function that is automatically created):
var viewer=app.viewerType;if(viewer=='Reader'){viewer="Running Adobe Reader with JavaScript enabled?"}else{viewer="Using a PDF reader with JavaScript enabled?"}app.alert(viewer, 0, 2, "Really?");
- Click on File -> Save and Exit.
- Click on Close in the Edit JavaScripts window.
- Export your PDF by clicking on File -> Export -> Save as PDF.
My JavaScript checks to see if they’re using Adobe Reader with JavaScript enabled and admonishes them if they are. Additionally, if they’re using a different PDF reader with JavaScript enabled, I give them a hard time, anyway.
Good luck getting a job if you do this to your resume. If you’re less brave, you might just use this How-To to embed JavaScript into a PDF. You can refer to the Acrobat JavaScript Scripting Reference.
You can download my resume with the embedded JavaScript here.