6 Replies Latest reply on Jun 26, 2012 12:48 AM by MbdaLogicielsBureautiques

    Acrobat X Plugin unable to save file to any location: File may be read-only, or open by another user

    Eldrarak82 Level 1

      I have a plugin which is making changes to a PDF file. Once all the changes are done, I am using PDDocSave to attempt to save the file to a path on the local disk C:\, however the save does not complete successfully and instead gives the error:
      "The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder."


      The intersting this is that the pathname that I provided to the PDDocSave method IS a different file name and a differnent folder name than the originally opened file.


      • I checked to make sure that I am releasing all acquired objects. I went line by line through 565 lines of code cross checking with the PDF reference to make sure that I cleaned up anything that needed cleaning before the save.

      • The folder permissions on the target folder are not read only, I am the owner of the folder, and have full permissions to the folder.
      • Security on the source document has been completely removed and the source folder is not read only.
      • Acrobat X Pro is not configured for enhanced security, therefore is not starting in Protected Mode.


      • Several ASAtom objects and CoSObjs are created in the code, however their scope is local to the method in which they are run and therefore are no longer valid when the document saves.


      Here are the major points of the code which I believe may be relevant in helping to troubleshoot this error:


      AVDoc currentAVDoc = AVAppGetActiveDoc();

      PDDoc currentPDDoc = AVDocGetPDDoc (currentAVDoc);



      PDDocSave(currentPDDoc, PDSaveFull | PDSaveLinearized, filePathName, ASGetDefaultFileSys(), NULL, NULL);

      ASPathName openFilePath = ASFileAcquirePathName(openFile);


      page = PDDocAcquirePage(currentPDDoc, i);


      ASPathName filePathToOpen = ASFileSysCreatePathName(NULL, pathType, filePathToGetSizeOf, 0);


      ASFileSysReleasePath(NULL, filePathToOpen);




      ASFileSysReleasePath(fileSysToUse, openFilePath);



      ASPathName filePathName = ASFileSysCreatePathName(NULL, ASAtomFromString("CString"), replacedSavePath.c_str(), 0);
      PDDocSave(currentPDDoc, PDSaveFull | PDSaveLinearized, filePathName, ASGetDefaultFileSys(), NULL, NULL);

      AVDocClose(currentAVDoc,  true);

      So that is where I am. The document does not save. Instead I get the error about being read-only or in use. Anyone have an idea whats happening?