Public Shared Sub EmbToPdf(ByVal objViewcreator As ViewCreatorGeneral, ByVal dtFromDatabase As DataTable, ByVal inColumnArrList As ArrayList, ByVal report_header As String, ByVal originalSort As String)
If Not System.IO.Directory.Exists(System.Web.HttpContext.Current.Server.MapPath("./ViewControlExport/")) Then
System.IO.Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath("./ViewControlExport"))
End If
dim pid as string =Guid.NewGuid.ToString & ".pdf"
Dim filePath As String = System.Web.HttpContext.Current.Server.MapPath("./ViewControlExport/") & pid
Try
Dim inDataSet As DataSet = New DataSet
GeneralHelper.GetDataSetForDiffFormats(dtFromDatabase, inDataSet, inColumnArrList)
'this code convert dataset into pdf document , itext is using
' see post belo for more info
inDataSet.Tables(0).DefaultView.Sort = originalSort
objViewcreator.BindingDataView = inDataSet.Tables(0).DefaultView
objViewcreator.ConvertDataViewToPdf(filePath,report_header,"",new Rectangle(1190,842 )) 'PagesSize.A3 = 1190,842
System.Web.HttpContext.Current.Response.Write("<embed src='" & "./ViewControlExport/" & pid & "#toolbar=1&navpanes=1&scrollbar=1' width='960' height='760'>")
System.Web.HttpContext.Current.Response.End()
Catch ex As Exception
Ubill.Logger.prn(filePath, ex.ToString)
End Try
End Sub
more...