We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Merging Multiple PDF Files from streams

Thread ID:





92210 Dec 28,2009 09:58 AM Dec 30,2009 10:56 PM ASP.NET Web Forms (Classic) 2
Tags: PDF
Matt Dixon
Asked On December 28, 2009 09:58 AM

My requirement is to create a number of separate PDF files from different HTML pages and then merge them all together and save the final file.

Currently, I am using the PDF converter to create a number of temporary PDF files on the server, and then merge those files.

I can't delete the temp files after the merge is complete. I get an error: "The process cannot access the file '[filename.pdf]' because it is being used by another process."

So instead of leaving all these temp files on my server, it would be great if I could write the files to a memory stream and then merge the files from the stream and output the final pdf.

Alternatively, it may be easier to just delete the temp files. Could someone explain how to close the pdf files so i can delete them?

Code attached.

Can anyone help?



Divya G [Syncfusion]
Replied On December 30, 2009 10:54 PM

Hi Matt,

Thank you for using Syncfusion Products.

We have to save and close the document before delete the files.Kindly use the following lines of code to delete the temp files.
doc.Save("FinalReport.pdf", Response, HttpReadType.Save);
// Close the document Before delete the files.

Please refer the attachment to solve the issue.


Divya G [Syncfusion]
Replied On December 30, 2009 10:56 PM

Hi Matt,

Here is the attachment.

Thanks & regards,



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.