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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Merging Multiple PDF Files from streams

Thread ID:

Created:

Updated:

Platform:

Replies:

92210 Dec 28,2009 02:58 PM UTC Dec 31,2009 03:56 AM UTC ASP.NET Web Forms (Classic) 2
loading
Tags: PDF
Matt Dixon
Asked On December 28, 2009 02:58 PM UTC

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?

Thanks,
Matt



Generator_63640661.zip

Divya G [Syncfusion]
Replied On December 31, 2009 03:54 AM UTC

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.
(C#):
doc.Save("FinalReport.pdf", Response, HttpReadType.Save);
// Close the document Before delete the files.
doc.Close();
File.Delete(paths[0]);
File.Delete(paths[1]);

Please refer the attachment to solve the issue.

Regards,
Divya.G

Divya G [Syncfusion]
Replied On December 31, 2009 03:56 AM UTC

Hi Matt,

Here is the attachment.

Thanks & regards,
Divya.G




Generator_76232cac.zip

CONFIRMATION

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.

Warning Icon 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.Close Icon

;