3

Is it possible that a Visualforce page rendered as pdf can be password protected?

I am using Messaging.SingleEmailMessage to send mail with attachment, but I need the attachment password protected.

2

I'm not aware of any flags that can be set on the render engine to establish any PDF native security settings to password protect it at the time it's rendered. You might want to check the Flying Saucer site, the render engine used by Salesforce, to see if there are any solutions or options for it that are documented there.

Edit 7-25-16:

When PDFs are rendered by most any engine, they're rendered without any security. That includes Adobe Acrobat, Adobe Distiller, Google Chrome's "Save As PDF" plug-in and various Windows PDF print drivers that I'm familiar with like CleverPrint. In all cases, one sets the security settings AFTER the document is printed. The only exceptions to this that I'm aware of are a couple of plug-ins such as the one for LibreOffice Writer and perhaps MS Office Word where one can set the security before saving the PDF to file. In both of those cases, one isn't converting an html document to a print document.

I think your best solution for an email attachment would be to put it in a wrapper that's encrypted whether that be a binary zip file format or something similar, that is, unless you're familiar with the internal workings of a PDF document which is something I wouldn't want to try to manipulate with Apex.

  • Thanks for the reply. I will look into the link you provided and get back to you – NullReferenceException Jul 9 '15 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.