I can tell you that people have been sending >1024 bytes of form data from Acrobat/Reader for over a decade - so whatever is going on, is on your server...
Leonard -----Original Message----- From: camikusch [mailto:[email protected]] Sent: Tuesday, June 08, 2010 4:22 AM To: [email protected] Subject: Re: [iText-questions] max number of comboboxes in a pdfform is 85? Am Wed, 2 Jun 2010 06:32:30 -0700 schrieb Leonard Rosenthol <[email protected]>: i discovered the error has nothing to do with the number or kind of pdfform elements but the amount of data transmitted. the example i posted happen to send less then 1024bytes of data to the webserver which is fine, but when the amount of data exceeds 1023 byte (pdfformfield names and the associated data) adobe reader sends a "expect 100-continue" header which isnt correctly handled by lighttpd... 2010-06-08 08:19:57: (request.c.304) fd: 8 request-len: 207 POST /get_post_vars.php HTTP/1.1 User-Agent: AcroForms Host: localhost Accept: */* Content-Type: application/x-www-form-urlencoded Acrobat-Version: 9.3.2 Content-Length: 1130 Expect: 100-continue 2010-06-08 08:19:57: (response.c.128) Response-Header: HTTP/1.1 417 Expectation Failed Content-Type: text/html Content-Length: 363 Connection: close Date: Tue, 08 Jun 2010 06:19:57 GMT Server: lighttpd/1.4.26 lighttps homepage has a workaround for 1.4.21+ server.reject-expect-100-with-417 = "disable" which also does'nt fix the problem because the "expect" request from acroforms still is'nt correctly answered - its only not responded with 417. so i switched to apache 2.2.15 and tried the php-script for receiving acroforms post-data... with the same errorous results. post-data with size<1024 bytes is processed ok, 1024+ bytes will trigger "expect-100" i've added a screenshot which shows the behaviour: http://www.zimagez.com/zimage/bildschirmfoto-08062010-095118.php adobe reader sends expect-100, 300seconds after that the php script continues *without having received the post-data* to send the answer pdf which is received normally by the reader. since it seems the communication between adobe reader and the receiving webserver is the issue here i'm not quite sure this belongs to this mailing-list. but... maybe someone can help anyhow. > Where is the error taking place? In Acrobat/Reader during > submission? On the server? Other? > > -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Wednesday, June 02, 2010 9:19 AM > To: [email protected] > Subject: [iText-questions] max number of comboboxes in a pdfform is > 85? > > hi all, > > i ran into a problem regarding the max number of comboboxes a pdfform > permits for an error-free submit via SUBMIT_HTML_FORMAT. > > following code consists of tree files: > PdfForms.java - the test application i build after i ran into > problems with the real application FieldCell.java - some of you know > this code, insert a formfield in a table cell :) > > for a complete test scenario: > get_post_vars.php - see the transmitted variables. will spool > readable output to /tmp/vars.txt and a success .pdf to the sending > acroreader. you'll need an additional "erfolg.pdf" in the same > directory on your testing webserver. > > > in PdfForms.java method addContent adds 85 textfields and comboboxes, > if you increase this to 86 the .pdf will still be generated well but > pressing the "push me" button on the end will give a "text/html" > error and the php-script on the webserver will not catch any > submitted variables whereas with 85 text/combo fields everything > works fine. iv'e added two single method calls of addTextField and > addComboBox after the 85 loop to see which field might cause the > error.. combobox > > is it a "natural" restriction of adobe's pdf, a bug in itext or am i > doing something really stupid? if nothing helps i've got to try the > same amount+ checkbox-goups :/ > > > PdfForms.java ################################################## > package pdfforms_test; > > import com.itextpdf.text.BaseColor; > import com.itextpdf.text.Document; > import com.itextpdf.text.DocumentException; > import com.itextpdf.text.Paragraph; > import com.itextpdf.text.Rectangle; > import com.itextpdf.text.pdf.PdfAction; > import com.itextpdf.text.pdf.PdfAnnotation; > import com.itextpdf.text.pdf.PdfFormField; > import com.itextpdf.text.pdf.PdfName; > import com.itextpdf.text.pdf.PdfPCell; > import com.itextpdf.text.pdf.PdfPTable; > import com.itextpdf.text.pdf.PdfWriter; > import com.itextpdf.text.pdf.PushbuttonField; > import java.io.FileNotFoundException; > import java.io.FileOutputStream; > import java.io.IOException; > import java.util.logging.Level; > import java.util.logging.Logger; > > public class PdfForms { > > private Document document; > private PdfWriter writer; > private static String pdfFile = System.getProperty("user.home") + > "/pdfforms_test.pdf"; private static String cmd = "/opt/bin/acroread > " + pdfFile; private static String httpAdress = > "http://localhost/get_post_vars.php"; private PdfPTable table = new > PdfPTable(1); > > private void addComboBox(String _fieldname) { > String[] options = {"eins", "zwei", "drei", "vier"}; > PdfFormField comboBox = PdfFormField.createCombo(writer, > false, options, 0); comboBox.setWidget(new Rectangle(40, 780, 120, > 800), PdfAnnotation.HIGHLIGHT_INVERT); > comboBox.setFieldName(_fieldname); comboBox.setValueAsString("nix"); > > PdfPCell cell = new PdfPCell(); > cell.setMinimumHeight(20); > cell.setCellEvent(new FieldCell(comboBox, 20, writer)); > table.addCell(cell); > } > > private void addTextField(String _fieldname) { > PdfFormField textField = PdfFormField.createTextField(writer, > true, false, 500); textField.setWidget(new Rectangle(150, 600, 300, > 700), PdfName._3D); textField.setFieldName(_fieldname); > > PdfPCell cell = new PdfPCell(); > cell.setMinimumHeight(40); > cell.setCellEvent(new FieldCell(textField, 40, writer)); > table.addCell(cell); > } > > private void addSendButton() { > PushbuttonField pushButton = new PushbuttonField(writer, new > Rectangle(150, 560, 200, 590), "pushButton"); > pushButton.setBackgroundColor(BaseColor.LIGHT_GRAY); > pushButton.setLayout(PushbuttonField.LAYOUT_ICON_TOP_LABEL_BOTTOM); > pushButton.setOptions(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT); > pushButton.setText("push me"); > > try { > PdfFormField submit = pushButton.getField(); > submit.setAction(PdfAction.createSubmitForm(httpAdress, > null, PdfAction.SUBMIT_HTML_FORMAT)); > > PdfPCell cell = new PdfPCell(); > cell.setMinimumHeight(40); > cell.setCellEvent(new FieldCell(submit, 40, writer)); > table.addCell(cell); > } catch (IOException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } catch (DocumentException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } > > } > > private void addContent() { > for (int i = 0; i < 85; i++) { > PdfPCell cell = new PdfPCell(new Paragraph("test")); > table.addCell(cell); > addTextField("text"+Integer.toString(i)); > addComboBox("combo"+Integer.toString(i)); > } > // addTextField("a"); > // addComboBox("b"); > > addSendButton(); > try { > document.add(table); > } catch (DocumentException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } > } > > private void showDocument() { > try { > Process p = Runtime.getRuntime().exec(cmd); > p.waitFor(); > } catch (InterruptedException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } catch (IOException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } > > } > > private void close() { > this.document.close(); > } > > public PdfForms() { > try { > this.document = new Document(); > this.writer = PdfWriter.getInstance(document, new > FileOutputStream(pdfFile)); this.document.open(); > } catch (FileNotFoundException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } catch (DocumentException ex) { > Logger.getLogger(PdfForms.class.getName()).log(Level.SEVERE, > null, ex); } > } > > public static void main(String[] args) { > PdfForms p = new PdfForms(); > p.addContent(); > p.close(); > p.showDocument(); > System.exit(0); > } > } > > FieldCell.java ################################################# > package pdfforms_test; > > import com.itextpdf.text.Rectangle; > import com.itextpdf.text.pdf.PdfAnnotation; > import com.itextpdf.text.pdf.PdfContentByte; > import com.itextpdf.text.pdf.PdfFormField; > import com.itextpdf.text.pdf.PdfPCell; > import com.itextpdf.text.pdf.PdfPCellEvent; > import com.itextpdf.text.pdf.PdfPTable; > import com.itextpdf.text.pdf.PdfWriter; > > class FieldCell implements PdfPCellEvent { > > private PdfFormField formField; > private PdfWriter writer; > private int height; > > public FieldCell(PdfFormField _formField, int _height, PdfWriter > _writer) { this.formField = _formField; > this.height = _height; > this.writer = _writer; > } > > public void cellLayout(PdfPCell cell, Rectangle rect, > PdfContentByte[] canvas) { try { > PdfContentByte cb = canvas[PdfPTable.LINECANVAS]; > //cb.reset(); > formField.setWidget(new Rectangle(rect.getLeft(), > rect.getTop()-height, > rect.getRight(), > rect.getTop()), > PdfAnnotation.HIGHLIGHT_NONE); > writer.addAnnotation(formField); > } catch (Exception e) { > System.out.println(e); > } > } > } > > get_post_vars.php ############################################## > <?php > ob_start(); > var_dump($_REQUEST); > $vars = ob_get_contents(); > ob_end_clean(); > $f = fopen("/tmp/vars.txt","w"); > fwrite($f,$vars); > fclose($f); > > function ReadfileChunks($filename) { > $chunksize = 1*(1024*1024); > $chunksize = 512; > $buffer = ''; > $count = 0; > $handle = fopen($filename, 'rb'); > if ($handle === false) { > return false; > } > while (!feof($handle)) { > $buffer = fread($handle, $chunksize); > echo $buffer; > ob_flush(); > flush(); > } > $status = fclose($handle); > } > > $filename="erfolg.pdf"; > header("Pragma: public"); > header("Expires: 0"); > header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); > header("Cache-Control: private", false); > header("Content-Type: application/pdf"); > header("Content-Disposition: attachment; filename=\"danke.pdf\""); > header("Content-Transfer-Encoding: binary"); > header("Content-Length: "....@filesize($filename)); > ReadfileChunks($filename); > ?> > > EOF ########################################################## > > ------------------------------------------------------------------------------ > > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.itextpdf.com/book/ > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ You can also search the keywords > list: http://1t3xt.info/tutorials/keywords/ > > ------------------------------------------------------------------------------ > > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.itextpdf.com/book/ > Check the site with examples before you ask questions: > http://www.1t3xt.info/examples/ You can also search the keywords > list: http://1t3xt.info/tutorials/keywords/ ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/ ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/
