Copy link to clipboard
Copied
I have used IAC Save function. Here is the code that no longer works (it was working for a long time until a week ago). The code still works on our old Acrobat XI Pro systems; it fails on Acrobat DC systems. Does anyone know what happened or how I can solve the problem?
Here is the statement that fails (always returns false):
pdDocTarget.Save((short)PDSaveFlags.PDSaveFull, targetFilespec) <--- always returns false now!!!
Note that other function still work. For example,
int ctrPagesInSource = pdDocSource.GetNumPages(); ,<--- still works
Copy link to clipboard
Copied
HI,
This looks like it is probably a bug in Acrobat, although it might be worth changing the paths to different places, just to check it is not some security change.
Copy link to clipboard
Copied
I created two posts originally since two problems became active a week or two ago.
Here is a copy of the reply I just sent for the other post.
On Windows 10, Adobe Acrobat DC - fails as stated (even though has worked for a year or more with no code changes.
On Windows 10, Adobe Acrobat XI Pro - works great now and has worked great for a few years.
Here are more complex details.
The Visual Studio code builds the app on an Adobe Acrobat XI Pro environment; thus the added reference for Acrobat.dll is from Acrobat XI Pro. That app is installed on the Acrobat DC system and , somewhat surprisingly, works great until a week ago. So, I installed Visual Studio on the Acrobat DC system and rebuilt the app which now references the Acrobat.dll from Acrobat DC. The rebuilt app fails the same way.
Two things broke a week or two ago (with no changes to my code):
1. if (clipboardData.GetDataPresent(DataFormats.Bitmap)) is always false
2. pdDocTarget.Save((short)PDSaveFlags.PDSaveFull, targetFilespec) <--- always returns false now!!!
Note that other function still work no matter which version of Acrobat is used for builds. For example,
int ctrPagesInSource = pdDocSource.GetNumPages(); ,<--- still works
Copy link to clipboard
Copied
I need to clarify my post.
pdDocTarget.Save((short)PDSaveFlags.PDSaveFull, targetFilespec) is successful EXCEPT in the following scenario.
pdDocTarget.Save((short)PDSaveFlags.PDSaveFull, targetFilespec) fails when the CAcroPDDOC is acquired via this code:
==============================
avDoc = acroApp.GetActiveDoc();
if ((avDoc != null) && (avDoc.IsValid()))
{
textBoxWindowTitleOfActivePDF.Text = avDoc.GetTitle();
pdDoc = avDoc.GetPDDoc();
if (pdDoc != null)
{
short saveFlag = (short)PDSaveFlags.PDSaveFull;
if (pdDoc.Save(saveFlag, pdfFilespec) == false)
{
Constants.displayErrorMessage("Failed to save: \n" + pdfFilespec);
}
==================================
The user has manually opened a PDF document from another application. Adobe Acrobat AIC (code shown above) is then used to get the CAcroAVDoc (avDoc = acroApp.GetActiveDoc();) and then get the CAcroPDDOC (pdDoc = avDoc.GetPDDoc();) That all seems to work. Trying to save the pdDoc fails every time (pdDoc.Save(saveFlag, pdfFilespec) ).
Copy link to clipboard
Copied
Hi,
When the user does this are they able to select "Save" or "Save a Copy" from the Acrobat User Interface?
Copy link to clipboard
Copied
When the user opens a PDF from the other application, they can save it with any filename.
After my app (which uses Interapplication Communication) successfully "gets" the active document, my app cannot save the document. This failure began around mid-November 2021; prior to that time the IAC could successfully save the document. The app ran successfully for as long as I remember bulding the app.
Copy link to clipboard
Copied
Hi, I know it's been a while but we are currently experiencing the same issue with our application and I was wondering if you found a solution over the past year.
Everything we automate via Acrobat works flawlessly (highlighting specific words in the document, creating comments, etc.) but the save function returns false.
Interesting is, that it works for our customers but not anymore on our development machines but we are worried that the issue will spread to our customers sooner than later. Also: in Windows file explorer there is a saved file showing in recent files which can't be opened (not found) and also can't be seen in file explorer when navigating to the folder with file explorer.
Thanks in advance for any information you can share on this issue and greetings from the black forest in Germany!
Raimo Geisel
Copy link to clipboard
Copied
Make sure that Protected Mode is off in Acrobat Preferences (Security - Enahanced). This option is DESIGNED TO make it impossible to save files automatically.
Copy link to clipboard
Copied
That was the issue! Thank's a lot!
Copy link to clipboard
Copied
I am glad you have the solution. I never found the solution so I had to redesign our processes a year ago.
I found my old code and tried it with the provided solution (Protected Mode: off) and it worked, but we are now using a totally different process. I wish someone could solve my other problem:
if (clipboardData.GetDataPresent(DataFormats.Bitmap)) is always false
Copy link to clipboard
Copied
The screenshot shows a empty file (0 bytes).
Copy link to clipboard
Copied
I know, that's the issue.