How can I remove all of the buttons from my pdf? I have a form that is being populated from a database and would like to have the buttons removed (they're only there if in case someone filled out the form manually)
I know it's possible to make them invisible when printing, but I would like to strip them out of the pdf all together.
Thanks!
-Eric
Remove Buttons?
Re: Remove Buttons?
Support · Jun 5, 2006Hello Eric,
Using the CreateLabel method you can strip all the buttons and still fill all your form fields. The CreateLabel method is off the PdfFormField class which belongs to ceTe.DynamicPDF.Merger.Forms namespace.
This is discussed in more detail in one of our help topics. Take a look at the "Form Flattening" page of our documentation, http://www.DynamicPDF.com/Support/NET_Help_Library_06_03/Form%20Flattening.html
under the section labeled "Replace Acro Form Fields with Text".
Thanks,
ceTe Software Support Team
Re: Remove Buttons?
Forum member · Jun 5, 2006Thanks for the quick response, but this didn't work, the buttons are still there. I followed the instructions in the "Replace Acro Form Fields with Text" section, but this didn't remove the buttons and it didn't replace any form fields, it merely put a label on top of a blank form field.
How is the Remove() method of the MergeDocument used?
Dim oMerge As New ceTe.DynamicPDF.Merger.MergeDocument("c:\test.pdf")
oMergeDocument.Form.Fields.Remove( -- insert cete.dynamicpdf.forms.formfield here --)
Isn't there a way to loop through the document, do a TypeOf to find PdfButtonField on each field and then remove it?
Thanks again...
Re: Remove Buttons?
Support · Jun 5, 2006Hello,
The button and the form fields are not getting stripped off because in v4.0 the form fields are preserved by default. There is one part missing in the example where you have to set the MergeOptions equal to false in the overloaded MergeDocument constructor in order to strip off the form fields.
Dim oMerge As New ceTe.DynamicPDF.Merger.MergeDocument("c:\test.pdf", New MergeOptions(False))
We will get this updated in the Help Documentation very soon.
The Remove method is used to remove any individual item from the list or collection and not remove any particular form field.
Thanks,
ceTe Software Support Team
Re: Remove Buttons?
Forum member · Jun 6, 2006OK, the MergeOptions removed the fields as stated. I'm still having a problem with the radio buttons, though. This form flattening places a label with the value of the radio button, or the word "Off", where the radio button should be. Do I have to add the radio buttons programatically? Or is there a better solution?
Re: Remove Buttons?
Support · Jun 6, 2006For radio buttons or check boxes you will need to perform the appropriate logic in order for the now-flattened radio buttons to appear filled out. Specifically you will want to use the PdfFormField's "GetX" and "GetY" methods to retrieve the exact location of where that radio button existed. Once you have the X and Y coordinates you can then place your mark (be it an "X" or some kind of check mark) in a label at the location of that form field.
Thanks,
ceTe Software Support Team
Re: Remove Buttons?
Forum member · Jun 7, 2006Great. Thanks for the info.
Just had a thought about the buttons. Instead of removing the buttons entirely, is it possible to turn off their visibility? I know this can be set in Acrobat Professional, but was hoping it could be done via code.
Re: Remove Buttons?
Forum member · Jun 7, 2006Hold on a second.....
If I add the MergeOptions(False) property when creating a merge document (as stated a couple replies above) then none of the fields come across to the merge document and then can't be referenced in the new document. Since there are no fields in the MergeDocument, then there is nothing for the CreateLabel method to read from.
Am I missing something?
Re: Remove Buttons?
Support · Jun 7, 2006Hello,
You can turn off the visibility of the button by setting the Visible property of the Button class to false, if the button has been added using our product. There is no way you can turn off the visibility of the button on an existing PDF document.
In order to use CreateLabel, you will have to use PdfDocument class to load your PDF and then use the overloaded MergeDocument constructor that takes the PdfDocument object along with setting MergeOptions to false. Then using the PdfDocument object, you can reference the form fields.
Thanks,
ceTe Software Support Team