Skip navigation
Currently Being Moderated

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

Mar 27, 2012 8:45 AM

Tags: #save #acrobat #x #plugin #plug #in #plug-in #use #read-only

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?

  • Currently Being Moderated
    Mar 27, 2012 9:06 AM   in reply to Eldrarak82

    The commands you list seem a bit out of order - there are two calls to

    PDDocSave(), one of them before I see the declaration of the path name.

    Because we don't know what's going on between those commands, it's

    impossible to diagnose your problem remotely.


    You are new to plug-in programming, so I would approach this by eliminating

    (or commenting out) anything that can potentially modify the PDF file, so

    that you just have the calls to get the PDDoc, and then to save that PDDoc

    at a different location. Does that work? If not, fix it - if it does work,

    add things piece by piece and see where things stop working.


    Are you sure you can write to the filename/directory you've selected? Have

    you tried a different directory?


    Plug-in programming for Acrobat is hard, and there is no way around making

    all the mistakes in the world and learning from them


    Karl Heinz Kremer

    PDF Acrobatics Without a Net


    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 12:38 PM   in reply to Eldrarak82

    Don't close the pddoc before you save it.

    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 12:42 PM   in reply to Eldrarak82

    When you will get help you should show the correct code.

    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 12:48 AM   in reply to Eldrarak82


    May be that won't help you, but in our Company, Users have the same error message when they open a PDF on the Internet with IE8 64 bits and then try to save it on their PC.

    Everything works fine if they use IE 8 32 bits... it only happens if they launch the 64 bits version of IE 8 on W7.

    I'm not sure what you're doing exactly, but if your pluging is using IE 8 64 bits, may be you should try IE 8 32 bits instead.

    Good luck

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points