2004 IR Help Posted August 22, 2006 Share Posted August 22, 2006 By: anand1st - anand1st View Report but not print or save. 2005-06-16 02:05 Hi. I'm a newbie to JasperReports. I would like to view a report (say, using JasperViewer) but the print and save button should be disabled coz the report contains sensitive information which is for the eyes only. Anyone who have any idea how to do this? By: C-Box - c-box RE: View Report but not print or save. 2005-06-16 02:18 Well simply make your own JasperViewer where you disable/remove the buttons from the Toolbar... but actually that doesn't help much... every user can easily create a screenshot from the preview and send this via email or print from paint or any other program... and even if you disable eMail sending or printing at all... the possibility to write down the "secret/sensitive" information on a normal sheet of paper manually still exists.... everything a question of definition.... hth C-Box By: anand1st - anand1st RE: View Report but not print or save. 2005-06-16 02:24 Yeah, that's true...didn't think of that. Guess if my boss asks me why I didn't do it that way, I could just send him this screenshot of your message :) Link to comment Share on other sites More sharing options...
DMA02 Posted December 8, 2006 Share Posted December 8, 2006 I wanted to do the same thing. Let the view the report, let them print it, but not let them save it. This is a problem because we store data on a database. If a bad user wants he can issue a print preview, save the report as RTF or Excel ..etc, edit the report, and then print it out. This would be, in other words, forgery. Simple fix is to not let the potential bad user to save the report. Thus removing the save button. There is a very simple and easy way to do this. Remove the JButton from the JRViewer :whistle: Code below. JRViewer jRViewer = new JRViewer(jasperPrint);((JPanel)jRViewer.getComponent(0)).remove(0); This will always remove the save button because it is in the first JPanel and in the first position of the layout. You can even do more tests with the .getComponents method and iterate through the array of JComponents and find out what Java class they are, cast them appropriately and go crazy with .getComponent(int).remove(int) or .add(JComponent) Link to comment Share on other sites More sharing options...
alimahran666 Posted November 5, 2018 Share Posted November 5, 2018 code to remove save buttonJRViewer jRViewer = new JRViewer(jasperPrint);((JPanel)jRViewer.getComponent(0)).remove(0); so what code to remove print button Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now