Create a PDF batch file

Discussion in 'C#' started by tomred, Sep 22, 2008.

  1. #1
    Hi,

    I am creating certificates for a list of users. I have already done the template in PDF format.

    I now need to populate the template with names from the db. At the minute i can populate the first template ok but I need to do them as a batch so they can all be printed together.

    Heres what I have so far, this poulates the template once, how can i have multiple certificates in one download?

    
    
    Set rsApplicants = Server.CreateObject ("ADODB.Recordset")
    SQL2 = "SELECT * from applicants"
    rsApplicants.Open SQL, Con
    
    
    Set Pdf = Server.CreateObject("Persits.Pdf")
    
    Set Doc= Pdf.OpenDocument(Server.MapPath("pdf\certificate.pdf"))
    
    VarApplicantName = rsApplicants("ApplicantFName") & " " & rsApplicants("ApplicantLName")
    
    Set Field = Doc.Form.FindField("name")
    Field.SetFieldValue VarApplicantName, Doc.fonts("Helvetica")
    
    
    Doc.SaveHttp "attachment;filename=Output_Certificates.pdf"
    
    
    
    rsApplicants.Close()
    Set rsApplicants = Nothing
    
    
    Code (markup):
     
    tomred, Sep 22, 2008 IP