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.
|
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!
|