Skip to main content
Participant
September 4, 2022
Question

PDSaveFull Problem

  • September 4, 2022
  • 1 reply
  • 1796 views

Hi, Can someone help please?  I'm new to using the Acrobat SDK. I'm using Acrobat Pro DC.

I'm using VBA in a MS Access database and have the Adobe Acrobat 10.0 Type Library loaded.

The code I have pasted below runs and works as it should do: The pdf called Test02 is appended to Test01 and the modified Test01 is saved as WorksOK. 

The problem I have is that I would like to overwrtie the orignal Test01 file with the modified version.  I've tried changing the If statement near the bottom of my code to "If Doc01.Save(PDSaveFull, "C:\temp\Test01.pdf") = False Then" but the result is False and nothing is saved.

Thank you

 

Sub PDFtest()

Dim AcroApp As Acrobat.CAcroApp
Dim Doc01 As Acrobat.CAcroPDDoc
Dim Doc02 As Acrobat.CAcroPDDoc

Set AcroApp = CreateObject("AcroExch.App")
Set Doc01 = CreateObject("AcroExch.PDDoc")
Set Doc02 = CreateObject("AcroExch.PDDoc")

Doc01.Open ("C:\temp\Test01.pdf") 'Source file
Doc02.Open ("C:\temp\Test02.pdf") 'Destination file

If Doc01.InsertPages(0, Doc02, 0, 1, False) = False Then
MsgBox "Cannot insert page"
Exit Sub
End If

If Doc01.Save(PDSaveFull, "C:\temp\WorksOK.pdf") = False Then
MsgBox "Cannot save the modified document"
End If

Doc01.Close
Doc02.Close

AcroApp.Exit
Set AcroApp = Nothing
Set Doc01 = Nothing
Set Doc02 = Nothing

End Sub

This topic has been closed for replies.

1 reply

BarlaeDC
Community Expert
Community Expert
September 12, 2022

HI,

 

I would guess this is a permisions problem, ACrobat does not have the permission to delete Test01.pdf, it may be that it is Acrobat that is getting itself in a twist, or that the file was created by someone else with different permissions, there for Acrobat cannot delete it before saving the new document.

 

Are you able to check the permissions on the file and make sure the user that is running the VBA has permissions to delete the file?

darrelle78101386
Participant
September 19, 2022

Dave - Did this solution fix your issue?  I'm having the same issue.

JonBe
Inspiring
November 14, 2022

Hi all,

 

I have had a problem with AcroPDDoc.Save where false was returned and of course the PDF was not saved. This code had been working with previous versions of Acrobat!

 

I have implemented and tested the following work around for now:

The code below does not include pfdDoc.Close() after the Save. Without this the copy/delete would probably fail.

 

/*
 code that instantiates a AcroPDDoc, opens the PDF and renames the bookmarks
*/
inPDFFileNameCopy = 'make a copy of the PDF filename'
pdfDoc.Save((short)(PDSaveFlags.PDSaveFull | PDSaveFlags.PDSaveCopy), inPDFFileNameCopy)

// now copy the copy over the original and delete the copy
File.Copy(inPDFFileNameCopy, inPDFFileName, true);
File.Delete(inPDFFileNameCopy);

 

 

I have manually renamed a bookmark and saved it in Acrobat without any issues.

 

is there a way to find out why Save is returning false:

Is there something I am not doing?

 

TIA!

 

Jon