Añadir contenido HTML de forma eficiente
La función IronPDf.PdfDocument.ApplyMultipleStamps
permite a los desarrolladores estampar rápidamente varios tipos de sellos en una o varias páginas de un PDF.
using IronPdf; using IronPdf.Editing; using System; // Utiliza HtmlStamper para estampar Html en pdf HtmlStamper htmlStamper = new HtmlStamper("<h1>Html stamp</h1>") { VerticalOffset = new Length(-200, MeasurementUnit.Pixel), HorizontalOffset = new Length(-200, MeasurementUnit.Pixel), }; // Utiliza TextStamper para estampar texto con fuentes personalizadas en pdf TextStamper textStamper = new TextStamper("Hello World! Stamp One Here!") { FontFamily = "Bungee Spice", UseGoogleFont = true, FontSize = 30, }; // Utiliza ImageStamper para estampar imágenes en pdf Uri filepath = new Uri(@"C:\assets\logo.png"); // ruta absoluta o URL ImageStamper imageStamper = new ImageStamper(filepath) { VerticalAlignment = VerticalAlignment.Top, MinWidth = new Length(20), MinHeight = new Length(20), }; // Utiliza BarcodeStamper para estampar código QR/código de barras en pdf BarcodeStamper barcodeStamper = new BarcodeStamper("IronPDF", BarcodeEncoding.Code39) { MaxHeight = new Length(5), VerticalAlignment = VerticalAlignment.Bottom, HorizontalAlignment = HorizontalAlignment.Left, }; Stamper[] stamps = { htmlStamper, textStamper, imageStamper, barcodeStamper }; var pdf = PdfDocument.FromFile("Unstamped.pdf"); pdf.ApplyMultipleStamps(stamps); pdf.SaveAs("Stamped.pdf");
Imports IronPdf Imports IronPdf.Editing Imports System ' Utiliza HtmlStamper para estampar Html en pdf Private htmlStamper As New HtmlStamper("<h1>Html stamp</h1>") With { .VerticalOffset = New Length(-200, MeasurementUnit.Pixel), .HorizontalOffset = New Length(-200, MeasurementUnit.Pixel) } ' Utiliza TextStamper para estampar texto con fuentes personalizadas en pdf Private textStamper As New TextStamper("Hello World! Stamp One Here!") With { .FontFamily = "Bungee Spice", .UseGoogleFont = True, .FontSize = 30 } ' Utiliza ImageStamper para estampar imágenes en pdf Private filepath As New Uri("C:\assets\logo.png") ' ruta absoluta o URL Private imageStamper As New ImageStamper(filepath) With { .VerticalAlignment = VerticalAlignment.Top, .MinWidth = New Length(20), .MinHeight = New Length(20) } ' Utiliza BarcodeStamper para estampar código QR/código de barras en pdf Private barcodeStamper As New BarcodeStamper("IronPDF", BarcodeEncoding.Code39) With { .MaxHeight = New Length(5), .VerticalAlignment = VerticalAlignment.Bottom, .HorizontalAlignment = HorizontalAlignment.Left } Private stamps() As Stamper = { htmlStamper, textStamper, imageStamper, barcodeStamper } Private pdf = PdfDocument.FromFile("Unstamped.pdf") pdf.ApplyMultipleStamps(stamps) pdf.SaveAs("Stamped.pdf")
Install-Package IronPdf
La función IronPDf.PdfDocument.ApplyMultipleStamps
permite a los desarrolladores estampar rápidamente varios tipos de sellos en una o varias páginas de un PDF.
9 productos API .NET para sus documentos de oficina