FillForms.vb
- '' 完毕:
- Imports System.IO
- Imports System.Drawing
- Imports System.Collections.Generic
- Imports System.Linq
- Imports GrapeCity.Documents.Pdf
- Imports GrapeCity.Documents.Text
-
- '' 此示例提供了可以填写的示例电子商务类型表单
- '' 并直接在示例浏览器中保存或打印
- '' 使用 GcDocs.PdfViewer 中的“保存”或“打印”按钮。
- ''
- '' 请注意,如果打印填写好的表格,一切就完成了
- '' 在客户端浏览器中,没有数据发送到我们的演示服务器。
- '' 但是,如果您单击“保存”按钮,输入的数据以及
- '' 原始表单被发送到演示服务器。服务器使用 GcDocs.Pdf
- '' 将数据插入 PDF,并发送填写的 PDF 表单
- '' 返回给客户端。演示服务器既不存储也不分析数据。
- ''
- '' 另请注意,查看器的“下载”按钮只会下载
- '' 没有数据的原始表格。与“保存”按钮不同,“下载”按钮
- '' 不访问服务器,只获取加载的原始 PDF。
- Public Class FillForms
- '' 默认情况下,生成第一个表单:
- Public Sub CreatePDF(ByVal stream As Stream, Optional ByVal paramsIdx As Integer = 0)
- CreatePDF(stream, GetSampleParamsList()(paramsIdx))
- End Sub
-
- Public Sub CreatePDF(ByVal stream As Stream, ByVal sampleParams As String())
- Dim fn = sampleParams(3)
- Dim pn = Path.Combine("Resources", "PDFs", "Forms", "misc", fn)
- Using fs = File.OpenRead(pn)
- fs.CopyTo(stream)
- End Using
- End Sub
-
- Public Shared Function GetSampleParamsList() As List(Of String())
- '' 字符串是名称、描述,其余是任意字符串:
- Return New List(Of String()) From
- {
- New String() {"@us-tax-forms/Form W-7", "Application for IRS Individual Taxpayer Identification Number", Nothing, "fw7-demo.pdf"},
- New String() {"@us-tax-forms/Form SS-4", "Application for Employer Identification Number", Nothing, "fss4-demo.pdf"},
- New String() {"@e-com-forms/Goods Return", "Goods Return and Exchange Form", Nothing, "goods-return-form.pdf"},
- New String() {"@hr-forms/Time Sheet", "Time Sheet Form", Nothing, "time-sheet-form.pdf"},
- New String() {"@hr-forms/Trip Permission", "Offsite field trip permission slip", Nothing, "offsite-field-trip-form.pdf"},
- New String() {"@member-forms/Health Info", "Health Info Intake Form", Nothing, "health-intake-form.pdf"},
- New String() {"@event-forms/Event Feedback", "Event Feedback Form", Nothing, "event-feedback-form.pdf"}
- }
- End Function
- End Class
-