Posts

Showing posts with the label Encrypt

Create a pdf file using java and encrypt / decrypt it.

For this example to work you will need following jar files. 1.  bcpkix-jdk15on-1.47.jar 2.   itextpdf-5.1.0.jar 3.   bcprov-jdk14-146.jar Download them and include them in your project classpath . /* * This class is part of the book "iText in Action - 2nd Edition" * written by Bruno Lowagie (ISBN: 9781935182610) * For more info, go to: http://itextpdf.com/examples/ * This example only works with the AGPL version of iText. */ import java.io.FileOutputStream; import java.io.IOException; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.Paragraph; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; public class EncryptionPdf { /** User password. */ public static byte[] USER = "Hello".getBytes(); /** Owner password. */ public static byte[] OWNER = "World".getBytes...