Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Java Printing

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Printing

    I am looking for a good tutorial with examples for printing using Java. The best article I have found on Line is "Printing in Java" by JavaWorld. However, the links to download the example programs seem to be long defunct. Any suggestions?


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java Printing

    Have you read the tutorials from the 'source' (aka Oracle)?
    Lesson: Printing (The Java™ Tutorials > 2D Graphics)

  3. #3
    Junior Member
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Printing

    Yes, I have read the tutorials - but they are very shy on examples. They also tend to brush over details like setting the page orientation and changing fonts. Also page headers and footers seem to be minimally covered.

  4. #4
    Member Ada Lovelace's Avatar
    Join Date
    May 2014
    Location
    South England UK
    Posts
    414
    My Mood
    Angelic
    Thanks
    27
    Thanked 61 Times in 55 Posts

    Default Re: Java Printing

    It might be feasible to get a good Java Book - there are lots available though, so
    finding the exact one for the problem could be an uphill task. Check out "effective Java"
    or "Java How to Program" - those are well known books - also, Bruce Eckel has released
    his third Java electronic booklet for free usage. He is quite renowned for producing
    excellent text for subjects of C, C++ and Java - probably one of the best sources.

    Wishes Ada xx
    If to Err is human - then programmers are most human of us all.
    "The Analytical Engine offers a new, a vast, and a powerful language . . .
    for the purposes of mankind
    ."
    Augusta Ada Byron, Lady Lovelace (1851)

  5. #5
    Junior Member
    Join Date
    Jul 2014
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink Re: Java Printing

    I just had this issue also, make a PrinterJob object and call the print() method. You then have to have your own print method, public int print(Graphics g, PageFormat pf, int page).
    The page variable is misleading because this method is called with the same page number multiple times.

    As far as fonts, look up the Graphics class and the Graphics2D class,

Similar Threads

  1. Need help with Java Printing
    By lsorsby in forum What's Wrong With My Code?
    Replies: 0
    Last Post: July 18th, 2013, 08:00 AM
  2. Java Printing
    By lsorsby in forum What's Wrong With My Code?
    Replies: 0
    Last Post: July 16th, 2013, 10:37 AM
  3. Replies: 1
    Last Post: September 28th, 2011, 07:29 AM
  4. [SOLVED] Printing Data in JAVA
    By aussiemcgr in forum Java Theory & Questions
    Replies: 1
    Last Post: October 15th, 2010, 01:22 PM
  5. [SOLVED] Printing Array without printing empty elements
    By CarlMartin10 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 12th, 2010, 02:41 AM

Tags for this Thread