I have a URL:
http://www.irs.gov/pub/irs-pdf/fw4.pdf
It contains an editable PDF. I have make it non-editable. I did so and kept it in the temp directory of a folder. Now i want to send the non-editable PDF as a response, when the user clicks this url, he must get the non-editable pdf. This is what I have done till now:
String strDirectoy ="C:\\Temp";
boolean success = (
new File(strDirectoy)).mkdir();
if (success) {
System.out.println("Directory: "
+ strDirectoy + " created");
}
PdfReader reader = new PdfReader("http://www.irs.gov/pub/irs-pdf/fw4.pdf");//C:\\fw4.pdf
PdfStamper stamp2 = new PdfStamper(reader, new FileOutputStream("C:\\Temp\\Flattened.pdf"));
AcroFields form2 = stamp2.getAcroFields();
stamp2.setFormFlattening(true);
stamp2.close();
Now i need to delete the temp
folder as if it never existed and return the non-editable PDF as the response for the above specified URL.
How can i do this?