Rank: Newbie Groups: Member
Joined: 7/17/2020 Posts: 1
|
EO.PDF version 20.1.88.0 .Net framework 4.8 I am using the following code in an ASP.Net web application to create a PDF from a web page. The PDF creates, saves and displays perfectly. The user is logged in to an admin area of the site when creating this PDF. Whenever the PDF is created, I lose my Session object and the user is redirected back to a login page. What would be causing this? All was working fine when I was using EO.PDF.dll version 5.0.75.2 but since upgrading to 20.1.88.0, I have had this issue.
Code: Visual Basic.NET
Dim sURL as String ' URL to convert to PDF
Dim sFilename as String ' location for saving the PDF
Dim pdfDoc As New EO.Pdf.PdfDocument
With HtmlToPdf.Options
.PageSize = New System.Drawing.SizeF(8.3F, 11.6F) ' A4 Portrait
.OutputArea = New System.Drawing.RectangleF(0.1F, 0.1F, 8.1F, 10.9F)
.FooterHtmlPosition = 11.05F
End With
Dim iResult As HtmlToPdfResult = HtmlToPdf.ConvertUrl(sURL, pdfDoc)
Dim render As Acm.AcmRender = New Acm.AcmRender(pdfDoc, New Acm.AcmPageLayout(New Acm.AcmPadding(1, 0, 1, 0)))
Dim header As Acm.AcmBlock = New Acm.AcmBlock(New Acm.AcmImage(NewImage("~/images/companylogo.jpg")))
Dim abn As Acm.AcmBlock = New Acm.AcmBlock(New Acm.AcmText("ABN " & oCompany.CompanyABN))
header.Style.Top = 0.2F : header.Style.Left = 5.0F
abn.Style.FontSize = "8" : abn.Style.Top = 0.98F : abn.Style.Left = 3.25F
Dim bookingref1 As New Acm.AcmBlock(New Acm.AcmText("Booking Ref:"))
bookingref1.Style.FontSize = "10" : bookingref1.Style.Top = 0.92F : bookingref1.Style.Left = 5.25F
Dim bookingref2 As New Acm.AcmBlock(New Acm.AcmText(sRef))
bookingref2.Style.FontSize = "14" : bookingref2.Style.FontStyle = System.Drawing.FontStyle.Bold : bookingref2.Style.Top = 0.85F : bookingref2.Style.Left = 6.1F
Dim taxinvoice As New Acm.AcmBlock(New Acm.AcmText("TAX INVOICE"))
taxinvoice.Style.FontSize = "12" : taxinvoice.Style.Top = 0.78F : taxinvoice.Style.Left = 3.25F
Dim footer As New Acm.AcmBlock(New Acm.AcmImage(NewImage("~/images/otherlogo.gif")))
footer.Style.Top = 10.45F : footer.Style.Left = 6.3F
render.Render(header, footer, bookingref1, bookingref2, taxinvoice, abn)
pdfDoc.Save(sFilename)
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,217
|
Hi,
Please check sFilename. HTML to PDF should not impact your website's session directly because it runs its own browser engine internally. However depending on where sFilename is, writing a file can cause your web application to restart. For example, writing a file into your site's bin folder will surely cause your application to restart. This in turn can cause your application to lose session data.
Thanks!
|