How to convert Interactive PDF form to flatten(Non Interactive) PDF form using java script at Button click.

2,790 views
Skip to first unread message

saurabh

unread,
Apr 5, 2012, 9:06:48 AM4/5/12
to Adobe LiveCycle Developers
hi,

How to convert Interactive PDF form (Designed in LiveCycle
Designer ES2) to flatten(Non Interactive) PDF form using java script
at Button click.

fred.pantalone

unread,
Apr 5, 2012, 2:20:47 PM4/5/12
to live...@googlegroups.com
It isn't possible to truly flatten a PDF via JavaScript. What you can do is iterate through the form fields and make them protected or read only. If your end users are exclusively using newer versions of Reader/Acrobat then you can make subforms protected or read only instead. This might make your code more efficient.

Fred

Duane Nickull

unread,
Apr 5, 2012, 4:20:39 PM4/5/12
to Adobe LiveCycle Developers
We recently ran into this issue with a label printing PDF.  There used to be a scripting method (or at least we saw a reference to it) to flatten but now it has to be done on the server.  We wrote our own server that does this.  It is relatively simply to flatten server side using LiveCycle ES too.

Duane

--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/livecycle/-/pSUaSK8z9nUJ.
To post to this group, send email to live...@googlegroups.com.
To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livecycle?hl=en.

saurabh goyal

unread,
Apr 6, 2012, 1:32:20 AM4/6/12
to live...@googlegroups.com, fred.pantalone
I knw , it is difficult to make by JavaScript...but when we make our form Protected or Read Only then Read Out Loud not work in Reader/Acrobat...
It generate msg ...Warning! Empty Page..

--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.

saurabh goyal

unread,
Apr 6, 2012, 1:29:17 AM4/6/12
to live...@googlegroups.com, duane....@gmail.com
We can make Flatten PDF on the server through LiveCycle Workbench ES2 by using transformPDF activity ...but it is difficult to make by JavaScript...

Duane Nickull

unread,
Apr 6, 2012, 3:36:49 AM4/6/12
to Adobe LiveCycle Developers, Duane Nickull
It is actually impossible to do via javascript.  The old method was deprecated:


Here's how:

  1. In Acrobat Professional, open the JavaScript console (Ctrl-J).
  2. Type in this.flattenPages(); and press enter.'
I have not been able to get this to work.

THere is another problem which is that not all PDF viewers support all functions of PDF which is why it is best done server side.  If you want to buy a server to do this, LiveCycle ES has this.  We also have a prototype of our own.  The idea is that you would add a submit button which would call our server, flatten it etc. Contact me off list as we (Uberity) do not wish to advertise of push our wares on this list.  Alternatively, Avoka, Cardinal, Carasoft, Ensemble, 4Point and others all possibly have other workarounds for this.

Duane


******************
COO and Director 
Uberity Technology Corporation 
"LiveCycle ES and Mobile Specialists"
@uberity @duanechaos

saurabh goyal

unread,
Apr 6, 2012, 5:11:01 AM4/6/12
to live...@googlegroups.com, Duane Nickull
Thanxx for ur concern,I hav done with Adobe printer...But I want to do by  JavaScript code...

Rob McDougall

unread,
Apr 9, 2012, 10:20:28 AM4/9/12
to live...@googlegroups.com, fred.pantalone
You could try setting "access" attribute on the fields to "nonInteractive" (as outlined here) using Javascript.  This is supposed to be a better emulation of a flattened object than "readOnly" or "protected".  I don't know how it affects the way Reader passes text to screen readers (I've never actually tested that aspect).

Are you sure that the problem is related to the fact that you've made the fields readOnly?  It sounds like it's something else.  You should at least get the non-field information being read (any text areas that are not fields, etc.).  The fact that nothing is being read at all seems odd to me (unless you have a form that has nothing but fields on them).

Regards,
Rob

Rob McDougall | Senior Technical Architect | 4Point | www.4Point.com
To unsubscribe from this group, send email to livecycle+unsubscribe@googlegroups.com.

Jodi Faulkner

unread,
Apr 15, 2015, 5:40:00 PM4/15/15
to live...@googlegroups.com, duane....@gmail.com, du...@uberity.com
Try this if you are still having issues. 

flattenPages(0,numPages-1,2);

Jodi Faulkner

unread,
Apr 15, 2015, 5:39:17 PM4/15/15
to live...@googlegroups.com, saurabh...@gmail.com
This is the one that I use on all of my forms. I have it set above the submit form, that way it flattens prior to attaching to the email. 

flattenPages(0,numPages-1,2);
 
Reply all
Reply to author
Forward
0 new messages