无法保存XFDF表单的POST数据内容 [英] Not able to Save the POST data contents of an XFDF form

查看:75
本文介绍了无法保存XFDF表单的POST数据内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们不能能够从XFDF表单保存POST数据内容.使用PDF内的按钮触发POST事件.

We are Not able to Save the POST data contents from an XFDF form. The POST event is triggered using a button inside the PDF.

我们在服务器端使用了 Java + SPRING .

We are using Java + SPRING on server side.

例外:

java.io.IOException: Expected > for tag: <{1}/> near line 1, column 13

在itext演示页面中也观察到相同的错误!在这里是: http://itextpdf.com:8180/book/xfdf

Observed the same error in itext demo page too! Here it is: http://itextpdf.com:8180/book/xfdf

请帮助我们找到解决方案.

Please help us finding the solution.

[更多详细信息]

该错误在iText演示页面本身中可重现. 网址: http://itextpdf.com:8180/book/xfdf 提交表单后,我们可以在ajax响应部分中注意到它.

The error is reproducible in the iText demo page itself. Url:http://itextpdf.com:8180/book/xfdf We can notice it in the ajax response part after submitting the form.

顺便说一下,这是我们应用程序中的输入,输出和源代码.

By the way, here is the input, ouput and source code in our app.

HTTP POST输入数据:

%FDF-1.2
1 0 obj
<</FDF<</F<</Type/Filespec/F(http///localhost/8081/triplefin/document/download/4)/UF(http///localhost/8081/triplefin/document/download/4)>>/Fields[<</T(pat_name)/V(sample)>><</T(member_number)>><</T(p_add)>><</T(p_city)>><</T(p_state)>><</T(p_zip)>><</T(pat_phone)>><</T(pat_dob)>><</T(doc_name)/V(provider1)>><</T(doc_add)/V(7/15 krishna nagar)>><</T(doc_city)/V(coimbatore)>><</T(doc_state)/V(641041)>><</T(doc_zip)>><</T(doc_phone)/V(1232131)>><</T(doc_fax)/V(023423423)>><</T(specialty)>><</T(npi_number)>><</T(drug)>><</T(drug_dosage)>><</T(rx_direction)>><</T(Diagnosis)>><</T(pat_start_date)>><</T(alternatives_used)>><</T(non_formulary_reason)>><</T(addi_treatment)>><</T(doc_signature)>><</T(doc_sig_date)>>]>>>>
endobj

trailer
<</Root 1 0 R>>
%%EO

详细的异常消息:

java.io.IOException: Expected > for tag: <{1}/> near line 1, column 13
    at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.throwException(SimpleXMLParser.java:594)
    at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.go(SimpleXMLParser.java:353)
    at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.parse(SimpleXMLParser.java:607)
    at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.parse(SimpleXMLParser.java:682)
    at com.itextpdf.text.xml.simpleparser.SimpleXMLParser.parse(SimpleXMLParser.java:648)
    at com.itextpdf.text.pdf.XfdfReader.<init>(XfdfReader.java:113)

源代码:

public void savePostDataToPdf(String pdfFileAbsolutePathString, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
{

    XfdfReader xfdfReaderObject = new XfdfReader(request.getInputStream()); //ERROR IS HERE!

}

推荐答案

问题是您正在使用XFDF阅读器发布FDF数据. FDF和XFDF是不同的格式,XFDF阅读器将其视为XML字符串,并引发有关未关闭标签的错误.

The problem is you're posting FDF data but using the XFDF reader. FDF and XFDF are different formats, and the XFDF reader is treating it as an XML string and throwing an error about unclosed tags.

如果您仅提供FDF文件,则需要以下内容:

If you're just providing FDF files, you'd want something like:

FdfReader fdfReaderObject = new FdfReader(request.getInputStream());

这篇关于无法保存XFDF表单的POST数据内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