• 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

Printing A4 without margin

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I want to print a paper with Java without the margin.

But how can I do that?

This is my code now:

 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The defaultPage() PageFormat usually has a marging. You need to change it to remove that margin. I believe the following should work:
By default, Paper instance have a margin on each side that decreases the imageable area. By specifying that the imageable area should be as large as the entire Paper you will remove those margins. Don't forget to set the Paper at the end - getPaper() returns a clone of the PageFormat's Paper.
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Spoor wrote:The defaultPage() PageFormat usually has a marging. You need to change it to remove that margin. I believe the following should work:
By default, Paper instance have a margin on each side that decreases the imageable area. By specifying that the imageable area should be as large as the entire Paper you will remove those margins. Don't forget to set the Paper at the end - getPaper() returns a clone of the PageFormat's Paper.





Hmm.. tis is not working.. I print it and I still get the white margins..
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Printers usually can't put ink on the entire surface of the paper which passes through them. So you may already be using as much paper area as possible. Have you tried using other applications to see what happens with them when you say "Margins = 0 cm"?
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Printers usually can't put ink on the entire surface of the paper which passes through them. So you may already be using as much paper area as possible. Have you tried using other applications to see what happens with them when you say "Margins = 0 cm"?



Hmm.. I'm trying to print it to PDF now (so I don't wast any paper) with Bullzip PDF printer.

I will try it now with the real printer! :)
 
Gynnad Paullussen
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gynnad Paullussen wrote:

Paul Clapham wrote:Printers usually can't put ink on the entire surface of the paper which passes through them. So you may already be using as much paper area as possible. Have you tried using other applications to see what happens with them when you say "Margins = 0 cm"?



Hmm.. I'm trying to print it to PDF now (so I don't wast any paper) with Bullzip PDF printer.

I will try it now with the real printer! :)



Also that is not working.. I'm trying to print some text, but in the with he doesn't print everything.
Also both sides there is a margin. (normal margin of a A4)
 
They worship nothing. They say it's because nothing lasts forever. Like this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic