Results 1 to 9 of 9
  1. #1
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default How to take condensed print chr(15) from java application?

    Hello All,

    How to take condensed print chr(15) from java application?

    please help

    thanks & regards

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by newbiejava View Post
    Hello All,

    How to take condensed print chr(15) from java application?

    please help

    thanks & regards
    In Java a char with (decimal) value 15 is represented as '\u000f' but you shouldn't deal with printers on such a low level.

    kind regards,

    Jos

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,331
    Rep Power
    25

    Default

    What is a "condensed print" chr(15)?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Norm View Post
    What is a "condensed print" chr(15)?
    15 is the ASCII code SI (Shift In) and 14 is the ASCII code SO (Shift Out); a lot of (old) printers use that code for condensed or enlarged font printing; the OP shouldn't rely on it.

    kind regards,

    Jos

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    Try using a condensed font. Something like
    Java Code:
    Font font = whatever.getFont();
    Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>();
    attributes.put(TextAttribute.WIDTH, TextAttribute.WIDTH_CONDENSED);
    font = font.deriveFont(attributes);
    whatever.setFont(font);
    db

  6. #6
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    758
    Rep Power
    8

    Default

    Hi,

    I think you can simply write something like:

    Java Code:
    String condensed = Character.toString((char) 15);
    And send this to the printer.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default

    In any case, passing a "condensed font" flag aka CHR(15) to a printer (assuming the printer's about as old as a newbie Java programmer) will only affect character based printing. The Java print API uses raster based printing which couldn't care less about a condensed font being set to the *printer*.

    db

  8. #8
    newbiejava is offline Senior Member
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    0

    Default

    so, any idea for this? ..
    I need to print in condense mode (chr(15)) to Epson LX300

  9. #9
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,453
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by newbiejava View Post
    so, any idea for this? ..
    I need to print in condense mode (chr(15)) to Epson LX300
    Have you actually read this thread?

    kind regards,

    Jos

Similar Threads

  1. How to print this in java?
    By yaseen in forum New To Java
    Replies: 20
    Last Post: 05-28-2010, 02:24 PM
  2. How to use and print the JAVA code from a JSP
    By Ginkan in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-23-2010, 02:05 PM
  3. Replies: 3
    Last Post: 12-04-2009, 12:10 PM
  4. Print the text file and print preview them
    By Java Tip in forum java.awt
    Replies: 0
    Last Post: 06-22-2008, 11:04 PM
  5. print .doc in java
    By Alan in forum Advanced Java
    Replies: 1
    Last Post: 05-17-2007, 04:05 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •