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

xfa.host.numPages still contains old values after form rendering

Avatar

Avatar
Level 1
fox9991
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
fox9991
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
fox9991
Level 1

28-01-2009

I have developed a pdf that needs further rendering after user fill in the form, I simply create a button called "Print_A" that will run scripts to render the form, print it out (I use app.execMenuItem(Print) instead of xfa.host.print) and finally revert the rendered look back to the original look as user press the button before.



However, problem comes if I want to print a saved pdf without opening Acrobat (ie. from Window Explorer), I work it out by adding scripts to render the form at the forms prePrint event, the form did rendered and printed but only for the 1st page.



I have tried putting the script at the form's "docReady" event, the result is the same, only 1st rendered page got printed.



I have debugged and it seems that xfa.host.numPages still remains 1 after form rendering (that is why only 1st page is printed), however, xfa.layout.pageCount() shows the correct no. of pages afer rendering.



I explicity assign the correct value to xfa.host.numPages but it doesn't work, it is still equal to 1.



Any idea?

Replies

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct Reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

29-01-2009

I've encountered this problem also.



I worked it out as being the print command is sent before the form has finished rendering, so even though you are telling it to print say 5 pages, it can only see 1 so it passes that number through.



I haven't worked out a solution yet.



Tom

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

29-01-2009

If Thomas is correct you should be able to proove it by adding a second button to do the print. Hit the first button to fix up the rendering then hit the second button to do the print. Does it still happen?

Avatar

Avatar
Level 1
fox9991
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
fox9991
Level 1

Likes

0 likes

Total Posts

6 posts

Correct Reply

0 solutions
View profile
fox9991
Level 1

29-01-2009

If the actions are separated by two buttons, one for rendering pages and the other for printing by 'xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0)', then all rendered pages got printed, but if two actions are combined within one button, only 1st rendered page is printed.



However I solve the above case by using app.execMenuItem(Print) instead of xfa.host.print, now all rendered pages got printed.



But if I print the pdf from Windows Explorer without opening Acrobat application, I can't manipulate the print action after rendering the form on DocReady or prePrint event, and so only 1st rendered page is printed.