Created: 4/27/2010
Modified: 7/21/2014This code example demonstrates how to populate a LiveCycle PDF (XFA) form with XDP data.
Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Partial Public Class populate_pdf_xdp_data
Inherits System.Web.UI.Page
Private PDFPath As String = Server.MapPath("/MyData/myPDFFile.pdf")
Private XDPPath As String = Server.MapPath("/MyData/myXDPFile.xdp")
Private cFDFDoc As New FDFApp.FDFDoc_Class
Private cFDFApp As New FDFApp.FDFApp_Class
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
' OPEN XDP FROM BUFFER
'cFDFDoc = cFDFApp.FDFOpenFromStream(Request.InputStream, True, True)
' CREATE A BLANK CLASS
'cFDFDoc = cFDFApp.FDFCreate
' OPEN FROM FILE
cFDFDoc = cFDFApp.FDFOpenFromFile(XDPPath, True, True)
' POPULATE A PDF WITH XDP DATA
Populate_PDF_XDP_Data()
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Response.End()
End Try
End Sub
Public Sub Populate_PDF_XDP_Data()
Try
cFDFDoc.PDFData = cFDFDoc.PDFMergeXDP2Buf(PDFPath, False, "")
' CLEAR
Response.Clear()
' MIME
Response.ContentType = cFDFApp.MimePDF
' BUFFER
Response.BinaryWrite(cFDFDoc.PDFData)
Catch ex As Exception
Throw ex
End Try
' CALL OUTSIDE OF TRY{}
' END STREAM ENSURES NO HTML DATA IS WRITTEN
Response.End()
End Sub
End Class
Go back to Development, Design & Programming Tutorials section