[DVIPDFMx] Encrypting PDFs without user input.

Jin-Hwan Cho jinhwan.cho at gmail.com
Sun Feb 20 07:48:58 KST 2011


Hi, Joyner.

On Feb 17, 2011, at 12:53 PM, Michael Joyner wrote:

> I was trying to encrypt some PDF's with xdvipdfmx via xetex, but discovered that it it hangs waiting for user input for the passwords via:
> 
> xelatex -output-drive="xdvipdfmx -S -E -K 128" 000000001.utex 
> 
> and then via:
> 
> xelatex -output-drive="printf 'p1\np1\n\n\n' | xdvipdfmx -S -E -K 128" 000000001.utex 
> 
> Is there a way to specify the passwords either by a file or on the command line?

No way as I remember.

> I think it should be considered a deficiency if one can tell it by use of -S that you want password encryption enabled for a PDF, but can't programamtically, either by a \special or other automatic mechanism to actually provide the needed values.
> 
> I am trying to do this in a batch process without user interaction required.
> 
> I originally tried using pdftk, but it eats the pdf bookmarks. :(

It's quite easy to add the feature you want, but I wonder if the author of xetex agrees or not.
If you are able to write a small piece of C code and to compile it by yourself, then try to modify
the function pdf_enc_set_passwd() in pdfencrypt.c. Here, I used the getpass() function in
the standard C library which avoids the way using standard input (as you did).

I will try to discuss this topic with the author of xetex.
Which way is your favorite? New command line option, external file, or \special?

Best regards, ChoF.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://project.ktug.or.kr/pipermail/dvipdfmx/attachments/20110220/8d54ad6a/attachment.html>


More information about the dvipdfmx mailing list