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

Printing only page 2 of a two page form

DaveyB
Registered: Dec 10 2010
Posts: 70
Answered

I have a two page form, page one is used for the capture of the data, and page two alters the layout of the data for printing and adds other fields to the display. The entire form uses a single master page and a total of 3 subforms, 2 on the first page and one on the second.
 
The subform presence on the first page is set to visible, screen only while the subform on the second page is set to print only. This avoids confusing the user by having the print format visible. There is a print button on the first page which will pop up the print dialog and print the second page only.
 
Users, being users, have discovered the print icon at the top of Reader, which obviously prints both pages (the first one is completely blank) unless they change the print range field in the dialog which, users being users, they won't do. I did some searching and found a solution of sorts: in the form1:preprint event I added
 
xfa.host.print(1, "1", "1", 0, 1, 0, 0, 0)
 
This does exactly what I need; on pressing the print icon, it pops up the dialog box with the print range set to page 2 only and prints perfectly. The problem is that the dialog box won't go away after printing, it pops up again and again! I had to use task manager to kill the whole form to get rid of it! The 4th parameter is set to '0', so it should permit cancelling the print, but that doesn't get rid of the dialog either. It's possessed!!
 
Any suggestions as to what else I need to do in order to fix this?
 
Incidentally, this is LiveCycle 8.0 running in Windows.
 
Thanks in advance!
 
Dave

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Accepted Answer
Hi,

you can change the presence of your pages in the prePrint/postPrint events.
Let's say you have two pages 'interactive' and 'print', then you need the following scripts.

Hide 'interactive' and show 'print'.
  1. Form1::prePrint - (JavaScript, client)
  2. Interactive.presence = "hidden";
  3. Print.presence = "visible";
  4. xfa.layout.relayout();
Show 'interactive' and hide 'print'.
  1. Form1::postPrint - (JavaScript, client)
  2. Interactive.presence = "visible";
  3. Print.presence = "hidden";
  4. xfa.layout.relayout();

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

DaveyB
Registered: Dec 10 2010
Posts: 70
I had tried this before and it didn't work, but on looking at it closer, I realized I was using flow to create the second page and didn't have any pages specified in the hierarchy. I added those in and broke all the scripts from top to bottom, so I edited them all and it now works.

One thing I did need to change was to remove the "Print.presence = 'hidden'" line. The first page is for the calltaker to fill in, and the captured data is checked for errors and then scripted onto the second page on exit from each field. By having the second page hidden (excluded), none of these scripts work, so I left the second page visible and the subform on it is 'hidden, print only' so that the fields are not visible to the calltaker.

Anyway, long story short, it is now working, thanks Radzmar!!

Dave

LiveCycle Designer 8.0
"Genius is one percent inspiration, ninety-nine percent perspiration." ~~ Thomas Edison
"If at first you don't succeed, get a bigger hammer." ~~ Alan Lewis
"If the conventional doesn't work, try the unconventional" ~~ DaveyB