Expand my Community achievements bar.

Printing 2 copies of a document where a floating field change

Avatar

Former Community Member

hi experts,

Context:

I have an interactive form compiled by a user.

when compiling is finished, I'd need to print 2 copies of that document; the 2 copies are exactly the same but a floating field that has to change, i.e. 'Copy for ME' and 'Copy for the CUSTOMER'.

Placing  2 print buttons it's not a problem, in the first button I set the Floating field to 'Copy for ME' and send a print command, in the second I do exactly the same with the 'Copy for the CUSTOMER'.

Which is the best strategy to print those 2 copies clicking the print button only once and showing the printing window only once with the whole printing spool (2 copies)?

Best regards,

Dariush.

8 Replies

Avatar

Former Community Member

no hints for that?

any suggestions?

Thank you very much,

Dariush.

Avatar

Former Community Member

I think you are doing it the easiest way now ....my only other idea involves creating a 2nd copy and setting the presence to print only (having the text aleady set on that one).

Paul

Avatar

Former Community Member

Hi Paul,

is there an easy way to duplicate all the form pages at runtime before printing?

I'd avoid to duplicate the entire content during design due to a complex procedure mantaining the final document (if any correction needed, I'd modify the document twice).

Bet regards,

Dariush.

Avatar

Former Community Member

It woudl depend on how the form is defined ...if it is a dynamic form then you can simply use the subforms addInstance method to add a new copy of it....if it is not designed that way ...i would recommend that you make a copy in Designer and use the presence properties for those pages to hide and show it.

paul

Avatar

Level 1

Try this in a click event of a "Print Form" object:

form1.#subform[0].PrintButton1::click - (JavaScript, client)

// First copy (with printer dialog):

xfa.host.messageBox("Company copy (send this copy for blah blah blah)","Printer:");

TextField1.rawValue="COMPANY COPY";

xfa.event.re

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

// Second copy (without printer dialog):

TextField1.rawValue="CUSTOMER COPY";

xfa.host.messageBox("Customer copy (save this copy for blah blah blah)","Pritner:");

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

The problem is messagebox. if second messagembox line is omited, no changes shown in texfield1 fields .

First messagebox can be ommited but second messagebox sentence is mandatory.

Other idea is using "post print" event for "reprint" entire form but untested for me.

Avatar

Former Community Member

@dan_x3

Thank you for your suggestion, my field is in the master page and unfortunately your tip doesn't work.

Don't know why. Moreover, in your example 2 different printing processes are sent and this can be a problem for the customer because one printer is used for more pc clients and there's no guarantee regarding the sequence of pages printed by different pc (for example, the first copy from a pc could be merged with the first copy from another pc.

@Paul

Thank you Paul for your suggestion, I've duplicated the entire form with instanceManger.addInstance and It seems to work.

Now he question is, is there a way to know, for a given field, to which form instance this field belongs?

The problem adding Instances is that only the dynamic fields in the 'master' instance should be accessible, the others should be .access=protected.

Best regards,

Dariush.

Avatar

Level 1

Even my solution isn't helpful for you, in a MasterPage u can use a line like for change value of a field:

xfa.resolveNode("form1.#pageSet.Page1.TextField1").rawValue="Customer"

Avatar

Level 1

Hi,

I know this is an old post, but I had the same question and I used this solution which seems to work, it may help you with what you need:

Note that I have a DropDownList on my master page that I need to change content, but i guess in can be a text field.

And I also decided not to show the printing window

er.MasterPage_1.mp1_SmartDoc_Header.DropDownList4.rawValue = "COMPANY COPY";

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

er.MasterPage_1.mp1_SmartDoc_Header.DropDownList4.rawValue = "CUSTOMER COPY";

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