using System; //using iTextSharp; using iTextSharp.text; using iTextSharp.text.pdf; //*iTextSharp //using iTextSharp.text.pdf.parser; //*iTextSharp Text-Reader using System.IO; //Pour les fichiers namespace CreatePDF { class Program { static void Main(string[] args) { //Console.WriteLine("Hello World!"); var fileName = @"C:\aaaa.pdf"; using FileStream objFileStream = File.Create(fileName); //using var objStreamWriter = new StreamWriter(objFileStream); //System.IO.FileStream fs = new FileStream(Server.MapPath("pdf") + "\\" + "First PDF document.pdf", FileMode.Create) // Create an instance of the document class which represents the PDF document itself. Document document = new Document(PageSize.A4, 25, 25, 30, 30); // Create an instance to the PDF file by creating an instance of the PDF // Writer class using the document and the filestrem in the constructor. PdfWriter writer = PdfWriter.GetInstance(document, objFileStream); // Add meta information to the document document.AddAuthor("Test"); document.AddCreator("Test using iTextSharp"); document.AddKeywords("test"); document.AddSubject("test"); document.AddTitle("test"); // Open the document to enable you to write to the document document.Open(); // Add a simple and wellknown phrase to the document in a flow layout manner document.Add(new Paragraph("Hello World Baby !")); // Close the document document.Close(); // Close the writer instance writer.Close(); // Always close open filehandles explicity objFileStream.Close(); } } }