I am attempting to figure out how to build dynamic dialogs within Acrobat using Javascript.
I am attempting to write a generalized PDF page splitter. The user selects a PDF document, and then the script analyzes the open document and determines that there are N pages in the document. I am going to run through the document and make each page its own PDF. Each page will be considered a certain kind of page, for example, Cover, Article, Ad, etc. and the type of page it is will affect the naming convention I use when making the new, one-page file. For example, let's say that pages 36, 37 and 38 are page, ad and article, respectively. Then the names I will be using for each output file will be as follows:
P12345Pg_036.pdf
P12345Ad_037.pdf
P12345Ar_038.pdf
But there is no way for my code to actually look at a given page and decide that it is page, article, ad, or one of four cover types, etc. So I want to build a dialog that looks something like this (assume a O is meant to be a radio button):
Page Pagetype
1 O Page O Inner cover Front O Outer cover Front O Ad O Article
2 | O Page | O Inner cover Front | O Outer cover Front | O Ad | O Article |
3 | O Page | O Inner cover Front | O Outer cover Front | O Ad | O Article |
4 | O Page | O Inner cover Front | O Outer cover Front | O Ad | O Article |
...
N | O Page | O Inner cover Front | O Outer cover Front | O Ad | O Article |
This means a dynamic dialog.
I have looked at the Acrobat API and determined that defining a dialog looks something like this:
var DialogABC = {
initialize: function(dialog){},
commit : function(dialog){},
...
description:{}
};
app.execDialog(DialogABC)
What I do not know how to do is create the dialog specification on the fly. Do I treat it as a string or is there some other way of making this happen? HOw can I make a dynamic description that allows for a variable number of rows?
Please let me know if you have any thoughts. A good reference or example would serve just as well.
TIA!
John