• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java printing html document  RSS feed

 
Ricardo Wagemaker
Ranch Hand
Posts: 34
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ladies & Gentleman,

My current calculator (currently available on my site) launches your default webbrowser with the CalculatorHistory file allowing you to print through your browser, but I been working on self contain the html page in a the JEditorPane which is great it does what i want, so I started working on the printing side and I am stuck...

The code I have was from a example (modified) but when I run the code I get the following error



Exception in thread "main" java.lang.IllegalArgumentException: services must be non-null and non-empty
at javax.print.ServiceUI.printDialog(Unknown Source)
at gcclinux.co.uk.PrintReport.main(PrintReport.java:28)


The Line 28 equals to

If anytone can help me that would be greatly appreciated I will continue to try to identify the issue and fix it, I will post the answer once I have it.



many Thanks in advance.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this to a more appropriate forum.
 
Ricardo Wagemaker
Ranch Hand
Posts: 34
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well i found a solution and seem to work, the only issue is that this solution also prints (TOP RIGH) Page number and botton of the page the URL/File PATH so if I could remove that it would be perfect.

current code...



So if I could have either one of the solutions would be great, 1 a fix for the initial error or a way to remove the PAGE number & File PATH printed by this second class.

Many Thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What goes onto the header and footer is most likely put there by whatever browser is used for printing. See if you can configure your standard browser not to print them.
 
Ricardo Wagemaker
Ranch Hand
Posts: 34
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What goes onto the header and footer is most likely put there by whatever browser is used for printing. See if you can configure your standard browser not to print them.


Hello,

If you take a look at the code there is no browser I open the file and print it, now saying that I think it is the java.Desktop that is doing it and I was wondering if i can swicth it off.

Many Thanks
 
Dave Tolls
Ranch Foreman
Posts: 3056
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the JavaDoc of Desktop.print():

"
Prints a file with the native desktop printing facility, using the associated application's print command.
"

So it will be using the default browsers set up.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!