Hi,
If someone can please proof read and help me find the reason why I can’t create the PDF file.
When I run bellow pasted code it freezes when tmpPrnDoc.Print() line is reached. Any ideas what can cause it?
Private Sub CreatePDF()
Dim strPrinter, strFileName, sPath, sOutputFile As String
Dim strLicensee, strActivation, sCurrentSession As String
Dim Dr As Directory
Dim pdf As New CDIntfEx.CDIntfEx
Dim tmpPrnDoc As PrintDocument
Try
strPrinter = "GFSPDFPrinter"
sCurrentSession = Session.SessionID
sPath = ConfigurationSettings.GetConfig("Paths")("pdfPath")
If Not Dr.Exists(sPath) Then
Dr.CreateDirectory(sPath)
sPath = sPath + "\"
End If
strFileName = sCurrentSession & ".pdf"
sOutputFile = sPath & strFileName
pdf.DriverInit(strPrinter)
pdf.PrinterLanguage = 1
pdf.EnablePrinter(Licensee, ActivationCode)
pdf.Resolution = 600
pdf.SetDefaultPrinter()
pdf.FileNameOptionsEx = 1 + 2 + 16 + 2097152 + 4194304 + 16777216
pdf.DefaultFileName = sOutputFile
tmpPrnDoc = New PrintDocument
AddHandler tmpPrnDoc.PrintPage, New System.Drawing.Printing.PrintPageEventHandler(AddressOf toPrinter)
tmpPrnDoc.Print()
pdf.RestoreDefaultPrinter()
pdf.DriverEnd()
pdf = Nothing
Catch ex As Exception
Response.Write(ex.ToString)
Response.End()
Finally
Response.Flush()
Response.Close()
End Try
End Sub