• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Printing A4 without margin

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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: 21866
105
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • 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
  • 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: 25207
64
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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)
 
I'm full of tinier men! And a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!