Real Software Forums
http://forums.realsoftware.com/

MBS DynaPDF setting form field values
http://forums.realsoftware.com/viewtopic.php?f=20&t=36608
Page 1 of 1

Author:  markwalsh [ Mon Dec 13, 2010 8:43 am ]
Post subject:  MBS DynaPDF setting form field values

I'm evaluating the DynaPDF plug-in prior to purchasing, and I need to be able to set the value of an existing form field. From what I am reading, it looks like the value property is read-only. Can someone tell me if this is possible, and if so, what do I need to do to set the value of a field. I was anticipating purchasing the Lite version assuming that it would have this capability.

I noticed that version 3 is slated to be released soon, is it possible that this capability has been added to the updated version?

As an option if this isn't possible directly, I noticed that I can add a javascript function to the file, and that seems to work to set the field contents, but I'd rather know if I can set the values directly from RB instead of having to generate a much more complicated javascript to add.


Also, does this plug-in work with dynamic PDFs created through Adobe Livecycle?

Author:  MonkeybreadSoftware [ Mon Dec 13, 2010 9:48 am ]
Post subject:  Re: MBS DynaPDF setting form field values

markwalsh wrote:
I'm evaluating the DynaPDF plug-in prior to purchasing, and I need to be able to set the value of an existing form field. From what I am reading, it looks like the value property is read-only. Can someone tell me if this is possible, and if so, what do I need to do to set the value of a field. I was anticipating purchasing the Lite version assuming that it would have this capability.


The SetTextFieldValue function does that.

markwalsh wrote:
I noticed that version 3 is slated to be released soon, is it possible that this capability has been added to the updated version?


Well, what features version 3 has, is not yet clear. But all those form things are already built in.

Greetings
Christian

Author:  markwalsh [ Mon Dec 13, 2010 10:04 am ]
Post subject:  Re: MBS DynaPDF setting form field values

Thanks for the quick response.

MonkeybreadSoftware wrote:
markwalsh wrote:
I'm evaluating the DynaPDF plug-in prior to purchasing, and I need to be able to set the value of an existing form field. From what I am reading, it looks like the value property is read-only. Can someone tell me if this is possible, and if so, what do I need to do to set the value of a field. I was anticipating purchasing the Lite version assuming that it would have this capability.


The SetTextFieldValue function does that.

Thanks.
MonkeybreadSoftware wrote:
markwalsh wrote:
I noticed that version 3 is slated to be released soon, is it possible that this capability has been added to the updated version?


Well, what features version 3 has, is not yet clear. But all those form things are already built in.

Greetings
Christian


Another question: Is it possible to print the PDF from RB in the Lite version? I was also looking to be able to flatten the PDF, but I see that is only available in the Pro version.

Thanks again.

Author:  MonkeybreadSoftware [ Mon Dec 13, 2010 10:18 am ]
Post subject:  Re: MBS DynaPDF setting form field values

Depends what you mean with print.
DynaPDF can create a PDF file for you.

This PDF file can be printed on Mac OS X with our CoreGraphics classes.
Or command line with some pdf to postscript tool and sending to a postscript aware printer.

I think on Windows you can launch Acrobat reader and have the file printed with some command line switch.

See this example:
http://www.monkeybreadsoftware.net/exam ... tpdf.shtml

Greetings
Christian

Author:  markwalsh [ Mon Dec 13, 2010 10:33 am ]
Post subject:  Re: MBS DynaPDF setting form field values

MonkeybreadSoftware wrote:
Depends what you mean with print.
DynaPDF can create a PDF file for you.

This PDF file can be printed on Mac OS X with our CoreGraphics classes.
Or command line with some pdf to postscript tool and sending to a postscript aware printer.

I think on Windows you can launch Acrobat reader and have the file printed with some command line switch.

See this example:
http://www.monkeybreadsoftware.net/exam ... tpdf.shtml

Greetings
Christian

Thanks. My intention was to give the user the option to save the PDF or to just print the data. In the case of printing the data, I was hoping to be able to create the PDF then print it without any extra user input (i.e. opening the PDF in Reader/Acrobat then requiring the user to initiate the print command) then delete the PDF since it is no longer needed. This would also keep the user's focus in my application instead of switching them to Acrobat for printing and then having to switch back to my application.

This will be under Windows (but may include Mac in the future)

Author:  MonkeybreadSoftware [ Mon Dec 13, 2010 11:28 am ]
Post subject:  Re: MBS DynaPDF setting form field values

I thought Acrobat Reader has a silent option to open, print and close the PDF!?

Greetings
Christian

Author:  timhare [ Mon Dec 13, 2010 12:00 pm ]
Post subject:  Re: MBS DynaPDF setting form field values

It does.

Author:  markwalsh [ Mon Dec 13, 2010 12:16 pm ]
Post subject:  Re: MBS DynaPDF setting form field values

timhare wrote:
It does.

Thanks, Christian and Tim. I'll look into that (not familiar with how to do that right now). I'm not sure if the user's will have Acrobat/Reader/Neither installed, so I was hoping originally that I could send the print directly using the DynaPDF plugin. Is there a link to an example to do this?


MonkeybreadSoftware wrote:
The SetTextFieldValue function does that.

Currently looking into how to identify an existing field in an acroform. The 'SetTextFieldValue' function requires an integer field index. I have tried using
f = pdf.FindField("txtCompanyName")
call pdf.SetTextFieldValue(F, "Company Name", "Company Name", 1)

But I am getting an error "40: SetTextFieldValue: Invalid handle!"

Not sure if I am doing something wrong. I started out using the 'Acroform' example included with the plugin, and edited it to use my PDF form. I was able to set the field value of a field in that example file since the field index was obtained when the field was created, but haven't had any luck just yet figuring out how to determine the index of the field by name if it already exists.

Author:  MonkeybreadSoftware [ Mon Dec 13, 2010 2:01 pm ]
Post subject:  Re: MBS DynaPDF setting form field values

Well, you should check the return value. Maybe you get -1 as the field was not found?

This works here:

Quote:
f = pdf.FindField("Finanzamt")
if f>=0 then
call pdf.SetTextFieldValue(f, "Mayen", "", pdf.ktaLeft)
end if


You can email me for an example project on this. I just wrote one for the next plugin version.

Also check the import flags:
call pdf.SetImportFlags(pdf.kifImportAll)

Greetings
Christian

Author:  markwalsh [ Mon Dec 13, 2010 2:23 pm ]
Post subject:  Re: MBS DynaPDF setting form field values

MonkeybreadSoftware wrote:
Well, you should check the return value. Maybe you get -1 as the field was not found?

This works here:

Quote:
f = pdf.FindField("Finanzamt")
if f>=0 then
call pdf.SetTextFieldValue(f, "Mayen", "", pdf.ktaLeft)
end if


You can email me for an example project on this. I just wrote one for the next plugin version.

Also check the import flags:
call pdf.SetImportFlags(pdf.kifImportAll)

Greetings
Christian

Yes, I am getting -1. I believe I am opening/importing the existing PDF improperly - when I run the test program, the PDF is missing the field I had placed in it when it opens the output file. I had taken your example file which creates a Tax Form, and replaced the code which created the forms with the lines I was using to set the field. I just started playing with this plug-in today, and I am not familiar with the proper way to open the PDF for editing.

I will send you an email.

I did find the answer to the printing silently in another one of your example files, so I believe I will be able to get that working.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/