These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Changing page size form Letter to A4

mpogra
Registered: Feb 8 2010
Posts: 11
Answered

Hi All,

Can you help me to set the page size from letter to A4. Below is my javascript code that i am using:

var params = this.getPrintParams();
params.printerName="eDco pro";
params.interactive =params.constants.interactionLevel.silent;
this.print(params);

Also is there any way that i can use to print the document without opening it. Basically i am writing code for a applet that uses iText to create a pdf. I am reading the document from server and writing it temporarily on client machine. Above javascript is working fine to print but it is printing in Letter size and requires document to be opened at client.

Please help me i am stuck.

Thanks.
Mahesh

My Product Information:
Reader 8.1.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The paper tray on a random printer cannot be selected directly through a script. Paper source settings are not really standardized. You know, most people only have one paper tray so it's a moot point. Only someone with a big printer has this option. Those people are typically into printing and use a Job file, a JDF.

However, it's very typical for a printer to select the paper source based on paper size. And this is actually an option you can put in the PDF, i.e., select paper source based on size. So one option is for you to resize all your pages to A1.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

mpogra
Registered: Feb 8 2010
Posts: 11
Hi,

Thanks so much the information. So how can i specify the size for all paper using script?

Also can you please throw a light on second query.

Regards,
Mahesh.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The JavaScript code in your first post only operates in Acrobat. So to run it, a document has to be open in Acrobat. There is no way around this.

The only way to modify the page size on the Client side is with an Automation script running in Acrobat Professional. Can you install a script at the client? Since you are using iText to generate the PDF I think a better solution would be create it to be A4 page size in the first place.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

mpogra
Registered: Feb 8 2010
Posts: 11
Thanks for the reply. Yes better solution is to adjust page sie in iText. Thanks for it, i will look into it.

Another question: In 8.1.1 it prints silently the pdf but on version higher then that ask "This document is about to print" like that, i have read about it on forums and solution is to writer either a folder level script of user level script. Well I have tried that but it is not working. Means i have putted a script suggested in http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=12622 in user/folder level. And then i tried to invoke that function from PDF (in the same way as i am doing in iText) but no luck. Any idea about it.

Thanks,
Mahesh.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Please read these articles:
http://www.acrobatusers.com/tutorials/2006/folder_level_scripts
http://www.acrobatusers.com/tutorials/2008/10/using_trusted_functions

Folder level scripts are loaded when Acrobat starts up. They cannot be added after Acrobat has already started. A function defined in a folder level script can be run from anywhere in the Acrobat JavaScript environment, which means it can be run from a acript in a document. I don't know how you are trying to invoke the function, but it has to be done from inside Acrobat.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

mpogra
Registered: Feb 8 2010
Posts: 11
Thanks for the information. I will look into that.

Regards,
Mahesh.