Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Disable save option in PDF

807588Mar 18 2009 — edited Mar 18 2009
I am able to create a PDF file using com.lowagie.text API. But I want to disable the save option at download of PDF. i just want to give the facility of opening the PDF. User should not be able to save the PDf even after opening it.

//Create PDF Document
OutputStream os
docWriter = PdfWriter.getInstance(document, os);
document.open();
document.add(table); // table contains all the data which needs to be displayed on PDF

After creating the PDf , I am writing PDF to Servlet Output Stream

I also found somewhere this code to disable the save button

PdfReader reader = new PdfReader(fileName);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(fileName));
stamper.setEncryption("my-owner-password".getBytes(), "my-user-password".getBytes(),
PdfWriter.AllowPrinting | PdfWriter.AllowCopy, PdfWriter.STRENGTH40BITS);
stamper.close();

But I am not able to solve my problem with this code
Please help!!! thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 15 2009
Added on Mar 18 2009
4 comments
453 views