Print Page | Close Window

Wanting to refine a Print Button to scale to fit

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 15 Sep 2019 at 8:57am
Software Version: Web Wiz Forums 11.10 -

Topic: Wanting to refine a Print Button to scale to fit
Posted By: Alex8888
Subject: Wanting to refine a Print Button to scale to fit
Date Posted: 05 Jun 2018 at 2:20pm
Hi folks, 

I've used this JavaScript 

this.print (false, this.pageNum,
to print the current page of the pdf. 

(I found the script in this article on Planet PDF which I found super-helpful: - )

It works well, but it doesn't scale the page to fit on an 8.5 x 11 sheet of paper, so the margins are getting cropped off. I'm wondering if I can set it so that the page automatically scales to fit the paper, without having to open up the print dialog box and require the user to select that option manually. 

I've hunted around in this forum and on the web in general to see if anyone has asked this question before, but I haven't found what I'm looking for. 

I'd appreciate any ideas, directions or suggestions.

Many thanks,

Alex Hickey
Freelance Print Production Artist

Posted By: gkaiseril
Date Posted: 07 Jun 2018 at 3:23am
That is a pretty old post. Adobe has has added the - PrintParams object that provides more control over printed output. You would use the - pageHandling values.

 var pp = this.getPrintParams();

   pp.pageHandling =;

   pp.firstPage = this.pageNum;

   pp.lastPage = this.pageNum;

   pp.interactive = pp.constants.interactionLevel.automatic;


Posted By: Alex8888
Date Posted: 07 Jun 2018 at 9:14pm
This is awesome, gkaiseril. It works perfectly! Thank you, very, very, much! 

Alex Hickey
Freelance Print Production Artist

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -