Posted by a ceTe Software moderator
Hello,
Sorry for the confusion. The solution we provided earlier to check for security is for protected/encrypted PDFs that do not require an owner password (there are PDFs out there that are encrypted without an owner password).
In your case the protected PDFs have an actual password, and you are right in that without the password you won’t be able to call the LoadPdf without getting an exception. The only solution for this case is to use the On Error Resume Next statement in ASP to catch and handle the error appropriately.
Dim MyDocument
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
On Error Resume Next
Dim MyPdfDocument
Set MyPdfDocument = Server.CreateObject( "DynamicPDF.PdfDocument" )
MyPdfDocument.LoadPdf Server.MapPath( "./Encrypt.pdf")
If Err.Number <> 0 Then
'catch and handle the error appropriately
Response.Write "Error occurred loading pdf: " & Err.Description
Response.End
End If
MyDocument.AppendPdf MyPdfDocument
MyDocument.DrawToWeb
Set MyDocument = Nothing
Thanks,
ceTe Software Support Team.