libreoffice 명령줄 도구로 변환된 PDF 문서의 인쇄, 편집 및 변환 제한

libreoffice 명령줄 도구로 변환된 PDF 문서의 인쇄, 편집 및 변환 제한

다음과 같은 libreoffice 명령줄 도구를 사용하여 파일을 PDF로 변환하려고 합니다.

libreoffice --headless --convert-to pdf filename

이제 변환된 파일의 인쇄, 편집 및 변환을 제한하고 싶습니다. 명령줄에서 이를 어떻게 달성합니까?

답변1

그냥 사용하세요pdftk 또는 PDFbox Java 라이브러리와 같은 명령줄 도구PDF를 후처리합니다.

다음은 파일을 암호화하는 예입니다 1.pdf.pdftk, 사용자가 파일을 인쇄할 수 있도록 허용합니다(pdftk 서버 예제):

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

그만큼아파치 PDFBox 라이브러리일부 명령줄 도구가 함께 제공됩니다. 다음은 방법의 예입니다.명령줄에서 PDFBox를 사용하여 파일 암호화:

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

여기서 OPTIONS는 다음과 같습니다.

-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.

주의: 40비트의 키 길이는 너무 짧습니다. 더 긴 키를 사용하는 것이 좋습니다.

관련 정보