Rank: Newbie Groups: Member
Joined: 5/1/2012 Posts: 1
|
I'm currently using ASPXtoPDF (v 2011.2) to do a snapshot capture of a web form when the Submit button is clicked on the form, and it seems to work all the time in the VS 2010 (.Net 4 target) debugger environment and intermittently when used on a production web server.
Protected Sub ASPxButtonUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ASPxButtonUpdate.Click Try
Session("isRefStatSaveAttachDB") = True ASPXToPDF1.RenderAsPDF(False) Response.Redirect(DestinationPage, False) Catch ex As System.Exception sbErrMsgbuf.AppendLine(String.Format("{0}{1} ASPxButtonUpdate_Click {2}", SiteGlobals.sErrorPrefix, Me.Title, ex.Message)) End Try End Sub
Protected Sub ASPXToPDF1_AfterRender(sender As Object, e As EventArgs) Handles ASPXToPDF1.AfterRender Try If Session("isRefStatSaveAttachDB") = True Then 'Cast the Result property to HtmlToPdfResult Dim result As HtmlToPdfResult = CType(ASPXToPDF1.Result, HtmlToPdfResult) If result Is Nothing Then sbErrMsgbuf.AppendLine(String.Format("{0}{1} No Result from ASPXToPDF1_AfterRender", SiteGlobals.sErrorPrefix, Me.Title)) Else 'Get the result document Dim doc As PdfDocument = result.PdfDocument Dim ms As IO.MemoryStream = New IO.MemoryStream result.PdfDocument.Save(ms) Dim bPDFBytes As Byte() = ms.ToArray Dim sPDFFileName As String = String.Format("PARForm_{0}_{1}.pdf", sEpiID, Session("VisCheck").ToString) sbErrMsgbuf.AppendLine(SiteGlobals.Insert_AttachmenttoDBTable(bPDFBytes, sPDFFileName, sEpiID, Session("NonAspUserName"), ConfigurationManager.ConnectionStrings("cciddata").ConnectionString)) End If End If Catch ex As System.Exception sbErrMsgbuf.AppendLine(String.Format("{0}{1} ASPXToPDF1_AfterRender {2}", SiteGlobals.sErrorPrefix, Me.Title, ex.Message)) End Try End Sub 'ASPXToPDF1_AfterRender
This is the error I get intermittently:
Global_asax Application_Error Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at EO.Web.ASPXToPDF.a(String A_0, Stream A_1) at EO.Web.Internal.mi.a(b[] A_0) at System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) at System.Web.HttpResponse.FilterOutput() at System.Web.HttpApplication.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Any ideas on possible solution?
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi,
This stack trace does not make sense to us. It indicates that it fails because it couldn't create a PdfDocument object, which does not appear to be possible based on the source code. So we do not know what else to tell you. I would recommend you to try to duplicate the problem in a separate test project and see if you can find what triggered the issue.
Thanks!
|