• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java printing html document

 
Ranch Hand
Posts: 42
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to move this to a more appropriate forum.
 
Ricardo Wagemaker
Ranch Hand
Posts: 42
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 42
1
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic