Format string for printing

When I write a string to a file the carriage returns are recognized, but when I print the string it prints as much of the string as it can on the first line and then quits printing.
Why is this?
How can I get around this?

The string has "\r\n" at the end of the lines that I want to print embedded in it. Here is the code that I have for the printing.
try {
                              PrintWriter pw = new PrintWriter(new FileOutputStream(new File("output.txt")));
                              pw.println(servResponse);
                              pw.close();
PrintJob job = Toolkit.getDefaultToolkit().getPrintJob((Frame)this.getParent(),"Print Local", null);
                              if(job != null) {
                                   Graphics g = job.getGraphics();
                                   if (g != null) {
                              g.drawString(servResponse, 50,100);
                                   g.dispose();
                                   job.end();
                         } catch (IOException ex) {}
servResponse is the String that I want to print.
It looks works when going to the file, but I only get one line of the string when printed to the local deskjet.
Thanks in advance.

Similar Messages

  • Creating Format type for printing ALV output.

    Dear Friends,
        I am using a format type for printing ALV output print which displays 65 rows and 255 columns on DINA4 page. I want to create a format type which will print 65 rows and 310 columns on 'LEGAL' page format .
    So plz suggest the ways along with help links if any.
    Regards,
    Madan.

    Hi Mandan,
    As long as I know the maximum column for printing is 255.
    Might be you can split your output into 2 rows...
    Regards,

  • Please Help!! How to get the width of the String for print out?

    Hi there,
    I need to do some printing in my application. I just want to know how can I get the width of the string when it is printed on the paper.
    I have tried to use the following code to get the width
    Rectangle2D rec = font.getStringBounds(str, new FontRenderContext(null, true, true));
    double width = rec.getWidth();
    however, the width I got from that function is not correct (the returned width is longer than the printed one)
    Does anyone know how to solve this problem?
    Thank you and Happy New Year !

    hi,
    The getFontMetrics(Font) is also defined in the Component class and therefore you can retrieve it even if you dont override the paint method.
    try the following (provided ur code extends some class that extends Component indirectly)
    FontMetrics f = this.getFontMetrics(this.getFont());
    int width = f.stringWidth(str); //str is the String for which u need to check the width.
    hope this was useful
    happy holidayz

  • Formatting html for printing-urgent

    I want to print an html/jsp page from the browser by removing unneccessry images and irrelevant information
    If the user select print option on the page then the page should be formatted accordingly so that only relevant the data is shown.It should fit on A4 size paper.
    Hint: if u have been to developer.java.sun site then there is an option printable page or print view option on the left
    On selection of this u get to see a page where unnecessary data is not shown.
    if u see the link , then it actually calls printpageservlet .
    Can u give source code for PrintPageServlet
    There are many sites which have this facilty.
    Reply asap. this is urgent

    You can write the same jsp page which does not output the unnecessary conents for printing.
    If the client is IE you can use
    <STYLE MEDIA="PRINT">
    span.notPrint{
    display:none;
    </STYLE>
    <BODY>
    Print display this... <span class="notPrint"> Display this, but do not print</span>
    </BODY>

  • Java.util.Formatter format string for week of year?

    What is strange in the Formatter API, regarding dates, is that there is no format string to display week of year. To display day of year e.g. you can use:
    String.format(�%tj�),Calendar.getInstance())but what is the string for week of year?
    String.format(�%tw�),Calendar.getInstance())doesn�t work.
    Any ideas, or did I overlooked the API?

    I �m using
    String.format(�%tx�),Calendar.getInstance())everywhere in my code where x is any of the other (e.g. j, d etc.). Why use different way for this? How come Sun did�t add e.g. a w in the API to display the week of year as it does for day of year?

  • Landscape and Portrait Page Format  Settings for Printing

    Hi Experts,
    The client requirement is to print the Smart form in 8.5 * 11 (inches) in  (Portrait) mode.
    In my page settings i have kept the Page Format = 'LETTER' .
    However when the page is printed , the formatting comes out to be A4(Landscape mode).
    Please let me know what i am missing.
    Thanks

    Hi Abhishek,
    I can suggest couple of options here.
    Check the settings by clicking on the Page you have created. Under O/P options we need to ensure its A4 potrait.
    Secondly you can create a custom Page Format with Potrait & Lanscape both options and depending on printer settings it will dynamically decide if we need to print Landscape of Portrairt
    Also check the Default printer Settings.

  • Timestamp method fromText, format string for timezone

    Hi,
    I try to import a time string as follow:
    Timestamp timestamp;
    std::string timetext = "2005-06-17T13:16:46.000+02:00";
    timestamp.fromText(timetext, "YYYY-MM-DD\"T\"HH24:MI:SS.FF[tzh:tzm]", "", environment);
    I write this timestamp to the database and see at the database the wrong date 2005-06-17T13:16:46.000 and not 2005-06-17T15:16:46.000.
    I got this string with different timezone (e.g. +02:00, +03:00, -01:00).
    I want only UTC time (+/-0, timestamp without any timezone) at the database.
    Greetings
    P

    You can use 'at time zone' in your insert statement to normalize to UTC. This assumes that the timestamp datatype in the table is 'timestamp' and not 'timestamp with time zone'. If the datatype is the latter then you should not use the 'at time zone' because timezone info is preserved and it is just a matter of displaying it in whatever timezone you choose.
    For example:
    create table tstest (ts timestamp, tstz timestamp with time zone);
    insert into tstest values (systimestamp at time zone 'UTC', systimestamp);
    alter session set nls_timestamp_format='yyyy-mm-dd hh24:mi:ss';
    alter session set nls_timestamp_tz_format='yyyy-mm-dd hh24:mi:ss,tzh';
    select ts, tstz at time zone 'UTC', tstz at time zone 'America/Los_Angeles' from tstest;

  • ICal print preview is not formatted properly for printing

    Calender printed fine last month. This month I get this. Naturally, it looks the same when printed. Running version 10.9.2 on iMac. Any ideas what the problem is?

    Kwarmar,
    Find and resolve duplicate fonts with Font Book.

  • Format Codes for the Time Format String

    Hello guys...
    I have 1 simple question.How to write a code in time format string.for example...%H%M%S for HH:MMS.So I want to add fractional seconds in this code...refer to the labview help,the code for fractional seconds is <%<digit>u>.But I'm little bit confuse just now.Should I put like this : %H%M%S%digitu. Or any other else?...thank u

    Just convert it to a date/time record and use "unbundle by name" to pick all the parts you want.
    (You only need to show the outputs you need)
    Message Edited by altenbach on 09-10-2007 12:01 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    GetTimeComponents.png ‏3 KB

  • Error: Literal does not match format string

    Can anyone help me with the query below. I am trying to insert CMPGN_ID, PGM_KEY, CMPGN_BEGIN_DT into TEMP.
    I get an error 'Literal does not match format string' for 'SELECT to_char(add_months(SYSDATE,-1),'YYYYMM') from dual'
    CMPGN_BEGIN_DT has a data type of DATE.
    INSERT INTO TEMP (CMPGN_ID, PGM_KEY, CMPGN_BEGIN_DT)
    VALUES(
    ('NCR_'|| (select to_char(add_months(SYSDATE,-1),'YYYYMM') from dual)),
    (SELECT PGM_KEY FROM PROGRAM WHERE PGM_NAME = 'NCR'),
    (SELECT to_char(add_months(SYSDATE,-1),'YYYYMM') from dual)
    Thanks

    INSERT INTO TEMP (CMPGN_ID, PGM_KEY, CMPGN_BEGIN_DT)
    SELECT 'NCR_'|| to_char(add_months(SYSDATE,-1),'YYYYMM'),
         PGM_KEY,
         to_char(add_months(SYSDATE,-1),'YYYYMM')
    FROM PROGRAM
    WHERE PGM_NAME = 'NCR';Datatypes are unclear, may need datatype casting with date column, but otherwise the above should work.
    Thx,
    SriDHAR

  • Can I print out the document formatting information for review

    Is there a way to print out, for example, all the paragraph format with their formatting details? I'd like the same for character formats, conditional text etc.?
    I'm a long time FrameMaker use and have built numerous templates over the years. The one thing I always found missing was the ability to printout a list of the various formats so that you can review them (much more easily one at a time on screen) to make sure they all have the correct settings. MS Word, back in the DOS days, had this capability and it was fast and efficient way of double checking all the formatting.
    Does this functionality exist in FrameMaker? Or are there any utilities out there that would do this?
    Thanks,
    Inge

    The Format List utility from Squidds does this really well. It creates
    tables that contain the various formats and their settings. It's really
    easy to look down a column and see which paragraph or character formats
    use, for example, a particular font or space above setting. Format List
    is one of the Finalyser utilities.
    The Squidds website is notoriously user unfriendly, but here is a link
    for the price lists page. If you can find the right list for your
    FrameMaker version, it will give you prices for the complete Finalyser
    or Toolbox utility set, and prices for the individual utilities. I
    believe Format List is $49 USD.
    http://www.squidds.de/en/products/price-lists-order-form.html#c321
    It seems like someone else makes a utility that creates a separate
    one-column table for each format. I can't seem to find that one. Perhaps
    someone else remembers what it is. Separate tables are not nearly as
    easy to use for comparison, though.

  • When saving a document as a PDF for printing, I lose pages, clip art, and my orginal format. Help!

    I have created some forms for our congregation to fill in with answers on adobe forms central. When I go to turn it into a PDF for printing for a hard copy, (not all our members have internet) when i save it to a PDF, it doesn't save all the pages and formats it differently then show on the screen i programmed it onto. How do I fix this issue?

    Hi;
    In the "Feature Tutorials/Help" linked from the top of the main page of the Forums: Feature Tutorials / Help
    There is a Tutorial on "Creating and distributing fillable PDF Forms": Tutorial: Creating and distributing fillable PDF forms
    The main thing to look at is the "View" setting and for PDF set it to "Page View", the page breaks you define in Page View will be used in the PDF, there are also "implicit" page breaks added automatically based on the page size.
    For the issue with clip art see this FAQ: Image does not show up in PDF 
    Thanks,
    Josh

  • Hw can I generate XY graphs directly in a vector data format for printing ie pdf

    A further question re. Printing of Graphs
    There are many similar questions but none where the answers are acceptably adiquite or two or three were the link was broken,
    "Developer exchange forums have been moved" and a pointer to the new
    site, unfort it was hard to find or guess the rest of the link.
    So here is my angle on this problem;
    So far I have tried;
    Using property node: "App.  Printing.Default Printer" to select the printer to use, then
    Using Report Functions to print controls;
    New Report, to generate a new report reference
    Set Report Orientation
    Set Report Margins
    Set Report Font
    Set Report Header Text
    Set Report Font
    Set Report Footer Text
    loop for each page
    Set Report Footer Text,     With page number
    Append Control Image to Report,      several times
    New Report Page
    Until the end of the last page
    Print Report
    Dispose Report
    Initially using existing XY-Graph controls from the front panel.  These
    are on a page of a Tab control to hide these controls while not in use
    and allow them to be hidden while generating the printout. 
    Unfortunately when this page is hidden any graph scales set to
    autoscale don't, (normally don't need to and would otherwise be a waste
    of processor time), resulting in graph plots going off scale or
    becoming a line along the axis.
    An issue is that what is printed appears to be read from the screen, so resolution is much
    lower than required for for printing, resulting in rather pixellated
    printed versions. These prints will usually be emailed, so tried the
    pdf995 "printer driver" but the resulting pdf file size is rather large.
     Currently trying Plot-XY on a much larger picture so as to get
    adequate resolution for printing, however suspect this will result in
    much larger pdf files and probably cause other problems. 
    The preferred solution in this case will probably be to generate print
    output, instead of based on raster images (ie jpg or png), but on a
    vector format, maybe via postscript or directly in pdf format.
    Similar graphs currently printed from Excel via pdf995
    (or OpenOffice) result in files around 20 kb per page. these can be printed at any size
    (at least upto 64 times) without becoming pixellated, so assume these
    are vector based.
    Currently a page with 4 XY Graph controls uses around 40 to 45 kb per
    page but resolution is poor and overcoming that may push file size up
    to 150 to 200 kb per page, and the whole job can be 50 to 100 pages.
    Are there any functions to generate XY graphs directly in a vector data format preferably in pdf or via PostScript format.
    Cheers
    Darryl

    Hi Darryl,
    I was able to reproduce the issue you were seeing, in which a report generation was taking up a large amount of space per page in a PDF utility. I found; however, using my attached VI (notice that it is set to *.png) and the CutePDF utility (free download at http://www.cutepdf.com/) I was able to get a per page size of about 10 KB. Also using the png I found that the image quality seemed to be quite high.
    Please try incorporating this solution into your application and see if it reduces your file sizes.
    Thanks and have a good evening!
    Cheers,
    Jonah
    Applications Engineer
    National Instruments
    Jonah Paul
    Marketing Manager, Embedded Software
    Evaluate the LabVIEW RIO Platform! - ni.com/rioeval
    Attachments:
    print_XY Graph.vi ‏23 KB

  • PNG colour profiles - and this format for print

    I know it's taboo to talk about PNG for printing.
    But I can't find and I've searched the forums - there was a post made about embedding colour profiles a while ago.
    I know PNG is a RGB only format, but I'm 36.8% sure I read something about embedding either RGB or ... wait for it CMYK profiles into PNG files.
    If anyone can shed any light on this - and how about PNG for print - I've been against it for a long time - but it is a lossless format, it can carry 64 bit data.
    I know I know - but I thought I'd ask anyway - see what people think.

    You can't save a PNG with a profile out of Photoshop, but it looks like you can embed one via the image events scripts that ship with OSX (/Library/Scripts/ColorSync/embed). Unfortunately ID ignores the embedded profile and uses the document's assigned profile instead. PNGs do respond to ID's RGB profile and the RGB profile will have an effect on the CMYK separation when it happens.
    Here's ProPhoto and sRGB:
    From your ID document you can also assign a profile, which conflicts with the doc's profile, by selecting the png and choosing Image Color Settings.... So, you could assign AdobeRGB as your doc's profile and assign sRGB to all your pngs.

  • Formatting for print

    I have read about using CSS for printing out your pages so
    that you dont
    have to create 2 copies of each page you want printed.. but i
    cant find how
    to actually put it to use..
    I have added the necessary code to my CSS file.
    I have changed the media type to media="print"
    and all i keep reading is that this allows you to have the
    same page
    formatted for print..
    But how exactly do i call the same page for print? do i add a
    link to the
    page saying click here to print? if so what woudl the link
    actually point
    to?
    or by just including the right code, when the end-user choses
    to click print
    within there browser that knows to display the same page
    using the
    print.css?

    "DC" <[email protected]> wrote in message
    >I have read about using CSS for printing out your pages
    so that you dont
    >have to create 2 copies of each page you want printed..
    but i cant find how
    >to actually put it to use..
    >
    > I have added the necessary code to my CSS file.
    > I have changed the media type to media="print"
    >
    > and all i keep reading is that this allows you to have
    the same page
    > formatted for print..
    >
    > But how exactly do i call the same page for print? do i
    add a link to the
    > page saying click here to print? if so what woudl the
    link actually point
    > to?
    >
    > or by just including the right code, when the end-user
    choses to click
    > print within there browser that knows to display the
    same page using the
    > print.css?
    >
    The browser display will always be the same, whether you have
    a print CSS
    option or not.
    The arrangement is -
    You have one style sheet for your screen layout say
    "screenstyle.css" and
    one for your print layout say "printstyle.css"
    You ad both style sheets to your page code -
    <link href="screenstyle.css" rel="stylesheet"
    type="text/css" media="screen"
    />
    <link href="printstyle.css" rel="stylesheet"
    type="text/css" media="print"
    />
    When a user views your page on their screen it is laid out
    according to your
    screenstyle.css style sheet.
    When the user prints the page, the printed output is laid out
    according to
    you printsyle.css style sheet.
    Hope this helps
    Regards
    Phill
    P&M Software
    www.pmsoftware.co.uk

Maybe you are looking for

  • SQL query with different plans

    Hi, Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi I cannot paste the query plan due to company policies. I can see issue with the query plan, where it is doing partition range scan (with hash join) on one environment due to which i

  • Source URL/Address - Hazel

    Hazel is not supporting my credit card so I cant get it. But in the trial version Hazel has this property "Source URL/Address" which is the same information as "Where from" value in "Get info" in the contextual menu of a file.  Does anyone know how t

  • Is Adobe Elements 8 on the Decline?

    Recently I purchased both Adobe Elements 8 and Premier 8.  So far I am totally dissatisfied with them.  In the past I used Elements 2 and 5 so was expecting at least some improvement.  At least version 5 had a meager manual - version 8 has nothing. 

  • Where within CS6 Photoshop will I find the folder and file to clear the scratch disk on my harddrive ???

    Where is the folder (and file) to erase the scratch disk ...

  • Create a Contact on an address book other than the default one

    Hello everyone, I am using a professional address book and calendar on exchange provided by my company. I am also using my iCloud account to manage my personal address book and calendar. I have set up my iphone 4S to display both address book and cal