Welcome Guest Search | Active Topics | Sign In | Register

Saving encrypted PDF leaves the file locked. Options
Chris Parker
Posted: Monday, June 17, 2013 12:41:35 PM
Rank: Newbie
Groups: Member

Joined: 12/9/2011
Posts: 1
Hi,

We've been using EO.PDF for a while (we're on version 3.0.94.2 - 2011.2) and have hit an issue today when trying to encrypt existing PDF files. Here's the code (VB.Net):

Private Function zEncrypt(PDFFileIn As String, PDFFileOut as String, Password as String) As String
'Encrypt the supplied PDF and save it to the supplied location
Dim PDFIn As EO.Pdf.PdfDocument
Const OwnerPW As String = "Password"

'Load the PDF file
PDFIn = New EO.Pdf.PdfDocument(PDFFileIn)

'Create a PDF file with user password and owner password set.
PDFIn.Security.UserPassword = Password
PDFIn.Security.OwnerPassword = OwnerPW
PDFIn.Save(PDFFileOut)

Return PDFFileOut

End Function

Shortly after the creation of the encrypted PDF the software attempts to rename the directory that it is in and we're getting the following exception:

System.IO.IOException: {"Access to the path '{PDFDirectory}' is denied."

If the PDF file is simply copied to the new location, it all works. There's only a problem if the PDF is encrypted en-route to the new directory.

It is not possible to rename the directory in Windows Explorer either. Explorer shows a dialogue stating that "The action can't be completed because the folder or a file in it is open in another program."

I can't see a method for closing the PDF after the save or disposing of the object...any ideas?

Thanks,

Chris.
eo_support
Posted: Tuesday, June 18, 2013 12:19:57 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

PdfDocument.Save does not lock the file. You may want to check your other code to see if you can find out where it locks the file.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.