NetTalk Central

Author Topic: Encrypt PDF Report  (Read 2926 times)

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Encrypt PDF Report
« on: April 18, 2013, 10:42:01 AM »
Trying to password protect PDF report.  Assigning a password on the Report to PDF extension template works.  But I would like to put a variable by putting an exclamation (!) sign before the variable name.  The program compiles fine.  However the password value assigned on the embed point before the Self.Encryption does not work.

Any help here is appreciated.
Thanks  Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Encrypt PDF Report
« Reply #1 on: April 18, 2013, 09:47:59 PM »
I've not done this myself, but what code are you using to set the password variable?
Is the password variable used at any point in the procedure before that?

Cheers
Bruce

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Encrypt PDF Report
« Reply #2 on: April 19, 2013, 07:57:10 AM »
Bruce,

I define a local variable lcl:password (string(100)). Enter !lcl:password on the Report to PDF extension template.  And then assign lcl:password =  'blabla123' on embed point as follow:

  lcl:password = 'blabla123'       !assign password here for testing the embed point

  SELF.SetFileName(loc:PDFName)
  SELF.SetDocumentInfo('CW Report','PDFCPCS','Rpt_DailySummary','Rpt_DailySummary','','')
  SELF.SetPagesAsParentBookmark(False)
  SELF.CompressText   = True
  SELF.CompressImages = True
  SELF.SetEncryption(lcl:password,PDFAccess:Print+PDFAccess:Copy+PDFAccess:ModifyContent+PDFAccess:ModifyAnnotations)

However, this works.
  SELF.SetEncryption('blabla123',PDFAccess:Print+PDFAccess:Copy+PDFAccess:ModifyContent+PDFAccess:ModifyAnnotations)

I'm using c8.9304 NTalk 6.40
Thanks - Sukhendu

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Encrypt PDF Report
« Reply #3 on: April 19, 2013, 10:31:24 PM »
Hi Sukhendu,

maybe it needs to be of the form

! clip(lcl:password)
so it generates

 SELF.SetEncryption(clip(lcl:password),PDFAccess:Print+PDFAccess:Copy+PDFAccess:ModifyContent+PDFAccess:ModifyAnnotations)

I don't know though if their template will allow that? But it's the only difference I can see.

cheers
Bruce



sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: Encrypt PDF Report
« Reply #4 on: April 22, 2013, 08:11:34 AM »
Hi Bruce,

!clip(loc:password) worked.  Very insightful solution!  Thank you.

Can the password on the PDF file be made non readable while typing?  I did not see any option for this on the "Report to PDF" extension template.

Cheers,
Sukhendu
« Last Edit: April 22, 2013, 09:05:30 AM by sukhendu »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Encrypt PDF Report
« Reply #5 on: April 23, 2013, 05:43:16 AM »
no idea - sorry. I guess ask the PDF people....