Check out example codes for "itext7 pdfwriter outputstream c#". It will help you in understanding the concepts better.

Code Example 1

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();
    }

Learn ReactJs, React Native from akashmittal.com