Putting some p0wn in your PDF resume with JavaScript

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.

JavaScript alert in PDF

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

  1. Once you have your document created or imported, click on Edit -> JavaScripts.
  2. Click on Add in the Edit JavaScripts window.
  3. 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?");
  4. Click on File -> Save and Exit.
  5. Click on Close in the Edit JavaScripts window.
  6. 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.