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. Image for the cookie policy date

EssentialPDF : Cannot save to the same opened file!

I did this in VS2005 C#:

PDFDocument docA = new PDFDocument("C:\\docA.pdf");
PDFDocument docB = new PDFDocument("C:\\docB.pdf");

foreach (IPDFPage page in docB.Pages) {
docA.Pages.Insert(0, page);
}

docA.Save("C:\\docA.pdf");


I get an I/O error saying that docA.PDF is in use by another process. Question: how can I open an existing PDF, modify it and then save it?

Thanks,

Richard

3 Replies

DK Dhivya K Syncfusion Team February 1, 2007 01:40 PM UTC

Hi Richard,

Thank you for the code snippet. I was able to reproduce the issue. The problem is, you are saving the file with the same name that of the source file name which is being used. Can you please change the file name in save statement? This is same as modifying the existing document.

Here is a sample for your reference:
merge.zip

Please take a look into it and let me know if you have any other queries.

Regards,
Dhivya.


RI Richard February 1, 2007 02:46 PM UTC

Thanks for your reply. The logic I expected is that you could:

a) Open an existing PDF document
b) Make some modifications to it (add pages, bookmarks, Title, etc)
c) Save it

This is the common behaviour of most applications. In MS-Word for example, you are not required to "Save As..." under a new file name every time you make a change! You just "Save".

Maybe you should add an overload Save() with no parameters that saves the document to the same file it was opened?

Richard


DK Dhivya K Syncfusion Team February 2, 2007 01:43 PM UTC

Hi Richard,

Thank you for the information. Currently it is not possible to save a document with the same name. Instead we create a new PDF document with the existing content. I have forwarded this feature request to our development team regarding their thoughts on this overload.

Please let me know if you have any other queries.

Regards,
Dhivya.

Loader.
Live Chat Icon For mobile
Up arrow icon