PDF JavaScript

Welcome to the PDF JavaScript Vault.

Below is a tutorial and JavaScript code which you can use in your PDF documents – and they don’t have to be PDF forms to use it.

What is PDF JavaScript?

A language which you can use to tell a PDF document to do something.

What can it do?

You could make a button print a PDF when clicked or calculate a set of values in an invoice

What does it look like?

//Setting some field properties:
        var f = this.getField("MyField");
        f.alignment = "center";
        f.fillColor = color.yellow;
        f.textColor = color.red;
        f.display = display.noPrint;
        f.multiline = true;

Where does it go?

It can be applied to objects in a PDF that someone can click or interact with e.g. a button or drop down list. You can add it to pages so that JavaScript will do something when a page opens or closes.

What next?

Download the PDF JavaScript Starter eBook so that you can get some examples under your belt and then explore the rest of the examples in the vault. Some are quite dusty JavaScript doesn’t hurt…much.

Learning your First PDF JavaScript Script

What you need

PDF Form Wizard

This PDF & JavaScript example uses PDF to customise a PDF form.

All code on this site can be used without warranty.

Copyright © 2019 osuch.com