Dear sirs,

I had problems with the following code extracted from the class 
PushbuttonExample in attachments.

----------

        FileOutputStream out = new FileOutputStream("submit_new.pdf");
        PdfReader reader = new PdfReader("submit_template.pdf");
        PdfStamper stamper = new PdfStamper(reader, out);
        
        // Get fields
        AcroFields form = stamper.getAcroFields();
        
        PushbuttonField bt = form.getNewPushbuttonFromField("upload");
        if (bt != null) {
            bt.setText("Upload Document");
            bt.setBackgroundColor(Color.GRAY);
            bt.setBorderStyle(PdfBorderDictionary.STYLE_BEVELED);
            bt.setOptions(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);
            
            PdfFormField submitField = bt.getField();
            PdfAction ac = 
PdfAction.createSubmitForm("http://dgcrelease.gfdi.be/gok/template/pdf/fr/show_data.jsp";,
 null, PdfAction.SUBMIT_PDF);
            submitField.setAction(ac);
            
            form.replacePushbuttonField("upload", bt.getField());
        }
        
        stamper.close();
        out.close();        

----------

I would like to replace a pushbutton named "upload" in the original PDF 
"submit_template.pdf" (also in attachments) with a new pushbutton.
My purpose is that the new pushbutton will allow me to click on it to submit 
all the PDF to an URL (as 
"http://dgcrelease.gfdi.be/gok/template/pdf/fr/show_data.jsp"; in my example).
The new PDF was generated on the "submit_new.pdf" file. But when i click on the 
button "Upload Document", no submit is really done.

Note that when i create a pushbutton (also for submitting all the PDF) with 
Acrobat Professional, it works fine.
I also have the book "iText in Action". But i couldn't find an example showing 
a pushbutton to submit all the PDF.

Thank you so much for your comments and suggestions.

Best regards,

Nguyen Tran Sy



      

Attachment: PushbuttonExample.java
Description: Binary data

Attachment: submit_template.pdf
Description: Adobe PDF document

Attachment: submit_new.pdf
Description: Adobe PDF document

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to