1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Option Explicit
Private Sub EncryptPDF(sNomFichier As String, sOutputCrypt As String)
Dim Pdf As Object, Crypt As Object
Set Crypt = CreateObject("pdfforge.pdf.PDFEncryptor")
With Crypt
.AllowAssembly = False
.AllowCopy = False
.AllowFillIn = False
.AllowModifyAnnotations = False
.AllowModifyContents = False
.AllowPrinting = True
.AllowPrintingHighResolution = True
.AllowScreenReaders = False
.EncryptionMethod = 2
.OwnerPassword = "master"
.UserPassword = ""
End With
Set Pdf = CreateObject("pdfforge.pdf.pdf")
Pdf.EncryptPDFFile sNomFichier, sOutputCrypt, Crypt
Set Pdf = Nothing
Set Crypt = Nothing
End Sub
Sub GénérerPDF()
Dim sNomPdf As String, sPdf As String
Dim sDossier As String
Dim sNomCrypt As String
Dim FSO As Object
sDossier = ActivePresentation.Path
sNomPdf = Left$(ActivePresentation.Name, InStr(ActivePresentation.Name, ".") - 1) & ".pdf"
sPdf = sDossier & "\" & sNomPdf
ActivePresentation.ExportAsFixedFormat sPdf, ppFixedFormatTypePDF, ppFixedFormatIntentPrint
sNomCrypt = sDossier & "\" & "Tempo.pdf"
EncryptPDFsPdf, sNomCrypt
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(sPdf) Then Kill sPdf
If FSO.FileExists(sNomPdf) Then Kill sNomPdf
Name sNomCrypt As sNomPdf
Set FSO = Nothing
End Sub |