Tips & Tricks

Adding Page Number to PDFs

April 01, 2004

Advertisement
Advertisement
 

When creating PDFs from a layout application, you can easily place page numbers on each page. However, when using different producer applications and merging PDF files, you won't have a chance to add page numbers unless they are uniquely added in the right order in each program that produces the PDFs to be merged together.

Add to this any pages that might be downloaded with Web Capture, and you'll quickly find a need to create page numbers after the final PDF has been created.

By using a little JavaScript, we can add page numbers easily in Acrobat 5.0.

Create a Button Field.

Select the Form tool from the top level Acrobat toolbar and drag open a rectangle on a page in a PDF file. For the Type, select Button.

Supply a name for the field. In this example I used pageNo for the field name.

In the Field Properties dialog box, click on the Action tab. The default "When this happens" item will be MouseUp. Leave the item selected for MouseUp and click on the Add button.

The Add an Action dialog box will appear. In this dialog box select JavaScript from the pull down menu.

Click on Set Action to open the JavaScript editor

Note: For Windows users, Acrobat 5.0 enables you to use a text editor of choice for editing JavaScript code. Select the Edit -> Preferences -> General menu command to open the Preferences dialog box. Click on JavaScript on the left side of the dialog box to open the JavaScript preferences. On the right side of the dialog box, select the External Editor radio button and click on the Choose button. Navigate to your editor and Select it.

In the JavaScript Editor, enter the code as illustrated left. For an easy copy and paste option, download my Acrobat Forms sample file below.

Note: the code at left will place a page number in the top right corner of each PDF page. To place the page number in a different location, you need to change the coordinates listed between the brackets [...] in the first line of code.

When finished in the JavaScript Editor, close the dialog box and save the edits. Click on Set Action when returned to the Add an Action dialog box. Then click OK in the Fields Properties dialog box.

To add the page numbers, click on the Button field you created. Delete the button after creating the page numbers. You can also paste the button into a template where you can keep different JavaScripts for repeated use.

Related Products at PDF Store

PitStop Professional

The industry standard that combines preflight, interactive editing and automated correction capabili... View full product details
Download free demo

Nitro PDF Professional

Nitro PDF Professional, your PDF creation and editing product. Priced at $99, Nitro PDF Pro is the m... View full product details
Download free demo

ARTS PDF Aerialist

Take Acrobat to the next level with advanced splitting and merging; flexible bookmark creation and m... View full product details
Download free demo

PDF In-Depth Free Product Trials Ubiquitous PDF

Nitro PDF Professional

the perfect PDF product for business and enterprise, combining an extremely competitive price with a...

Download free demo

XpdfViewer

This ActiveX control (OCX) provides a PDF file viewer component, enabling developers to add PDF viewing...

Download free demo

Ubiquitous PDF: PDF eBooks-Library

If you are looking for a good store of PDF content, you could do a lot worse than visiting eBooks-Library.com...

September 03, 2009
Search Planet PDF
more searching options...







Create PDF Free

Most Popluar Articles
Planet PDF Newsletter
Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.

Featured Product

Docmetrics

Generate more, higher-quality sales leads from your PDF marketing content. Docmetrics is a web-based system that lets you capture previously unavailable reader data. Free trial.

Platinum Sponsor
Create & Edit PDF - Nitro PDF Software

ARTS PDF

Silver Sponsors

PDF-Tools enfocus

QuickPDF: The Unrivaled PDF Developer Toolkit