How to disable/restrict pdf printing??

In my UI i want to restrict some users to print PDF… How can i do that programmatically?? My code is like that…

            String pdfPath = "C:/handbook.pdf";
            final String CAPTION = "PDF Search";
            final String TOOLTIP = "Open your searched PDF";
            FileResource ICON = new FileResource(new"C:/Workspace/rasp/images/pdf.png"), RaspberryApplication.getCurrentApplication());
            final Resource TARGET = new FileResource(new, RaspberryApplication.getCurrentApplication());

            Link l = new Link(CAPTION, TARGET);

Can someone help me out plzzz its urgent…


With this approach (embedding PDF in browser), the simple answer is You Can’t - it’s not possible.

If you are in charge of the content of the PDF, it might be possible to restrict permission on the PDF file itself, but you can’t dynamically remove menu items/functionality when embedding another application inside a browser.



thanks for your reply… Is this possible anyway??

You can modify the PDF file that is embeded to only allow printing if a password is entered.

Here’s a java application/library that alloys you to do this.

I would point out that there are free-to-use services online that allow you to remove security from a PDF file, so it’s not foolproof.

Ultimately, if you’re deploying a PDF file to the browser, it’s going to be relatively easy to print that document.

The only other approach I can think of is not to deploy the PDF to the browser, but to create your own PDF viewer in Vaadin (using PDFBox to render each PDF page as images).

None of these are things are trivial and frankly, I suspect they are more trouble than it’s worth.