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

Free Support Forum - aspose.com

RDLC to Stream to PDF


I am developing a series of reports where the final pdf is a combination of three RDLC files. I have streamed the it into a byte[] inside of a list. I can retrieve and generate each individual report from stream using this code:

private void CreatePDFReport()


int i = 0;

foreach (byte[] bytPart in listByt_ReportParts)


FileStream stream = new FileStream(strTExcel + '\\' + i.ToString() + strTempPdf, FileMode.Create);

stream.Write(bytPart, 0, bytPart.Length);

Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf(stream);

pdf1.PageSetup.PageHeight = 29.7f;

pdf1.PageSetup.PageWidth = 21.0f;




If I try to close the stream after the three reports have been generated, although I get a pdf files with teh total size of the 3 pages combined just the last page is displayed. The company I am working for uses Aspose Total. I used to do this before at my old company.

using this:

Dim pdfOptions As PdfDocumentOptions = New PdfDocumentOptions()

pdfOptions.PdfCompressionLevel = PDFCompressionLevel.Best

Dim byt_PdfReportParts As PDFMerge = New PDFMerge(pdfOptions) ' Declare the PDF Merger class

byt_PdfReportParts.LicenseKey = "??????????????????????" ' Declare the licence key

For Each bytPart As Byte() In listByt_ReportParts

byt_PdfReportParts.AppendPDFStream(New MemoryStream(bytPart)) ' Bind all the report parts created


Do you have anything similar to this on Aspose. I saw some threads where I can combine 2 pdf, but what I need is to generate a pdf of the combined files held at the stream.

Regards, Tony

Hi Tony,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, I am not clear about your requirement. As I can understand, you need to generate a new PDF file from existing streams. If yes, then you may check the following documentation links for your reference regarding concatenation of the files into a new PDF file using streams.

Concatenate PDF Files Using Streams (Facades)

Concatenate Array of PDF Files Using Streams (Facades)

If my understanding of your requirement is not correct, please share some more details and your input and required output PDF files to explain the requirement. We will provide the appropriate solution accordingly.

Thank You & Best Regards,

HI, I have tried to work around your solution, using pdFileeditor, but I am not sure if I understood it correctly.

I have a list< > of byte[] that contain 3 pdf pages from 3 rdlc , if I use the normal way to create a pdf doc I will have three single pdf with a single page, or a document of the size of merged 3 pages but just showing the last one page.

I have gone nowhere with this. I can extract from my list each single Byte[], so I do not to read it
like inputStreams[1] = new FileStream(“input2.pdf”, FileMode.Open);,

it is already like that but is a List<> not an Array[], I can do this byte[][] f = List.toArray(); But I cannot use it.

I would like to use the byte[] I already have, not need to create 3 physical pdf fileson disk and read it back into an array of Filestream, so I can concatenate it.

Is there a way to do it.



Hi Tony,

Thanks for sharing the details with us. Using Aspose.Pdf for .NET, you can achieve this functionality by converting byte [] into MemoryStream and then concatenate the MemoryStreams into one MemoryStream after that the resultant MemoryStream convert to single byte [] and write the combined byte [] into PDF file. I hope this will work for you, kindly visit for more details and code snippet: Concatenate multiple PDF files using MemoryStreams

Please feel free to contact support in case you required any further assistance.

Thanks & Regards,

Thank you very much Rashid, the information you have given me guided me to the solution:

MemoryStream[] inputStreams = new MemoryStream[listByt_ReportParts.Count()];

int i = 0;

//create PdfFileEditor object

Aspose.Pdf.Facades.PdfFileEditor pdfEditor = new Aspose.Pdf.Facades.PdfFileEditor();

//output stream

FileStream outputStream = new FileStream(strPath + '\\' + "output.pdf", FileMode.Create);

foreach (byte[] bytPart in listByt_ReportParts)


byte[] tt = bytPart;

inputStreams[i] = new MemoryStream(tt);



pdfEditor.Concatenate(inputStreams, outputStream);


It generates the the combines PDF file I needed

Thank you very much

Hi Tony,

Thank you very much for your feedback. It is great to hear that your issue has been resolved. You are always welcome and please feel free to ask if you have any query in future.

Thanks & Regards,