xpdfSpliceSetEncryption

Enable encryption on an output PDF file.
void xpdfSpliceSetEncryption(XpdfSpliceOutputHandle out, int mode, const char *ownerPassword, const char *userPassword, int permissions)
This function enables encryption on the output PDF file

This function must be called immediately after xpdfSpliceOpenOutput, before calling any other functions on this output handle. Encryption is performed on the fly, i.e., objects are encrypted as they are written to the output file.

The arguments are:

The permission bits should start with xpdfSplicePermBase (which sets reserved bits according to the PDF spec). By itself, xpdfSplicePermBase disables all permissions. You can then add bits from the following list: For more information, see Table 3.20 in the PDF 1.7 spec.
C:
XpdfSpliceInputHandle out; out = xpdfSpliceOpenOutput("c:/test/newfile.pdf", 1.4); /* set user password to an empty string, so anyone can open the file */ /* set permissions to allow printing and nothing else */ xpdfSpliceSetEncryption(out, xpdfSpliceEncrypt128BitRC4, "Secret", "", xpdfSplicePermBase | xpdfSplicePermPrint);