Accessing Print Dialog Box "Pages" property.....Please help...URGENT

348 views
Skip to first unread message

Niketa

unread,
Feb 25, 2009, 11:18:31 AM2/25/09
to Adobe LiveCycle Developers
Hi,
I am using the following line to populate the Print dialog box.

xfa.host.print(1, "0", (xfa.host.numPages-1).toString(), 0, 1, 0, 0,
0)

Is there any way that I can access “Pages” option using JavaScript
with Adobe LiveCycle Designer 8.0 where I can give the page range to
print?

I want to print 3 copies of 1st Page and then the one copy of full
PDF. So in the Pages option of Print dialog box I want to display
1,1,1,1-9. Is there any way to accomplish this programmatically?

Or is there any better way to print 3 copies of 1st page and then 1
copy of whole pdf?

Thanks.

Niketa Parekh

Niall O'Donovan

unread,
Feb 25, 2009, 6:43:31 PM2/25/09
to Adobe LiveCycle Developers
Hi Niketa,

I think that you can achieve this by having four lines of the
xfa.host.print command. The first variable is set to 1, which launches
the print dialogue, I think that this should be set to one in the
first line of text. This way the user can select the correct printer.
Then subsequent lines of script the first variable would be 0, so that
the remaining pages would print automatically.

If you amend the standard print javascript to this...

xfa.host.print(1, "0", "0", 1, 1, 0, 0, 0);
xfa.host.print(0, "0", "0", 1, 1, 0, 0, 0);
xfa.host.print(0, "0", "0", 1, 1, 0, 0, 0);
xfa.host.print(0, "0", (xfa.host.numPages -1).toString(), 1, 1, 0, 0,
0);

... hopefully that will work

Regards,

Niall

Duane Nickull

unread,
Feb 25, 2009, 7:12:04 PM2/25/09
to live...@googlegroups.com
Would this work possibly?

xfa.host.print(0, "0", (1,1,1,(xfa.host.numPages -1).toString()), 1, 1, 0, 0,
0);



On 25/02/09 3:43 PM, "Niall O'Donovan" <NOD...@gmail.com> wrote:

xfa.host.print(0, "0", (xfa.host.numPages -1).toString(), 1, 1, 0, 0,
0);

--
**********************************************************************
Duane Nickull, Vancouver, BC Canada
Senior Technical Evangelist - Adobe LiveCycle ES and Enterprise
Duane's World TV Show - http://tv.adobe.com/#pg+1537
Blog - http://technoracle.blogspot.com
Twitter - http://twitter.com/duanechaos
Community Open Source Music - http://www.mixmatchmusic.com
My Band - http://www.myspace.com/22ndcentury
**********************************************************************

Niketa

unread,
Feb 26, 2009, 9:51:40 AM2/26/09
to Adobe LiveCycle Developers
Hi Niall,

This doesn't work. It allows you to select the printer in the 1st
line. But for last three print commands it prints to the default
printer and not the one selected in 1st command.\\

Regards,
Niketa
> > Niketa Parekh- Hide quoted text -
>
> - Show quoted text -

Niketa

unread,
Feb 26, 2009, 9:53:45 AM2/26/09
to Adobe LiveCycle Developers
Hi Duane,

it didn't work. It just prints one copy of whole pdf!!

Any other ideas?

Thanks.
Niketa

On Feb 25, 6:12 pm, Duane Nickull <dnick...@adobe.com> wrote:
> Would this work possibly?
>
> xfa.host.print(0, "0", (1,1,1,(xfa.host.numPages -1).toString()), 1, 1, 0, 0,
> 0);
>
> On 25/02/09 3:43 PM, "Niall O'Donovan" <NODp...@gmail.com> wrote:
>
> xfa.host.print(0, "0", (xfa.host.numPages -1).toString(), 1, 1, 0, 0,
> 0);
>
> --
> **********************************************************************
> Duane Nickull, Vancouver, BC Canada
> Senior Technical Evangelist - Adobe LiveCycle ES and Enterprise
> Duane's World TV Show -http://tv.adobe.com/#pg+1537
> Blog -http://technoracle.blogspot.com
> Twitter -http://twitter.com/duanechaos

Duane Nickull

unread,
Feb 26, 2009, 10:17:41 AM2/26/09
to live...@googlegroups.com
I'll ask internally.

D

Niall O'Donovan

unread,
Feb 26, 2009, 11:28:58 AM2/26/09
to Adobe LiveCycle Developers
Hi Niketa,

hmm...

We have just tested it here and it works ok. AdobePDF is out default
printer and when we select a different printer, all of the pages
(three of page 1 and the full PDF) print to the new printer.

We are using LC Designer ES and Acrobat 9. Also the script is
Javascript.

Don't know what else to suggest at this stage.

Gook luck!

Niall
> > - Show quoted text -- Hide quoted text -

Niketa

