Tips & Tricks

Silently Printing Your PDF

March 23, 2000

Advertisement
Advertisement
 

If you have ever had the need to give your end users a 'Print' button on the page then read on.

Select the Form Field tool (see Figure 1.1), and draw a small button sized area on the page (see Figure 1.2). When the Form Field dialog comes up give the Field a name (myButton) and select 'Button' from the 'Type' list box (see Figure 1.3).


Figure 1.1


Figure 1.2


Figure 1.3

Click the 'Actions' tab and select the 'Mouse Up' event and click the 'Add...' button. Select 'JavaScript' from the 'Type' listbox, and click the 'Edit...' button (see Figure 1.4).


Figure 1.4

Type the following Javascript code into the editor window (case sensitive) to (see Figure 1.5):


Figure 1.5

Print the Current Page only:

this.print(false,this.pageNum, this.pageNum,false);    

OR

Print from the current page to the end of the document:

this.print(false,this.pageNum, this.numPages,false);

The four parts of the javascript print command are:

  • True/False - Determines whether the 'Print Dialog' window is displayed.
  • Start Page Number
  • End Page Number
  • True/False - Determines whether the 'Cancel' print job dialog window is displayed.

You can type any valid page number in place of the 'this.pageNum' and 'this.numPages' statements.

Note: If you want to put some text on the 'face' of the button see below Figure 1.6 and Figure 1.7.


Figure 1.6


Figure 1.7

Copyright Dave Wraight & Planet PDF. No unauthorised reproduction, distribution or publication permitted.

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

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.