restringir la impresión, edición y conversión de documentos pdf convertidos mediante la herramienta de línea de comandos de LibreOffice

restringir la impresión, edición y conversión de documentos pdf convertidos mediante la herramienta de línea de comandos de LibreOffice

Estoy intentando convertir archivos a PDF usando la herramienta de línea de comandos de LibreOffice como esta:

libreoffice --headless --convert-to pdf filename

Ahora quiero restringir la impresión, edición y conversión del archivo convertido, ¿cómo lo logro en la línea de comando?

Respuesta1

Sólo usa unherramienta de línea de comandos como pdftk o la biblioteca java PDFboxpara posprocesar el pdf.

Aquí hay un ejemplo para cifrar el archivo 1.pdfusandopdftk, permitiendo al usuario imprimir el archivo (desde elEjemplos de servidor pdftk):

pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

ElBiblioteca Apache PDFBoxViene con algunas herramientas de línea de comando. He aquí un ejemplo de cómocifrar un archivo usando PDFBox en la línea de comando:

java -jar pdfbox-app-x.y.z.jar Encrypt [OPTIONS] <password> <inputfile>

donde OPCIONES pueden ser:

-O                           The owner password to the PDF, ignored if -certFile is specified.
-U                           The user password to the PDF, ignored if -certFile is specified.
-certFile                    Path to X.509 cert file.
-canAssemble                 true   Set the assemble permission.
-canExtractContent           true   Set the extraction permission.
-canExtractForAccessibility  true   Set the extraction permission.
-canFillInForm               true   Set the fill in form permission.
-canModify                   true   Set the modify permission.
-canModifyAnnotations        true   Set the modify annots permission.
-canPrint                    true   Set the print permission.
-canPrintDegraded            true   Set the print degraded permission.
-keyLength                   40     The number of bits for the encryption key.
inputfile                    The PDF file to encrypt.   
outputfile                   The file to save the encrypted document to. If left blank then it will be the same as the input file.

Nota: una longitud de clave de 40 bits sería, en mi humilde opinión, demasiado corta; se recomienda utilizar una clave más larga.

información relacionada