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.
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?
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.