PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/
__________________________________________________________________
Hello--
I've been successful in creating .aspx pages that
populate .pdf forms with info from a DB using FDF, but
have been running into trouble when trying to
implement this through a class file (to .aspx page).
Things seem to go wrong when I call the class from
another page (final version will call from within a
flash remoting app, which is why I need this
implemented as a class, but for testing I just have an
aspx page with a button that calls the class)--I get a
dialog asking if I want to download the original page
that called the class. Here are some code snippets in
case that's useful...
Imports System.Data
Imports System.Data.SqlClient
Imports System.Text
Imports System.IO
Imports FDFACXLib
Public Class generateForms
Public Shared Function GenerateI140(ByVal clientID As
String)
'settings for all forms generators
Dim FdfAcX As FDFACXLib.FdfApp
FdfAcX = New FDFACXLib.FdfApp
Dim outputFDF = FdfAcX.FDFCreate()
Dim sbSetFile As New StringBuilder
sbSetFile.Append(ConfigurationSettings.AppSettings("URL"))
'settings for this form
sbSetFile.Append("forms/i-140.pdf")
' run stored procedure
Dim connection As New
SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim command As New SqlCommand("generateI140",
connection)
command.CommandType =
CommandType.StoredProcedure
command.Parameters.Add("@clientID",
SqlDbType.VarChar, 50).Value = "[EMAIL PROTECTED]"
Dim dr As SqlDataReader
command.Connection = connection
connection.Open()
dr =
command.ExecuteReader(CommandBehavior.CloseConnection)
dr.Read()
Dim I140indivSponsorNameFirst As String =
dr.Item("indivSponsorNameFirst")
Dim I140indivSponsorNameMiddle As String =
dr.Item("indivSponsorNameMiddle")
Dim I140indivSponsorNameLast As String =
dr.Item("indivSponsorNameLast")
Dim I140companySponsorName As String =
dr.Item("companySponsorName")
.
.
.
outputFDF.FDFSetValue("I140indivSponsorNameFirst",
I140indivSponsorNameFirst, False)
outputFDF.FDFSetValue("I140indivSponsorNameMiddle",
I140indivSponsorNameMiddle, False)
outputFDF.FDFSetValue("I140indivSponsorNameLast",
I140indivSponsorNameLast, False)
outputFDF.FDFSetValue("I140companySponsorName",
I140companySponsorName, False)
outputFDF.FDFSetValue("I140addrStreet1",
I140addrStreet1, False)
.
.
.
outputFDF.FDFSetFile(sbSetFile.ToString)
System.Web.HttpContext.Current.Response.ContentType =
"application/vnd.fdf"
System.Web.HttpContext.Current.Response.BinaryWrite(outputFDF.FDFSaveToBuf)
outputFDF.FDFClose()
End Function
End Class
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfforms.html