Expand my Community achievements bar.

Create a second form from my current form at run-time.

Avatar

Level 1

Hello,

I have a pdf form that I'm viewing in Acrobat.  When I click a button on that form I want to generate a completely different pdf form in another instance of Acrobat.  Thus, having two instances of Acrobat open at the same time looking at two completely different forms.

How can this be done? is this even possible?

any ideas would be appreciated.

6 Replies

Avatar

Former Community Member

Acrobat scripting has "app.openDoc()" which is supporten in designer. I'm not sure of the syntax but probably something like this:

var filepath = "C:\Users\peter\Documents\untitled1.pdf";
app.openDoc(filepath);

That particular code doesnt seem to work, but the answer is probably something like that.

Avatar

Level 1

Um thanks, but I'm not trying to open a second PDF.

I want to generate a new pdf from a current pdf.  And the solution would have to work with Reader aswell.

The new pdf can be a subform of the first pdf, but it has to be opened and saved in a new instance of Acrobat/Reader.

This is a very hard task, can anyone help?

Avatar

Former Community Member

The app.openDoc() is the way to go. but it does not seem that you can pass in a variable that represents the nae of your file. You can pass the path and file name as a string but no resolution fo a variable holding that value can be done.

So the command:

app.openDoc("c:/myfile.pdf")

will work, but the commands:

var filename = "c:/myfile.pdf";

app.openDoc(filename)

will not work

Paul

Avatar

Level 1

HI Paul I can how app.openDoc will help me.

When I went to try it, it just didnt work.  What I mean is I cant seem to get the openDoc method to work.

Here is my script on a button click event:

form1.PageTest.Button1::click - (JavaScript, client)
   app.alert("Please Open");
   var myDoc = app.openDoc("C:\Users\Chan.Chac\Desktop\FormsWork\Schedule1 form apps\test_PrintIMM5406_2.pdf");

This doesnt open at all, what am I doing wrong?

Avatar

Former Community Member

I assume the alert comes up ....then nothing? The code looks fine ...you may have to put the slashes the other way. Hit the Ctrl-j to display the java console and see if there are any error messages when you click the button.

Paul

Avatar

Level 1

Thanks for helping this noob Paul.  Its working.

I think I have all I need.  Thanks for pointing me in the right direction.