Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Printing in a form

Avatar

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile
_Tim_Henderson_
Level 2

08-12-2008

I have come out here in the past and been able to get some really great help. I hope that it continues. I have a 26 page document that has a 9 page form in it. I would like to be able to put a print button in that automatically sets it up to print just the form. Can someone please tell me it this can be done? Thank you.

Replies

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

08-12-2008

In the print command you can pass a page range to print. Note that this will only work if your users press the print button on your form and not the Print command on the toolbar or Ctrl-p.



The second parameter is a 0 based page number to start at and th e3rd parameter is a 0 based paged number to end at.

Avatar

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile
_Tim_Henderson_
Level 2

08-12-2008

Paul,



Like always you are a great asset to these forums. Thank you but I have one more question to add to this. I just put in the button and the code that was created was



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



So based on what your telling me, to print from pages 16 to 24 I would put in



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



?

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

611 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

09-12-2008

No you would put in:



xfa.host.print(1, "16", "24", 0,1,0,0,0)



Note that the page numbering is 0 based so you may have to use 15-23

Avatar

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile

Avatar
Level 2
_Tim_Henderson_
Level 2

Likes

0 likes

Total Posts

19 posts

Correct Reply

0 solutions
View profile
_Tim_Henderson_
Level 2

09-12-2008

Thank you so much. That is what I think I needed.

Avatar

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct Reply

11 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 4
Ryan_Lunka
Level 4

Likes

11 likes

Total Posts

143 posts

Correct Reply

11 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
Ryan_Lunka
Level 4

09-12-2008

You could also, in the pre-print event, hide all of the pages that will not be printed. Then in the post print event, you show them again. That may get the effect you need.



Ryan Lunka

Cardinal Solutions Group

rlunka@cardinalsolutions.com

Avatar

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 10
Niall_O_Donovan
Level 10

Likes

646 likes

Total Posts

4,352 posts

Correct Reply

786 solutions
Top badges earned
Validate 1
Boost 500
Boost 50
Boost 5
Boost 3
View profile
Niall_O_Donovan
Level 10

01-02-2009

Hi,



Just to add my experiences to the melting pot...



I have a multi page form, in which the number of pages grow depending on user inputs. At the end I have a series of individual pages that the user can print off. I wanted a button on each page that when clicked would print off that one page only. Because I did not know the page number at run time, I set up a numeric field (hidden) called this_page with the following Javascript in the Layout:Ready event:



"this.rawValue = xfa.layout.page(this);"



Then in the regular button click event I had the following Javascript:



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



Therefore no matter what the number of pages visible at run time, the button would print off that one page. There was one incidence where I wanted the button to print off two consecutive pages and all I had to do was amend the 3rd variable to "(this_page.rawValue).toString(),".



Hope this helps...



Regards,



Niall