Hi there,
I am having an issue with generating a pdf on the live server. Locally it works fine. I have set the Trust Level in web.config to Full. however, I still get the following error when trying to generate the pdf (Line 698 is where the code breaks) :
Access is denied
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: Access is denied
Source Error:
Line 698: EO.Pdf.HtmlToPdf.ConvertHtml(HTMLforpdf, response.OutputStream)
Line 699:
Line 700: response.End() 'close the response
Source File: C:\Domains\rsvpmeonline.co.za\wwwroot\Modules\aw_mod_ArticleFull.ascx.vb Line: 698
Stack Trace:
[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited) +964480
System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean throwIfExited) +396
System.Diagnostics.Process.WaitForExit(Int32 milliseconds) +60
EO.Pdf.Internal.j6.a(Byte[] A_0, Int32 A_1) +214
EO.Pdf.Internal.j6.b(Byte[] A_0, Int32 A_1) +457
EO.Pdf.Internal.j6.c(Byte[] A_0, Int32 A_1) +180
EO.Pdf.Internal.kb.a(String A_0, Boolean A_1, String A_2) +278
EO.Pdf.Internal.kb.a() +333
[HtmlToPdfException: Convertion failed. Access is denied]
EO.Pdf.HtmlToPdfException.b(Exception A_0) +57
EO.Pdf.Internal.kb.a() +1153
EO.Pdf.HtmlToPdf.a(kb A_0) +24
EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options) +46
EO.Pdf.HtmlToPdf.ConvertHtml(String html, Stream stream, HtmlToPdfOptions options) +50
EO.Pdf.HtmlToPdf.ConvertHtml(String html, Stream stream) +7
Modules_aw_mod_ArticleFull.GeneratePDF(String Content, String ReportName) in C:\Domains\rsvpmeonline.co.za\wwwroot\Modules\aw_mod_ArticleFull.ascx.vb:698
Modules_aw_mod_ArticleFull.uiArticleFullSavePDFImageButton_Click(Object sender, ImageClickEventArgs e) in C:\Domains\rsvpmeonline.co.za\wwwroot\Modules\aw_mod_ArticleFull.ascx.vb:661
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
My code, in part, is:
Code: Visual Basic.NET
Private Sub GeneratePDF(Content As String)
'Set the response header
Dim response As HttpResponse = HttpContext.Current.Response
'Convert to the output stream
Dim HTMLforpdf As String
HTMLforpdf = Content
'Page Numbering
EO.Pdf.HtmlToPdf.Options.FooterHtmlFormat = "<p style=""font-family: Verdana, Arial, Helvetica, sans-serif; color: #333333; font-size: 8pt; text-align: right;"">Page {page_number} of {total_pages}<BR>" & Request.Url.ToString & "</p>"
'Page Size and Margins
EO.Pdf.HtmlToPdf.Options.PageSize = New System.Drawing.SizeF(8.3F, 11.7F)
EO.Pdf.HtmlToPdf.Options.OutputArea = New System.Drawing.RectangleF(0.5F, 0.5F, 7.3F, 10.7F)
response.Clear() 'clears current response
response.ClearHeaders()
response.ContentType = "application/pdf;"
EO.Pdf.HtmlToPdf.ConvertHtml(HTMLforpdf, response.OutputStream)
response.End() 'close the response
End Sub