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 3 of 3

Thread: The positioning and alignment of the text on the paper to be printed

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default The positioning and alignment of the text on the paper to be printed

    Hii,
    I'm developing an application for a hospital. The hospital demands that whenever a new patient is registered, the printer should print out a sticker of 3 inch by 1 inch.

    Also, the application should print out a receipt for the payment the patient has made. The receipt page is 5 inch by 7 inch. I really don't know how to format the text content according to the page which is to be printed.
    How do I provide the spacing and positioning of the text in the java code according to the printer page?
    please help me with the packages to use or interfaces to implement.
    any help would be appreciated.


  2. #2
    Member
    Join Date
    Apr 2010
    Location
    The Hague, Netherlands
    Posts
    91
    Thanks
    3
    Thanked 10 Times in 10 Posts

    Default Re: The positioning and alignment of the text on the paper to be printed

    Well, i'm a newbie too, and I don't know if there is a better way to solve your problem but this is what I first thought of:

    Make 2 "panels/frames/windows" that has the same sizes as the receipt and the sticker. Then you can align the text in those frames or whatever is used(i'm unfamiliar with the Java GUI packages). Then make a print option for the windows and make it print it like its positioned. I hope this give you some clues how to do it.

    -Bryan

  3. #3
    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: The positioning and alignment of the text on the paper to be printed

    Because its hard to gather from your post what stage you really are at, I'll point you in the direction of the java tutorials which may answer your question and then some.
    Lesson: Printing (The Java™ Tutorials > 2D Graphics)
    When you get a bit more together, I'd recommend posting some code which provides a lot more context and makes it easier for others who wish to help

Similar Threads

  1. Alignment
    By angelaffxmaniac in forum Java Theory & Questions
    Replies: 1
    Last Post: May 13th, 2010, 08:55 AM
  2. Print Content on Pre Printed Sheet
    By kalees in forum Java Theory & Questions
    Replies: 0
    Last Post: February 24th, 2010, 03:26 AM
  3. Paper on a Java Program
    By dude in forum Java Theory & Questions
    Replies: 1
    Last Post: December 4th, 2009, 05:40 PM
  4. Content positioning on the screen
    By Drakenmul in forum AWT / Java Swing
    Replies: 1
    Last Post: July 27th, 2009, 09:02 AM
  5. Replies: 1
    Last Post: March 31st, 2009, 02:49 PM