Skip to main content
New Participant
February 20, 2025
Question

PDDocSave with PDSaveCopy Flag Fails When Saving a document opened from Google Drive

  • February 20, 2025
  • 1 reply
  • 311 views

Hi, I'm working on an Acrobat plugin that uses the PDDocSave function with the PDSaveCopy flag to save a temporary copy of an open PDF file (I use ASGetDefaultFileSys and ASFileSysGetTempPathName to get a temporary file name to pass to the function).

This method works well in most cases, and sometimes it works when I have a file that has been opened from a cloud drive (like Google Drive).

 

Sometimes this method fails when saving a copy of a Google Drive document.

PDDocSave doesn't return any error codes or anything, but the temporary file never gets created.

 

I also tried registering for the PDDocDidSave notification, and don't see any errors reported.

 

Does anyone have any ideas how to troubleshoot this further? Thanks!

 

1 reply

Thom Parker
Community Expert
February 21, 2025

It seems like the issue is outside of Acrobat, or at least something that is not coming back through the SDK. Which isn't surprising for a remote folder.  I would suggest a test that saves the file outside of the SDK. It might provide some more insight to the issue. 

Save the PDF to a safe, local temporary folder. Then use the OS api (from inside the plug-in) to move the file to the remote folder. 

Another method might be to use the API for the remote folder service directly, rather than relying on the OS to interpret the operations. 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
mike_8934Author
New Participant
February 24, 2025

Thanks for the suggestion, Thom. I can see that my initial description isn't very clear. Here is what I'm trying to do:

  1.  In Acrobat, open a PDF file from a linked Google Drive account. (Acrobat has built-in support for browsing and opening files from cloud providers, like Dropbox, Google Drive, SharePoint, etc.)
  2. Using Acrobat Plugin, save a copy of the opened PDF file to a local directory.

If I manually do File > Save As, I am able to save the open PDF file to my local computer.

 

For some reason when I call the PDDocSave in the plugin, it fails without any errors (but only with certain PDFs -- with other PDFs it works fine)

Thom Parker
Community Expert
February 25, 2025

Ok, so the plugin is trying and intermittantly failing to save a PDF file to a local folder that was opened from Google Drive.  And it is doing so with no failure indication.  I'm drawing a blank on that one. 

And it's always with the same files. A repeated attempt doesn't eventually save the file? 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often