locked
Using iText how to create pdf from Memory Stream RRS feed

  • Question

  • User1421798636 posted

    Code is in .net framework 3.5.Added reference to itextsharp.pdfa.


    The code is :

    using iTextSharp.text;
    using iTextSharp.text.pdf;

    using (MemoryStream memDoc = new MemoryStream())
    {
    memDoc.Write(byteArray, 0, (int)byteArray.Length);
    using (WordprocessingDocument doc = WordprocessingDocument.Open(memDoc, true))
    {
    string confirmXML = XDocument.Load(doxPath);
    ....
    using (StreamWriter ts = new StreamWriter(customXML.GetStream()))
    {
    ts.Write(confirmXML);
    }
    doc.Close();


    }

    }

    for the above code how do I generate the PDF. All examples show like creating the document:

    PdfWriter.GetInstance(document, workStream).CloseStream = false;

    Is there a way to generate pdf from the document loaded in memory stream. and send this  PDF to browser

    Friday, August 15, 2014 12:38 PM

All replies

  • User1316246260 posted

    You must goto Project>...Add References and add "itextsharp.dll".

    using iTextSharp.text;
    using iTextSharp.text.html.simpleparser;
    using iTextSharp.text.pdf;

    Friday, August 15, 2014 1:36 PM