Creating a Click-thru Agreement in a PDF

A click-thru (sometimes called ClickWrap) agreement is a software or web-based acceptance of terms.

Click-thru agreements rely on the recipient clicking “OK” or “I agree” to accept the terms of the agreement.

Click thru example

I recently received this email message about Click-thru PDF agreements:

Is it possible to create a message that appears prior to a [PDF] document being opened to accept terms and conditions? If the user would click “Yes” the PDF would open. If the user click “No” the document would close.

Short answer: Yes!

Yes, there are a number legal decisions on the subject.

The earliest reference I found was to ProCD v. Zeidenberg (text), which established that clicking a button in a software program constituted acceptance of terms.

A number of relevant court decisions may be found here: Click-Wrap Agreement – Internet Library of Law and Court Decisions.

In this article, I’ll show you how to create an alert message that pops up when a PDF is opened:

JavaScript Message Window for Click-thru agreement

Sample Click-thru Agreement in PDF

One powerful feature of Acrobat is the ability to extend capabilities using the JavaScript scripting language.

You don’t need to know anything about scripting to do this, just use a bit of cutting and pasting from the document below:

Click-thru Instructions.pdf (89K)

You’ll need to click the YES button or the document will close immediately.

Save the link below to your desktop, then open it in Acrobat (not in your browser).

NOTE: Full instructions are on the document itself, so you do not need to refer to the instructions below. They are provided for overview purposes.

Grab the Click-thru Script from the Sample Document

  1. Open Pages Panel of the Click-thru Instructions.pdf
    —Select the first page of the document
    — Right-click and choose Page Properties
    Accessing Page Properties
  2. Click the Actions tab
    A)Click the Run a JavaScript action
    BClick the Edit button
    Setting the JavaScript Action
  3. In the JavaScript Editor window
    — Select all the text
    — Right-click and choose Copy
  4. Copying text from the sample file
  5. Click OK twice.
  6. Close the document.

Add the Message JavaScript to your own Document

  1. Open the PDF to which you want to add the Click-thru agreement.
  2. Open the Pages Panel
    —Select the first page of the document
    — Right-click and choose Page Properties
  3. Click the Actions tab
    — From the Select Action menu, choose Run a JavaScript
  4. Choosing Run a JavaScript as the Page Property action
  5. Click the Add button
  6. Right-click and choose Paste
    To change the text, see note below
  7. Click OK twice.
  8. Save your document

#### Editing the text for the JavaScript Message- Yellow may be edited as needed. - \n\n is a line break. OK to delete. - Green text is the window name.Make sure you only edit text in the highlighted areas and do not remove quote marks.var nButton = app.alert({``cMsg: "Do you agree to the terms and conditions specified by your user agreement with XYZ Corporation?\n\n If you click No the document will close.",``cTitle: "Legal Notice",``nIcon: 2, nType: 2``});``if ( nButton == 3 ) this.closeDoc();


There are a few limitations associated with this technique to add a Click-thru to a PDF.

If the Adobe Reader user turns off JavaScript in user preferences, the document will still open. They will see this message however:

JavaScript disabled message

They can enable the JavaScript for any the document and the message will appear. Most users do not disable JavaScript, so it is rare that you would run into this.

The message window does not scroll, so there is a practical limit to the amount of text you can add. On a 1024 X 768 monitor, that limit is about 14-16 lines of text:

A JavaScript message window with 14 lines of text.

Ideally, you’d want to place the entire text of the agreement into the message window. If it doesn’t fit, you have a couple of choices:

  1. Add a URL to the agreement in the message window. For example:
  2. Read our User Agreement at
  3. It won’t be a clickable link, however.
  4. Add the user agreement to the first page of the document, so it is viewable behind the message.
  5. Add a link to the User Agreement using Headers or Footers

One final note: In addition to the Click-thru, you could optionally have security on the document to prevent unauthorized changes.