@Yuri,我只是一個日期/時間字段試了一下它完美地工作。我在Live Cycle中創建了一個簡單的PDF,其中包含兩個字段,一個文本和一個日期/時間,以及兩個按鈕Submit和Print。樣本PDF是here:
我填了表格,並得到這個爲XML:
<?xml version="1.0" encoding="UTF-8"?>
<topmostSubform>
<Text1>Chris</Text1>
<DateTimeField1>2012-04-12</DateTimeField1>
</topmostSubform>
當我導入到PDF和觀看在Acrobat PDF格式的日期/時間字段被填寫。我正在用以下代碼使用iTextSharp 5.0.5.0:
Option Explicit On
Option Strict On
Imports iTextSharp.text
Imports iTextSharp.text.pdf
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim PDF_Input_File As String = Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "Input.pdf")
Dim PDF_Output_File As String = Path.Combine(My.Computer.FileSystem.SpecialDirectories.Desktop, "Export.pdf")
''//Create our reader
Dim reader As New PdfReader(PDF_Input_File)
''//Create our file stream to output to
Using FS As New System.IO.FileStream(PDF_Output_File, FileMode.Create, FileAccess.Write, FileShare.Read)
''//Create the stamper
Dim stamper As New PdfStamper(reader, FS)
''//Just loading the XML raw instead of reading from disk, less files to attach to the post
Dim Bytes = System.Text.Encoding.UTF8.GetBytes("<?xml version=""1.0"" encoding=""UTF-8""?><topmostSubform><Text1>Chris</Text1><DateTimeField1>2012-04-12</DateTimeField1></topmostSubform>")
Using MS As New MemoryStream(Bytes)
''//Fill out the form
stamper.AcroFields.Xfa.FillXfaForm(MS)
End Using
stamper.Close()
End Using
reader.Close()
Me.Close()
End Sub
End Class
已解決。正在使用不好的方法。附件也一樣。 – Yuri 2011-04-12 18:47:41
你能否偶然地告訴我如何添加一個數字簽名(對已知名稱的現有字段)並自動提交表單? – Yuri 2011-04-12 23:04:37
另外,有沒有方法可以判斷表單是否已成功提交? – Yuri 2011-04-12 23:05:02