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

Free Support Forum - aspose.com

Pdf save access error


1232566.pdf size is 300 mb.

 Aspose.Pdf.Document pdfdoc = new Aspose.Pdf.Document(this.UploadDirectory + fileName);
pdfdoc.Save(this.UploadDirectory + fileName);

Error:“System.IO.IOException: The process cannot access the file ‘file.pdf’ because it is being used by another process.”
No problem in small size pdf files


Thank you for contacting support,

We have downloaded the PDF file but Adobe Reader can not open it because the file is damaged and can not be repaired. However, this does not appear like an issue with Aspose.PDF for .NET as the API can not simultaneously read from and write to a same file in parallel. You need to change the name of generated document to avoid such a problem, append some string with output file name, for instance.

Or alternatively, you may use below code snippet in x64 Debug Mode to avoid the exception you are facing:

        String path = this.UploadDirectory + fileName;
        byte[] data = File.ReadAllBytes(path);
        MemoryStream stream = new MemoryStream(data);
        Document document = new Document(stream);
        FileStream file = new FileStream(path, FileMode.Create);

We hope this will be helpful. Please let us know if you need any further assistance.