Principles to Loading a PDF with Data with ASP.net
Rules: Make sure when posting FDF Data to a buffer, do not post any HTML along with FDF Data, using VB.net, ASP.net, and the FDF Toolkit .net component. Remove any header information by declaring "Response.Clear()" before posting any PDF or PDF data MIME content.
Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Public Class loadform
Inherits System.Web.UI.Page
Private URLPath as String = ""
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
URLPath = Request.Url.ToString
Try
Load_FDF()
Catch Ex as Exception
Response.Write("Error: " & Ex.Message)
Response.End
End Try
End Sub
Public Function Load_FDF()
' DECLARE THE COMPONENTS
Dim FDFApp As New FDFApp.FDFApp_Class
Dim FDFDoc As New FDFApp.FDFDoc_Class
' INITIALIZE THE COMPONENTS
FDFDoc = FDFApp.FDFCreate
Response.Clear()
Response.ContentType = FDFApp.MimeFDF
' SET TEXT FIELD VALUES
FDFDoc.FDFSetValue("txtForm_Field1","Field_Value")
FDFDoc.FDFSetValue("txtForm_Field2","Field_Value")
FDFDoc.FDFSetValue("txtForm_Field3","Field_Value")
' SET OPTION OR LIST FIELD NAMES AND VALUES
FDFDoc.FDFSetOpt("lstForm_Field",New String() _{"lst_Value01","lst_Value02","lst_Value03","lst_Value04"},New String() _{"DisplayName_01","DisplayName_02","DisplayName_03","DisplayName_04"})
FDFDoc.FDFSetValues("lstForm_Field",New String(){"lst_Value02","lst_Value03")
'FDFDoc.FDFSetValue("lst_Form_Field","lst_Value02")
' SET PDF LOCATION
FDFDoc.FDFSetFile(URLPath & "PDFs/sample.pdf")
' WRITE THE FDF TO THE BUFFER
Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFApp.FDFType.FDF, False))
' BROWSER READS THE FDF DATA AND ADOBE PLUG-IN MERGES PDF WITH FDF DATA
'
End Function
End Class
dde0d06b-8765-4d75-b5c1-9f1847647c59|0|.0