Frequently Asked Question:
Signing and encrypting issue
Question
As suggested previously to secure / encrypt document first and then sign does give the desire output, the final output file still have unvalidated signature.
Dim sfile = "C:\QuickPDF\Input.pdf"
Dim dfile = "C:\QuickPDF\Output.pdf"
Dim efile = "C:\QuickPDF\Output1.pdf"
Dim ffile = "C:\QuickPDF\Output2.pdf"
Dim cert = "C:\QuickPDF\cert.pfx"
If QPDF.UnlockKey(LicenseKey) = 1 Then
With QPDF
If .LoadFromFile(sfile) = 1 Then
.SetInformation(1, "Author")
.SetInformation(2, "Title")
.SetInformation(3, "Subject")
.SetInformation(4, "Keyword")
.SetInformation(5, "Creator")
.SetInformation(6, "Producer")
.SaveToFile(dfile)
End If
If .LoadFromFile(dfile) = 1 Then
Dim Per As Integer = .EncodePermissions(1, 0, 0, 0, 0, 0, 0, 0)
.Encrypt("test", "", 2, Per)
.SaveToFile(efile)
End If
.SignFile(efile, "", "Signature", ffile, cert, "123456", "Test Reason", "Test Location",
"Test Contact Info")
End With
End If
Answer
The signature still needs to be validated by your PDF Reader program. Open the PDF in your viewer program, go to the Signatures sections showing the added signature and right click on it and choose something like Validate Signature.