TLS網站和系統登入
大多數 ASP.NET 應用程式支援網路驗證,比 HTML 表單提交更可靠。 如需有關IronPDF和身份驗證表單的更多範例,請參閱在系統登錄後渲染PDF文件文章。
using IronPdf; using System; using System.IO; var uri = new Uri("http://localhost:51169/Invoice"); var urlToPdf = new ChromePdfRenderer { RenderingOptions = new ChromePdfRenderOptions() { MarginTop = 50, MarginBottom = 50, TextHeader = new TextHeaderFooter() { CenterText = "{pdf-title}", DrawDividerLine = true, FontSize = 16 }, TextFooter = new TextHeaderFooter() { LeftText = "{date} {time}", RightText = "Page {page} of {total-pages}", DrawDividerLine = true, FontSize = 14 }, CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print }, // setting login credentials to bypass basic authentication LoginCredentials = new IronPdf.ChromeHttpLoginCredentials { NetworkUsername = "testUser", NetworkPassword = "testPassword" } }; var pdf = urlToPdf.RenderUrlAsPdf(uri); pdf.SaveAs(Path.Combine(Directory.GetCurrentDirectory(), "UrlToPdfExample2.Pdf"));
Imports IronPdf Imports System Imports System.IO Private uri = New Uri("http://localhost:51169/Invoice") Private urlToPdf = New ChromePdfRenderer With { .RenderingOptions = New ChromePdfRenderOptions() With { .MarginTop = 50, .MarginBottom = 50, .TextHeader = New TextHeaderFooter() With { .CenterText = "{pdf-title}", .DrawDividerLine = True, .FontSize = 16 }, .TextFooter = New TextHeaderFooter() With { .LeftText = "{date} {time}", .RightText = "Page {page} of {total-pages}", .DrawDividerLine = True, .FontSize = 14 }, .CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print }, .LoginCredentials = New IronPdf.ChromeHttpLoginCredentials With { .NetworkUsername = "testUser", .NetworkPassword = "testPassword" } } Private pdf = urlToPdf.RenderUrlAsPdf(uri) pdf.SaveAs(Path.Combine(Directory.GetCurrentDirectory(), "UrlToPdfExample2.Pdf"))
Install-Package IronPdf
大多數 ASP.NET 應用程式支援網路驗證,比 HTML 表單提交更可靠。 如需有關IronPDF和身份驗證表單的更多範例,請參閱在系統登錄後渲染PDF文件文章。