unread,
Feb 26, 2009, 12:39:11 PM2/26/09
to Adobe LiveCycle Developers
In the solutions you suggested, If you click the cancel button on the
Print dialog box(which is the 1st xfa.host.print command), will it
still print the rest of the 3 copies of 1st page?

Thanks a lot for your responses and all your efforts.

Regards,
Niketa

Niall O'Donovan

unread,
Feb 26, 2009, 1:09:47 PM2/26/09
to Adobe LiveCycle Developers
Hi Niketa,

One other suggestion, and this depends on the compexity of your first
page of your form.

You could insert two additional pages after the first page. Then copy
all of the fields on page 1 to exact same positions on the additional
two pages. Set the binding on the fields on page 1 to "Global" (if
this suits / does not upset the rest of your form). Then set the
presence of these two additional pages to Hidden.

Lastly you can then use a standard print button / script, but in the
pre-print event of the print button have

page1a.presence == "visible";
page1b.presence == "visible";

On the post-print event of the button have:

page1a.presence == "hidden";
page1b.presence == "hidden";

This should print what you want; and be reasonably unobstrusive to the
user. However it is not the prettiest and there may be better
solutions out there.

Good luck,

Niall

Niall O'Donovan

unread,
Feb 26, 2009, 1:12:12 PM2/26/09
to Adobe LiveCycle Developers
Sorry, more haste, less speed!

The script should only have one "="

page1a.presence = "visible";

etc.

N.

Niketa

unread,
Feb 26, 2009, 3:13:59 PM2/26/09
to Adobe LiveCycle Developers
Niall,

Is it possible to access the printer name used when it executes the
1st xfa.host.print?

I can then pass this printer name to all other print commands by doing
something like this.
var param = this.getPrintParams();
param.PrinterName = "printer used in 1st command";
xfa.host.print(param);

Is this possible?

Niall O'Donovan

unread,
Feb 26, 2009, 3:32:32 PM2/26/09
to Adobe LiveCycle Developers
Hi Niketa,

No, it is not possible (as far as I know there isn't a workaround)!
There is a section in the Designer help file, which outlines Acrobat
Javascript equivalence in LC Designer. Unfortunately "getPrintParams"
is one of them.

Scripting > Scripting Using LiveCycle Designer ES > Moving from
Scripting in Acrobat to LiveCycle Designer ES > JavaScript objects
from Acrobat supported in LiveCycle Designer ES

Niall

Duane Nickull

unread,
Feb 27, 2009, 1:53:13 AM2/27/09
to live...@googlegroups.com
I have a response back – will post tomorrow.

D

Duane Nickull

unread,
Feb 27, 2009, 11:54:23 AM2/27/09
to live...@googlegroups.com
True.  Here is the feedback I got from the team:


The 'being' and 'end' parameters expect strings that can be converted to numbers that specify a zero-based page index. Passing-in "1,1,1,1-3" will either result in an error in the JavaScript Console or it'll be interpreted as "0" because "1,1,1,1-3" can't be converted to a number...

Being able to provide page numbers plus a range all at once is a UI functionality only. As Stefan already noted, Xfa.host.print does not provide this flexibility.
 
Passing-in "1,1,1,1-3" will result in an error.
 
And I am surprised that the expression
(1,1,1,(xfa.host.numPages -1).toString()); is treated equivalent of (xfa.host.numpages -1).toString(); I expected even xfa.host.print(0, "0", (1,1,1,(xfa.host.numPages -1).toString()), 1, 1, 0, 0, 0); to give an error but  it did print the whole doc.

Niketa

unread,
Feb 27, 2009, 12:20:41 PM2/27/09
to Adobe LiveCycle Developers
Thanks Niall and Duane for all your help.

Niketa

On Feb 27, 10:54 am, Duane Nickull <dnick...@adobe.com> wrote:
> True.  Here is the feedback I got from the team:
>
> The 'being' and 'end' parameters expect strings that can be converted to numbers that specify a zero-based page index. Passing-in "1,1,1,1-3" will either result in an error in the JavaScript Console or it'll be interpreted as "0" because "1,1,1,1-3" can't be converted to a number...
>
> Being able to provide page numbers plus a range all at once is a UI functionality only. As Stefan already noted, Xfa.host.print does not provide this flexibility.
>
> Passing-in "1,1,1,1-3" will result in an error.
>
> And I am surprised that the expression (1,1,1,(xfa.host.numPages -1).toString()); is treated equivalent of (xfa.host.numpages -1).toString(); I expected even xfa.host.print(0, "0", (1,1,1,(xfa.host.numPages -1).toString()), 1, 1, 0, 0, 0); to give an error but  it did print the whole doc.
>
> Twitter -http://twitter.com/duanechaos
> Community Open Source Music -http://www.mixmatchmusic.com
> My Band -http://www.myspace.com/22ndcentury
> **********************************************************************- Hide quoted text -
Reply all
Reply to author
Forward
0 new messages