How does one print a string on paper as text rather than an image?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: How does one print a string on paper as text rather than an image?

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    7

    How does one print a string on paper as text rather than an image?

    Well, I know how to print strings on paper, but only using Java 2D methods. I want to know how to make it so that the text is written as text, not an image. When printed as an image, text does not wrap to the page and newline characters are ignored.

    Gee, you’d think the phone-book sized java book I have would cover this, but it doesn’t. Figures.

  2. #2
    Join Date
    Oct 2004
    Posts
    311
    The way I usually print is by having a JPanel with the same size os the paper, and then paint that using the Graphics object belong to the Image. This way, you can have linewrap no proble, because on your JPanel, you could just draw one big JTextArea. The only thing you need to find a solution for is page flipping. You need to handle the multiple pages yourself, but that shouldn't be too difficult, since you know the height of the page and the height of your font.

    Mark

Similar Threads

  1. verify local admin
    By Patrick Comeau in forum VB Classic
    Replies: 6
    Last Post: 03-22-2001, 11:50 PM
  2. How do I detect an FTP timeout?
    By Julian Milano in forum VB Classic
    Replies: 2
    Last Post: 08-11-2000, 01:11 PM
  3. Please help me -- urgent -- deadlock error
    By chandra in forum VB Classic
    Replies: 0
    Last Post: 06-22-2000, 08:36 AM
  4. Database problems
    By Robert Rieth in forum VB Classic
    Replies: 1
    Last Post: 04-11-2000, 04:21 AM
  5. Replies: 2
    Last Post: 03-24-2000, 02:05 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center