Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Feb 09, 2015 9:18 pm

Hi,
I found the code to merge multiple streams on to one big pdf file.
In my case i don't know the actual number of pdf streams?
How to achieve this without the number of streams to merge.
PdfDocument[] documents = new PdfDocument[?];

kulwinder
 
Posts: 6
Joined: Tue Feb 03, 2015 9:14 pm

Tue Feb 10, 2015 6:15 am

Dear kulwinder,

Thanks for your inquiry.
You can try below code:
Code: Select all
ArrayList AL = new ArrayList();
//add the document to ArrayList. 
AL.Add(new PdfDocument(@"..\Sample1.pdf"));
//finally create documents by ArryList.toArry().
PdfDocument[] documents =(PdfDocument[])AL.ToArray(typeof(PdfDocument));

Please feel free to contact us if you have any questions or needs.

Best Regards,
Betsy
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Feb 10, 2015 7:20 pm

thanks for posting solution, i found the solution by myself don't need to create arraylist and then cast back to array.

I am using list code is here.
var documentList = new List<PdfDocument>();
documentList.Add(new PdfDocument(pdfStream));
documentList.FirstOrDefault().SaveToFile(pdfFileFullPath);

but thanks for your solution

kulwinder
 
Posts: 6
Joined: Tue Feb 03, 2015 9:14 pm

Wed Feb 11, 2015 1:51 am

Dear kulwinder,

I’m glad to hear that your issue has been resolved.
If there are any questions, welcome to get it back to us.

Best Regards,
Betsy
E-iceblue Support Team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.PDF