iTextSharp.text.Document doc = new iTextSharp.text.Document(iTextSharp.text.PageSize.SMALL_PAPERBACK, 10, 10, 42, 35); iTextSharp.text.pdf.PdfWriter wri1 = iTextSharp.text.pdf.PdfWriter.GetInstance(doc, memStream); doc.Open();//Open Document to write iTextSharp.text.Paragraph paragraph1 = new iTextSharp.text.Paragraph("memStream.EndWrite()"); iTextSharp.text.Phrase pharse = new iTextSharp.text.Phrase("This is my second line using Pharse."); iTextSharp.text.Chunk chunk = new iTextSharp.text.Chunk(" This is my third line using Chunk."); doc.Add(paragraph1); //doc.Add(pharse); //doc.Add(chunk); doc.Close(); byte[] content = memStream.ToArray(); // Write out PDF from memory stream. using (FileStream fs = File.Create("D:\\Test.pdf")) { fs.Write(content, 0, (int)content.Length); }
doc.Close();
Using { ... }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)