itext 7 java create pdf in memory code example
Example 1: itext7 pdfwriter outputstream c#
public byte[] CreatePdf()
{
var stream = new MemoryStream();
var writer = new PdfWriter(stream);
var pdf = new PdfDocument(writer);
var document = new Document(pdf);
document.Add(new Paragraph("Hello world!"));
document.Close();
return stream.ToArray();
}
Example 2: itext7 c# memorystream
public byte[] GeneratePdf()
{
var stream = new MemoryStream();
var writer = new PdfWriter(stream);
var pdf = new PdfDocument(writer);
var document = new Document(pdf);
document.Add(new Paragraph("Lorem Ipsum ..."));
document.Close();
return stream.ToArray();
}