Ejemplo: itext 7 agrega una imagen a un pdf existente
// Modify PDF located at "source" and save to "target"
PdfDocument pdfDocument = new PdfDocument(new PdfReader(source), new PdfWriter(target));
// Document to add layout elements: paragraphs, images etc
Document document = new Document(pdfDocument);
// Load image from disk
ImageData imageData = ImageDataFactory.Create(imageSource);
// Create layout image object and provide parameters. Page number = 1
Image image = new Image(imageData).ScaleAbsolute(100, 200).SetFixedPosition(1, 25, 25);
// This adds the image to the page
document.Add(image);
// Don't forget to close the document.
// When you use Document, you should close it rather than PdfDocument instance
document.Close();
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)