We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Creating a PDF section using a byte array


Im building a big pdf out of multiple sources including other PDFs, which are retrieved via API in the form of a byte array. Using Generator.Pdf.Import(streamreader) seems like it is built for that, but it is giving me a blank section every time.

Here is my code

                        MemoryStream mstream = new MemoryStream(pdfByteArray);
Pdf pdf = new Pdf();
pdf.Import(new StreamReader(mstream));
Section section = new Section(pdf);
			finalPdf.Sections.Insert(finalPdf.Sections.Count, section);

it is blank,  so perhaps this is not the proper way of doing it?
the documentation is light on this subject,  
so I hope you can help.

is it just not possible then?


Thanks for contacting support and sorry for the delayed response.

Aspose.Pdf.Generator namespace only provides the feature to create PDF document from scratch and it does not offer the feature to load/use existing PDF files. In case you need to use the contents from PDF file, please try using Aspose.Pdf.Document object. Aspose.Pdf.Document object has an overload constructor to load contents from Stream object (you can instantiate Stream object from Byte Array) and concatenate the contents. For further information, please visit

I *am* building the PDF from scratch, a large pdf that is mostly text, and I need to also be able append a pdf byte array.
Is this not possible with Aspose?


Thanks for sharing the details.

Aspose.Pdf provides the feature to create as well as manipulate existing PDF files. So as per your requirement, you can also concatenate PDF files using this API. For further information, please visit Concatenate PDF Files