merge fdf with a pdf (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


tbowser789 -> merge fdf with a pdf (1/25/2008 10:24:34)

Hello,

I have a website that has a form for users. They fill in the form, it is saved to sql database. The user can then go in and click on a link. The link will go to a fdf then merge the data to a pdf.

This works with no problem. I have been using it for a year. Now I want to make two small changes and I am unsure how to do it.

1. When the user clicks the link and the pdf opens with their data, the data appears in text fields that can be changed directly on the pdf. I want the pdf to be protected so when the user opens the pdf they cannot make any changes. Can this be done and still have a merge? If so how?

2. As I said above, the fdf file works fine right now with the text info. Now I want to add the ability to merge a image onto the pdf. The pdf file has a place for a signature on the bottom. When the user creates their account on the site they are able to upload their signature. I want the fdf to merge their signature image to the signature line on the pdf.

The database is named wctools. The table used is certificates and the field name is signature. it holds the name of the image.

Any ideas on how to do this? I have included the current code.

 <%@ LANGUAGE = VBScript%>
<%
'Option Explicit

DIM mySQL, myDSN, myPDFFormFields, myPDFFormFieldsArray, allData, conntemp, rstemp, i, myTempText

myDSN = "DRIVER={SQL Server};SERVER=****.com;DATABASE=wctools;UID=***;PWD=***"
mySQL = "SELECT agency, agencyaddress, agencycity, agencystate, agencyzip, companyname, companyaddress, companycity, companystate, companyzip, carrier, officersinc, officersexc, policynumber, effdate, expdate, elee, eld, eldee, busdesc, certholdname, certholdadd, certholdcity, certholdstate, certholdzip, certholdfax, documentdate, agencyphone, agencyfax, cerholderphone FROM certificates WHERE certificateid = " & Request.querystring("certificateid")
myPDFFormFields = "agency,agencyaddress,agencycity,agencystate,agencyzip,companyname,companyaddress,companycity,companystate,companyzip,carrier,officersinc,officersexc,policynumber,effdate,expdate,elee,eld,eldee,busdesc,certholdname,certholdadd,certholdcity,certholdstate,certholdzip,certholdfax,documentdate,agencyphone,agencyfax,cerholderphone"

myPDFFormFieldsArray = split(myPDFFormFields,",")


set conntemp=server.createobject("adodb.connection")

conntemp.open myDSN
set rstemp=conntemp.execute(mySQL)
IF  rstemp.eof THEN
   response.write "No matches in database<br>"
'	rstemp.close
	conntemp.close
   response.end
ELSE
	alldata=rstemp.getrows
	rstemp.close
	conntemp.close
END IF



myTempText = ""
myTempText = myTempText & "%FDF-1.2" & VbCrLf
myTempText = myTempText & "1 0 obj" & VbCrLf
myTempText = myTempText & "<<" & VbCrLf
myTempText = myTempText & "/FDF" & VbCrLf
myTempText = myTempText & "<<" & VbCrLf
myTempText = myTempText & "/Fields" & VbCrLf
myTempText = myTempText & "[" & VbCrLf

FOR i = 0 TO ubound(myPDFFormFieldsArray,1)
	myTempText = myTempText & "<< /T (" & myPDFFormFieldsArray(i) & ") /V (" & alldata(i,0) & ") >>" & VbCrLf
NEXT 
myTempText = myTempText & "]" & VbCrLf

'indicate which PDF template to use
myTempText = myTempText & "/F (http://www.***.com/forms/acord125.pdf)" & VbCrLf
myTempText = myTempText & ">>" & VbCrLf
myTempText = myTempText & ">>" & VbCrLf
myTempText = myTempText & "endobj" & VbCrLf
myTempText = myTempText & "trailer" & VbCrLf
myTempText = myTempText & "<<" & VbCrLf
myTempText = myTempText & "/Root 1 0 R" & VbCrLf
myTempText = myTempText & ">>" & VbCrLf
myTempText = myTempText & "%%EOF" & VbCrLf

Response.ContentType = "application/x-download"
call Response.AddHeader("Content-Disposition", "attachment; filename=" & timer() & ".fdf")
Response.Write(myTempText)
Response.End
%> 





Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875