package deprotect;

import com.google.common.io.Files;
import com.itextpdf.text.pdf.PdfEncryptor;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DeprotectMain {


	
	public static void main(final String[] args) {
		final File inputFile;
		try {
			inputFile = new File(args[0]).getCanonicalFile();
		} catch (IOException ex) {
			Logger.getLogger(DeprotectMain.class.getName()).log(
					Level.SEVERE,
					"The input file path could not be constructed",
					ex);
			throw new RuntimeException(ex);
		}
		final String filenameWithoutExtension = Files.getNameWithoutExtension(inputFile.getPath());
		final File outputFile = new File(filenameWithoutExtension);
		
		
	}
	
}

@@ -48,16 +48,60 @@
 .Files;%0A
+import com.itextpdf.text.DocumentException;%0A
 import c
@@ -135,16 +135,16 @@
 ryptor;%0A
-
 import c
@@ -236,16 +236,54 @@
 o.File;%0A
+import java.io.FileNotFoundException;%0A
 import j
@@ -932,18 +932,1075 @@
 on);%0A%09%09%0A
-
 %09%09%0A
+%09%09final PdfReader reader;%0A%09%09try %7B%0A%09%09%09reader = new PdfReader(inputFile.getPath());%0A%09%09%7D catch (final IOException ex) %7B%0A%09%09%09Logger.getLogger(DeprotectMain.class.getName()).log(%0A%09%09%09%09%09Level.SEVERE,%0A%09%09%09%09%09%22Unexpected IOException : iText failed to read the input file%22,%0A%09%09%09%09%09ex);%0A%09%09%09throw new RuntimeException(ex);%0A%09%09%7D%0A%09%09%0A%09%09try %7B%0A%09%09%09final FileOutputStream outputStream = new FileOutputStream(outputFile);%0A%09%09%0A%09%09%09PdfEncryptor.encrypt(reader, outputStream, null,%0A%09%09%09%09%09null, PdfWriter.AllowAssembly %7C PdfWriter.AllowCopy%0A%09%09%09%09%09%7C PdfWriter.AllowDegradedPrinting %7C PdfWriter.AllowFillIn%0A%09%09%09%09%09%7C PdfWriter.AllowModifyAnnotations %7C PdfWriter.AllowModifyContents%0A%09%09%09%09%09%7C PdfWriter.AllowPrinting %7C PdfWriter.AllowScreenReaders, false);%0A%09%09%7D catch (final IOException ex) %7B%0A%09%09%09Logger.getLogger(DeprotectMain.class.getName()).log(%0A%09%09%09%09%09Level.SEVERE,%0A%09%09%09%09%09%22Unexpected IOException : the ouput file could not be created%22,%0A%09%09%09%09%09ex);%0A%09%09%09throw new RuntimeException(ex);%0A%09%09%7D catch (DocumentException ex) %7B%0A%09%09%09Logger.getLogger(DeprotectMain.class.getName()).log(Level.SEVERE, null, ex);%0A%09%09%7D%0A
 %09%7D%0A%09%0A%7D%0A

Add code to call iText to read and write the PDF files