Free Support Forum - aspose.com

Written PDF file stays locked and cannot be used by current method


#1

I get the following error when attempting to read the PDF file within the same method after creating it. Please help with resolving this as I am currently reviewing this product.

“The process cannot access the file ‘output.pdf’ because it is being used by another process.”

Code used (the sample code from the website):
// create an instance of Ps2PdfConverter
var converter = new Aspose.EPS.Ps2PdfConverter();
// convert EPS to PDF
converter.ConvertToPdf
(
new Aspose.EPS.Ps2PdfConverterOptions
(
new System.IO.FileStream(dir + “template.eps”, System.IO.FileMode.Open, System.IO.FileAccess.Read),
new System.IO.FileStream(dir + “output.pdf”, System.IO.FileMode.Create, System.IO.FileAccess.Write)
)
);


#2

I resolved this by declaring the file streams outside of the constructor and then closing the files after the conversion. Your sample code should be updated.


#3

@pfleischman

Thank you for contacting support.

We are glad to know that your issue has been resolved. We will update the code accordingly. Please keep using our API and in event of any further query, feel free to ask.