using iTextSharp.text.pdf;
byte[] pdfBytes = GenerarPDFBasico();
File.WriteAllBytes("Ejemplo.pdf", pdfBytes);
Console.WriteLine("✅ PDF generado: 'Ejemplo.pdf'");
public static byte[] GenerarPDFBasico()
using (MemoryStream stream = new MemoryStream())
Document doc = new Document(PageSize.A4);
PdfWriter.GetInstance(doc, stream);
Font tituloFont = FontFactory.GetFont("Arial", 16, Font.BOLD);
Font textoFont = FontFactory.GetFont("Arial", 12, Font.NORMAL);
doc.Add(new Paragraph("Título del PDF", tituloFont));
doc.Add(new Paragraph("\nEste es un documento PDF generado con iTextSharp en C#.\n", textoFont));