title: trying to protect PDF (iText) trying to disable users to do copy on pdf's content
body: <p>Below is my code. My objective is to create a PDFs where endusers can do whatever they want EXCEPT copying the text (select the text and COPY to a notepad). Can anyone explain what code should come in line 18? I allow printing but not ALLOW_COPY)</p>
  
  <p>I was under the impression that the code below is sufficient to restrict users to do so but 'de facto' they are able to copy the selected text and paste the content to a notepad. </p>
  
  <p>Many thanks!</p>
  
  <pre><code>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();
  }
  }
  </code></pre>