Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - this.exportAsFDF(); BUT EXPORT 1 page out of many?
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

this.exportAsFDF(); BUT EXPORT 1 page out of many?

 Post Reply Post Reply
Author
20GT View Drop Down
New Member
New Member


Joined: 13 Mar 2016
Points: 6
Post Options Post Options   Quote 20GT Quote  Post ReplyReply Direct Link To This Post Topic: this.exportAsFDF(); BUT EXPORT 1 page out of many?
    Posted: 13 Mar 2016 at 3:33am
Hi I've created a print page with 21 checkboxes in my PDF.
I know i can use  .exportAsFDF(); in a button to export the PDf data from the whole form but;
I want to limit the export data to just one page. Is that possible? 





Back to Top
Rob Lyman View Drop Down
New Member
New Member
Avatar

Joined: 12 May 2015
Location: Chicago
Points: 28
Post Options Post Options   Quote Rob Lyman Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 2016 at 8:09pm
The problem you're facing is that PDF effectively regards the entire PDF to be a single form; even though it treats pages individually in other aspects, it regards all pages to be part of a single form.

Fortunately, there are a couple of form features you can use to restrict your FDF output to a single page:

1.) exportAsFDF() takes an optional argument 'aFields': this an array of field names to include in the FDF. If you supply just the names of the fields on the single page, the FDF should only include those fields.

2.) Then your only problem is knowing what fields are on the page. The quickest solution is to just hardcode the names.

3.) If you need to dynamically determine the set of fields, you can use the 'page' property of the 'field' object. In the simple case, this will just be the number of the page the field is on. However, a field can actually appear on multiple pages; in that case, the 'page' property will be an array of page numbers the field appears on. A robust solution would check for this. (However, if you know for a fact that none of your fields appear on multiple pages, you could leave this out.)

So given the page number, you'd need a small bit of code to search the PDF for all fields with that page number, then put the field names into an array to supply to exportAsFDF().

Hope this helps!
Rob Lyman
Software Engineer
http://www.datalogics.com
Back to Top
20GT View Drop Down
New Member
New Member


Joined: 13 Mar 2016
Points: 6
Post Options Post Options   Quote 20GT Quote  Post ReplyReply Direct Link To This Post Posted: 15 Mar 2016 at 11:16pm
thanks 
my script (eh hmmm someone else's script)

var flds=["P40.1.b","P40.1.n","P41.1.b","P41.1.n","P42.1.b","P42.1.n","P43.1.b","P43.1.n","P44.1.b","P44.1.n","P45.1.b","P45.1.n","P46.1.b","P46.1.n","P47.1.b","P47.1.n","P48.1.b","P48.1.n","P49.1.b","P49.1.n","P50.1.b","P50.1.n","P51.1.b","P51.1.n","P52.1.b","P52.1.n","P53.1.b","P53.1.n","P54.1.b","P54.1.n","P55.1.b","P55.1.n","P56.1.b","P56.1.n","P57.1.b","P57.1.n","P58.1.b","P58.1.n","P59.1.b","P59.1.n","P60.1.b","P60.1.n","P61.1.b","P61.1.n","P62.1.b","P62.1.n"];
this.exportAsFDF({aFields:flds});


How to find all the fields in a PDF
(CTRL J)Paste the code provided into the text field at the bottom of the screen, select all of it with the mouse and press Ctrl+Enter. 
The script will run and the field names will be printed out to the same console window, after the code.

for (var i=0; i<this.numFields; i++) { 
var f = this.getField(this.getNthFieldName(i)); 
if (f==null) continue; 
console.println(f.name); 
}


Edited by 20GT - 15 Mar 2016 at 11:17pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.017 seconds.