1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Create a PDF batch file

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

  1. #1
    Hi,
    SEMrush
    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
    SEMrush