Skip to Content
Menú
This question has been flagged
4 Respostes
8664 Vistes

I was trying to generate a pdf using  rml report. I want to secure it using a password. How can I do that in Odoo 8.0 ?

Avatar
Descartar
Best Answer

you have to encrypt the pdf file using code
i hope this code will help you .


import sys

from pyPdf import PdfFileWriter, PdfFileReader

 

 def secure_pdf(InPdf, OutPassPdf, Passwd):

     output = PdfFileWriter()

     input1 = PdfFileReader(file(InPdf, "rb"))

     for i in range(0, input1.getNumPages()):

         output.addPage(input1.getPage(i))

     outputStream = file(OutPassPdf, "wb")

     output.encrypt(Passwd, use_128bit=True)

     output._header

     output.write(outputStream)

     outputStream.close()

     return True

     

secure_pdf("/Input.pdf",

           "/OutPut.pdf",

           str(email_id))


Avatar
Descartar
Best Answer

There are various solutions available to apply the password to your PDF file. I checked many solutions and come with an amazing tool named Softaken PDF Protector Tool which simply lock your PDF file and restrict others to open it without knowing the password. 

Avatar
Descartar
Related Posts Respostes Vistes Activitat
0
d’abr. 18
3833
2
de març 15
8843
5
de juny 18
16697
0
de set. 15
3964
3
de jul. 24
8339