Expand my Community achievements bar.

prePrint event scope affects all other print events?

Avatar

Former Community Member

A PDF requirement is to have one document print in different versions for different recipients -- e.g., court, DA, public defender ..

They aren't all allowed to see the same data on people in the system, and in one instance, the form must be secured as read only.

Sure, there are a few different ways to do this, but the workflow chosen was to complete a PDF form, and then intercept the print or email functions to hide and secure pages.

The people who fill out the form need the entire document.

My approach was to offer a standard print button from the tool palette. No problem.

Then I added another print button from the tool palette, and set the pre-print and post-print events to intercept and change the number of pages output (leaving out pp 4-6). Works fine.

form1.page1.btnPrintLimited::prePrint - (JavaScript, client)

    TextField1.rawValue = "Secure prePrint";
    page4.presence = "hidden";
    page5.presence = "hidden";
    page6.presence = "hidden";

Then, returning to the standard print button, it seems that now all jobs are rendered with the same pages missing as were defined in the pre-print and post-print events for the OTHER button.

What gives? I thought that the scope for control events would be limited  to those events themselves.

I even tried in the pre-print and click events for the standard report to force the visibility of pages suppressed in the events, e.g.,

form1.page1.btnPrintNormal::click - (JavaScript, client)


    page4.presence = "visible";
    page5.presence = "visible";
    page6.presence = "visible";
   
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

Is my approach a faulty one? Should I be trying something else?

I'm using LC Designer ES2.

Would appreciate any guidance.

Kind regards,

Brian


2 Replies

Avatar

Level 10

Hi Brian,

There are three classes or groupings of events:

  • Process events.
  • Interactive events
  • Application events

See a table and example form here: http://assure.ly/nB0Bvz. Also have a look at this example, as it shows you how often some process and application events fire: http://bit.ly/gW3RNr.

Okay, so interactive events like mouseEnter and click are restricted to the object that contains the script.

However process and application (including prePrint and postPrint) fire for all objects that contain script in those objects.

I hope the examples clear that up for you.

I think you might have to consider a role based approach to the form. So for example if you can determine who is looking at the form, then using an if/else statement, print the appropriate pages.

Good luck,

Niall

Avatar

Former Community Member

Great answer, Niall. I've a good feeling you nailed the problem. I'll post results when solved. Thanks -- and thanks for the quick reply. People are depending on me.