Skip navigation
Currently Being Moderated

"This operation is not permitted" when saving PDF through a plugin

Mar 26, 2012 3:52 PM

Not sure what I am doing wrong. It appears as though I've followed the PDF Reference and documentation correctly, but I am getting this error when my plugin trys to save my PDF file to a new location (dont want to overwrite the original).

 

Here is the sample code. I hope what I am doing wrong is easy to fix.

 

 

 

 

PDDocClose(currentPDDoc);

ASPathName filePathName = ASFileSysCreatePathName(NULL, ASAtomFromString("CString"), replacedSavePath.c_str(), 0);

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

 
Replies
  • Currently Being Moderated
    Mar 27, 2012 1:55 AM   in reply to Eldrarak82

    Hi,

     

    The first thing I notice is that you have closed the currentPDDoc before you try and save it. I think you need to save it before you close it.

     

    I also not that you are saving linearized, this means that you need to make sure that any 'acquire' functions that you have called have been release, for example

    PDDocAcquirePage() or PDBeadAcquirePage(). - see documentation for more information.

     

    Hope this helps

     

    Malcolm

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2012 6:26 AM   in reply to Eldrarak82

    You can do an incremental save when you save to a new location - there is

    nothing to add the new information to. You need to call the function with

    PDSaveFull.

     

    You may not have acquired any objects explicitly, but chances are that if

    your plugin is doing anything useful, you have acquired something through

    some of the methods you called. Make sure that you know what the side

    effects of every API function you call are, and then release whatever is

    still acquired before you save the document.

     

    Karl Heinz Kremer

    PDF Acrobatics Without a Net

     

    khk@khk.net

    http://www.khkonsulting.com

     
    |
    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