Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将表单数据从PDF传递到iText中的servlet_Java_Servlets_Pdf_Itext - Fatal编程技术网

Java 将表单数据从PDF传递到iText中的servlet

Java 将表单数据从PDF传递到iText中的servlet,java,servlets,pdf,itext,Java,Servlets,Pdf,Itext,我有一个PDF,其中包含一个表单,该表单应由将提交的数据传输到数据库的用户填写。例如,它包含名称、年龄和注释字段。用户填写此表单并点击PDF中的“发布”按钮 POST按钮的代码如下所示: PushbuttonField button1 = new PushbuttonField( stamper.getWriter(), new Rectangle(90, 660, 140, 690), "post"); button1.setText("PDFPOST"); button1.set

我有一个PDF,其中包含一个表单,该表单应由将提交的数据传输到数据库的用户填写。例如,它包含名称、年龄和注释字段。用户填写此表单并点击PDF中的“发布”按钮

POST按钮的代码如下所示:

PushbuttonField button1 = new PushbuttonField(
      stamper.getWriter(), new Rectangle(90, 660, 140, 690), "post");
button1.setText("PDFPOST");
button1.setBackgroundColor(new GrayColor(0.7f));
button1.setVisibility(PushbuttonField.VISIBLE_BUT_DOES_NOT_PRINT);
PdfFormField submit1 = button1.getField();
submit1.setAction(PdfAction.createSubmitForm(
      "http://192.168.1.136:8085/LogFileExampleProject/PdfService", null,
       PdfAction.SUBMIT_PDF));
// add the button
stamper.addAnnotation(submit1, 1);

但是,当用户在PDF中填写表单后按下POST按钮时,它会与
createSubmitForm
中指定的URI建立连接,但不会传递任何
TextField
参数。如何进行此操作?

如文件所述,只有在客户端有Adobe Acrobat时,
SUBMIT\u PDF
选项才有效(这是Adobe对Adobe Reader施加的限制之一)。您希望如何接收数据?作为HTML查询字符串(
SUBMIT\u HTML\u FORMAT
),作为FDF(默认值),或者作为XFDF(
SUBMIT\u XFDF
)?

作为HTML查询字符串会很好,但是我的servlet似乎没有从
GET
POST
接收任何数据。这会让我感到惊讶。使用这个Servlet:它没有做很多事情,它只显示发送到服务器的任何数据。另外:您使用的是哪种PDF查看器?当然,你说的是AdobeReader,而不是Preview,不是吗?我一直在谷歌Chrome浏览器上尝试使用PDF格式。我应该用AdobeReader试试吗?