TLS 网站和系统登录
大多数 ASP.NET 应用程序都支持网络验证,这比 HTML 表单发布更可靠。 有关 IronPdf 和 Authentication Forms 的更多示例,请查看在系统登录后台生成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 和 Authentication Forms 的更多示例,请查看在系统登录后台生成PDF文章