5 Replies Latest reply on Oct 1, 2016 8:32 PM by tony.bacon@sthw.co.nz

    PDSAVEFULL not working correctly?


      I have a MS Access application that takes a PDF "template" file, modifies it with data from the database and then saves then attaches it to an email. Each modified pdf overwrites the previous one, leaving the template untouched.


      This all works OK at home, but when I try it on the target computer I encounter problems. What appears to be happening is that the generated PDF is not being saved correctly as each email contains the same attachment - the very first one created. The syntax I am using for the save is:


          i = TheDoc.Save(PDSaveFull , pubPDFUpdatedLocation)


      The differences between the environments are









           Acrobat 7 (yes, I know, but it is what is available).


      Everything else in the application works OK in both environments. Also if I modify the app so that the generated PDFs are saved with unique names, it all works OK. So my questions are:


      Are there differences between Acrobat 7 and later versions in this area?

      Is what I am doing correct?

        • 1. Re: PDSAVEFULL not working correctly?
          George_Johnson MVP & Adobe Community Professional

          What I would do is process one file at a time without sending the email, and check to see if the file is being updated correctly each time. If so, it would seem to be a problem with sending the email with the attachment.

          • 2. Re: PDSAVEFULL not working correctly?
            tony.bacon@sthw.co.nz Level 1

            I have tried exactly that by inserting the addressee name into the file name and saving it. When I do that on the target machine each generated file has the correct info and is correctly attached to the email. I could do that always, but that would mean about 400 files being created that I would then have to remove when the process was completed. It was to avoid that extra step that I was giving each one the same file name and overwriting it for each for recipient, so I only had one output file that could just remain. However if I can't solve this then plan B would be individual files.

            • 3. Re: PDSAVEFULL not working correctly?
              George_Johnson MVP & Adobe Community Professional

              That's not really what I was suggesting. It sounds like the problem is not related to Acrobat and you should be able to tell if you overwrite the file each time and confirm that it's changed each time by opening it. If it is correctly overwritten each time when saved by Acrobat, it would seem to indicate that the problem is elsewhere.

              • 4. Re: PDSAVEFULL not working correctly?
                tony.bacon@sthw.co.nz Level 1

                OK I understand. I'll give that a go. Probably won't be till next week. Thanks for the advice. I'll report back.

                • 5. Re: PDSAVEFULL not working correctly?
                  tony.bacon@sthw.co.nz Level 1

                  This takes a bit of explaining, so bear with me…


                  On the target machine I set the emails to display rather than send, and selected a small subset of the database. When I ran the process without interruption, each email had the personalisation from the first record selected. However, if I put in break points to track what was happening, the process worked correctly, i.e. each email had a the correct individualised PDF, which makes it look like some sort of timing issue. I tried putting in DoEvents in the code at what seemed like appropriate places to let things “catch up”, but that had no effect. I also tried a 5 second delay loop between records – still no good.


                  Then I tried to delete the updated PDF after each record was processed, but that gave me a “permission denied” error with a code of 70, which can mean trying to access a read-only or locked file. I set the file attributes to normal, and still got the error, so I assume the file is locked and hasn’t been released by the time the next record is to be processed. Still looks like a timing issue.


                  The principal differences between the environments are Win10 vs Win7, fast machine vs slow(ish) machine and Acrobat 9 vs Acrobat 7.

                  Back home I tried running the app on Win7 on a fast machine and on Win 10 on a slow machine, all with Acrobat 9. Everything worked OK. I don’t have access to Acrobat 7 or to Win7 on a slow machine.


                  So it is still looking to me like an Acrobat 9 vs Acrobat 7 issue.


                  Is there a programmatic way I can force a lock to be released?


                  Do you have any other ideas?