

PdfDocument addedDoc = new PdfDocument(new PdfReader(newPageStream)) ĪddedDoc.CopyPagesTo(1, addedDoc.
#Use memory stream with pdfwriter pdf#
Okay, we are now all set to create our first PDF document. MemoryStream memStream new MemoryStream() PdfWriter wri PdfWriter.GetInstance(doc, memStream). GetInstance (doc, ms) from ms to pdf file i need. (Dont just create it inline in the call to PdfWriter.GetInstance - youll. Switch the filestream with a memorystream. i created a pdf doc using itextsharp and saved in to memorystream this memorystream write into pdf file. using iTextSharp using iTextSharp.text using Let's also create a folder where we save our PDF's right click the solution and add a folder, name it 'pdf'. Where your code has new FileStream, pass in a MemoryStream youve already created. PdfDocument pdfDoc = new PdfDocument(writer) To make the use of the component simple in code, add the following using statements in your code. PdfWriter writer = new PdfWriter(mainStream) MainStream = addNewPage(mainStream, newPageStream) Ĭode to Add new page : public static MemoryStream addNewPage(MemoryStream mainStream, MemoryStream newPageStream)

I have two html strings, I'm trying to write both of them to 2 memoryStreams, then read one pdfDocument and CopyPagesTo to the other pdfDocument, then finally return the memoryStream with the combined documents.
