아래 코드는 제 코드입니다. 내 목표는 최종 사용자가 텍스트 복사 (텍스트 선택 및 메모장에 복사 제외)를 원하는 모든 작업을 수행 할 수있는 PDF를 작성하는 것입니다. 18 번째 줄에 어떤 코드가 올지 설명 할 수 있습니까? 나는 인쇄를 허용하지만 ALLOW_COPY는 허용하지 않음)PDF (iText)를 보호하려고 시도하고 사용자가 PDF의 내용을 복사하지 못하게하려고합니다.
나는 아래의 코드가 사용자를 제한하기에 충분하지만 '사실상'선택된 텍스트를 복사하여 메모장에 붙여 넣을 수 있다는 인상을 받았다.
감사합니다.
package com.itext;
import java.io.FileOutputStream;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.IOException;
import com.itextpdf.text.DocumentException;
public class ProtectMePdf
{
public static void main(String[] args) throws IOException, DocumentException
{
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("/Users/adhg/protectMe.pdf"));
//LINE 18: what's wrong with this line? - if you run the code you will be able to copy the selected text.
writer.setEncryption(null, null, PdfWriter.ALLOW_PRINTING, PdfWriter.STANDARD_ENCRYPTION_128);
writer.createXmpMetadata();
document.open();
document.add(new Paragraph("Protect me! if you can do copy-paste of this message to a notepad = NO GOOD :-("));
document.close();
}
}
확인, 난 그냥 (ALLOW_DEGRADED_PRINTING로 대체) 인쇄를 제거하고 그것을 듣고 다행 트릭 – adhg
, GL의 HF를 수행합니다 : 그것은 매우 간단합니다, 당신은 권한을 부정해야한다. – rlegendi
감사합니다. 당신은 당신의 대답을 게시 할 수 있고 당신에게 신용을 줄 것입니다! 다시 감사드립니다! – adhg