I'm having a little problem with Acobat 7 and the Submit Button.
I'm making a web app which allows any pdf form created by the client, and process the data (creates a search for the fields, makes all the inserts and updates in a SQL Database, and only saves one PDF as a template, the rest is saved in the SQL DB.)
 
I know that iText does not support XFA so I used the code from the forum to remove it; after that the submit button is useless, and I need it.
The thing is that I'm not the one who will create the forms (the client will do them), and so, I need to restore the clients submit button as it was before the removal of the XFA (I don't care about the url, cause I overwrite the clients url with my own to process the form).
 
I tried this in order to create a new submit button, but it seems to be missing something more.

-> PdfFormField pff = PdfFormField.createPushButton( stamp.getWriter() ) ;
-> pff.setAction( new PdfAction( PdfAction.SUBMIT_HTML_FORMAT ) ) ;
-> PdfDictionary a = (PdfDictionary)PdfReader.getPdfObject( pff.get( PdfName.A ) ) ;
-> PdfDictionary f = new PdfDictionary() ;
-> f.put( PdfName.FS, PdfName.URL ) ;
-> f.put( PdfName.F, new PdfString("http://www.mdssol.com") ) ;
-> a.put( PdfName.F, f ) ;
->
-> pff.setWidget( new Rectangle( 100, 100, 150, 150 ), PdfAnnotation.HIGHLIGHT_PUSH ) ;
-> pff.setFieldName( "fldname" ) ;
-> pff.setFieldFlags( PdfFormField.FF_PUSHBUTTON ) ;
-> pff.setMKAlternateCaption( "Alter Enviar" ) ;
->
-> PdfAppearance pa = cb.createAppearance( 50, 50 ) ;
-> pa.setColorFill( java.awt.Color.red ) ;
-> pa.setColorStroke( java.awt.Color.blue ) ;
-> pa.drawButton( 100, 100, 150, 150, "Enviar", BaseFont.createFont( BaseFont.HELVETICA, BaseFont.WINANSI, false ), 12 ) ;
-> pff.setAppearance( PdfAnnotation.APPEARANCE_NORMAL, pa ) ;
->
-> stamp.addAnnotation( pff, 1 ) ;
 
Thanks for all in advance!
Guillermo Odone.
 

Reply via email to