3

我想知道是否有任何方法可以通知 adobe reader 中的用户已将 pdf 表单提交到服务器?我正在向 php 脚本提交一个普通的 http/html 表单,这没什么大不了的,直截了当,但在提交表单时,文档、论坛等似乎存在一个很大的“黑洞”。

提交表单后没有办法触发javascript警报吗?我不想返回另一个说“谢谢”的 pdf,这有点俗气。我对pdf表单很陌生,所以我猜必须有一种方法可以将FDF返回到其中包含一些执行的javascript的原始文档,例如警报('谢谢您的反馈!')..

这应该是直截了当的,我认为 Adob​​e 大肆宣传的 PDF 技术对开发人员来说更加友好和易于访问..

有任何想法吗??(哦,请不要问我为什么使用 pdf 表单而不是网络,这是来自“The Top”,所以作为开发人员我只需要这样做..)

4

4 回答 4

6

您发布到的服务器脚本必须在 HTTP 标头中回复此内容类型:

'内容类型:应用程序/vnd.fdf'

例如。如果您使用的是 PHP:

header('Content-Type: application/vnd.fdf')

然后是相关的bastardized-pdf-javascript-mutant-half-bread,它将触发alert() 对话框。

%FDF-1.2
1 0 obj
<<
/FDF
    <<
    /JavaScript 
        << 
        /Doc 2 0 R
        /After (confirmSend();)
        >>
    >>
>>
endobj
2 0 obj
[ 
(confirmSend) 3 0 R
]
endobj
3 0 obj
<<
>>
stream
function confirmSend()
{
app.alert({
    cTitle : 'title of the window',
    cMsg : 'message',
    nIcon : 3 
});
}
endstream
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF

我希望你能收到这条消息,因为我浪费了将近 2 周的时间来寻找解决方案......

于 2009-10-01T17:29:07.637 回答
1

Thanks for this! I too have been searching for a solution to this for hours! It was extremely frustrating. It seems like overkill to install the FDF Toolkit just to get a simple confirmation dialog box after the PDF has been submitted.

I eventually came up with the following through trial and error (it seems there is absolutely no documentation about this on the net):

%FDF-1.2
%âãÏÓ
1 0 obj
<<
/FDF
    <<
    /Status(Thank you. Your details have been submitted and someone will get in touch with regarding your application.)
    >>
>>
endobj
trailer
<</Root 1 0 R>>
%%EOF

The above will present (or should present) a dialog box in Adobe Reader without showing the "Warning: JavaScript Window" warning.

Hope this ends up being useful to someone.

于 2009-10-12T06:56:31.623 回答
1

I wrangled with this for days, trying to figure out why when I sent the FDF using response.write, it just wouldn't display in Reader. I tried sending both hand-crafted FDF and installing the FDF toolkit to create the FDF response. I was able to create valid FDF, as I was able to open locally in Reader and have the pop-up display correctly but I couldn't get it to work for the life of me sending FDF from my ASP.NET page.

Then inspiration struck. In one of my attempts to send the FDF, I stored the FDF in a file and tried to use a streamreader to pump it into the response. After many unsuccessful attempts to use response.write, on a whim I tried response.redirect to the saved fdf file and it worked. I had previously added fdf as a registered MIME extension for my web site, with application/vnd.fdf as the MIME type. Now the user receives the pop-up after successful submission. The simple solution, in C#, looks like this:

Page.Response.Redirect("success.fdf");
于 2011-04-28T03:27:40.673 回答
0

经过 3 天的搜索,我设法在答案中发生,在 php 脚本中添加 fdf 文件的标头,在 acrobat 中将“#FDF”添加到 url 的末尾似乎是解决方案;

%FDF-1.2 1 0 obj << /FDF << /JavaScript << /Doc 2 0 R /After (confirmSend();)

> > > endobj 2 0 obj [ (confirmSend) 3 0 R ] endobj 3 0 obj << > stream function confirmSend() { app.alert("表单提交成功\n感谢您的反馈!", 3) ; } endstream endobj 拖车 << /Root 1 0 R > %%EOF

于 2009-05-04T06:00:19.270 回答