0
wikiHPP 또는 wikiHPP를 사용하지 않고 pdf를 만들 필요가 있습니다. 왜냐하면 그들은 페이지에서 URL이 필요하고 내 사이트에 보안이 있기 때문에 작동하지 않기 때문입니다. 사이트를 인쇄하려고하면 기본 페이지로 이동합니다..aspx 페이지를 pdf로 변환하는 방법? 사이트에서 URL을 사용하지 않고
누군가 내가 어떻게 할 수 있습니까?
미리 감사드립니다.
wikiHPP 또는 wikiHPP를 사용하지 않고 pdf를 만들 필요가 있습니다. 왜냐하면 그들은 페이지에서 URL이 필요하고 내 사이트에 보안이 있기 때문에 작동하지 않기 때문입니다. 사이트를 인쇄하려고하면 기본 페이지로 이동합니다..aspx 페이지를 pdf로 변환하는 방법? 사이트에서 URL을 사용하지 않고
누군가 내가 어떻게 할 수 있습니까?
미리 감사드립니다.
저는 EvoPdf를 사용하여 제 해결책이 당신과 다를 수 있지만 양식 인증을 사용하여 불행히도 vb.net과 동일한 문제가 발생했습니다. 내 솔루션은 다음과 같습니다. 핵심 부분은 Pdf 라이브러리의 쿠키를 인증 된 계정의 쿠키로 설정하는 것이 었습니다.
Private Sub uiPdf_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles uiPdf.Click
Dim urlToConvert As String = "ExportPdf.aspx"
'// get the html string for the report
Dim htmlStringWriter As New System.IO.StringWriter()
Server.Execute(urlToConvert, htmlStringWriter)
Dim htmlCodeToConvert As String = htmlStringWriter.GetStringBuilder().ToString()
htmlStringWriter.Close()
'// Create the PDF converter.
Dim pdfConverter As New EvoPdf.HtmlToPdf.PdfConverter()
'************
'Add the cookie so we don't get bounced to the home page
'************
If Not Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName) Is Nothing Then
pdfConverter.HttpRequestCookies.Add(System.Web.Security.FormsAuthentication.FormsCookieName, Request.Cookies(System.Web.Security.FormsAuthentication.FormsCookieName).Value)
End If
'// set the license key - required
pdfConverter.LicenseKey = ConfigurationManager.AppSettings("EvoPdfLicenseKey")
'// set the converter options - optional
'... code omitted
'// be saved to a file or sent as a browser response
Dim baseUrl As String = HttpContext.Current.Request.Url.AbsoluteUri
Dim pdfBytes As Byte() = pdfConverter.GetPdfBytesFromHtmlString(htmlCodeToConvert, baseUrl)
'// send the PDF document as a response to the browser for download
Dim response As System.Web.HttpResponse = System.Web.HttpContext.Current.Response
Response.Clear()
Response.AddHeader("Content-Type", "application/pdf")
response.AddHeader("Content-Disposition", String.Format("attachment; filename=GettingStarted.pdf; size={0}", pdfBytes.Length.ToString()))
response.BinaryWrite(pdfBytes)
response.End()
End Sub
감사합니다. – user2069291