Solved

Java String.format problem

Posted on 2011-02-14
11
933 Views
Last Modified: 2013-11-23
I include the form feed code \f at the end of my format string but is does not form feed to the next page before it starts printing the balance of the document.  Any Ideas
0
Comment
Question by:sargent240
  • 6
  • 5
11 Comments
 

Author Comment

by:sargent240
ID: 34892076
Forgot to include the line of code so here it is

            totaloutputString = String.format("\n%62s      %.2f", "Total Due",
                    stmtTotal, "\f");
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34892151
try:

            totaloutputString = String.format("\n%62s      %.2f\f", "Total Due",
                    stmtTotal);
0
 

Author Comment

by:sargent240
ID: 34893786
Thanks objects:  I moved the \f to follow the %.2f with the same results.
0
 
LVL 92

Expert Comment

by:objects
ID: 34893823
have you checked if the form feed is actually in the string?
Problem may not be with that line of code
0
 

Author Comment

by:sargent240
ID: 34893869
I write several invoices into a file and I would like each invoice to be on it's own page of course.  I am printing all the invoices to one file and trying to put a form feed between each one.  I am attaching the code I am using and the line you suggested is toward the bottom. Everything prints properly I am only lacking the form feed.   Hope this helps.
Cheers
 WriteFile.java
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 92

Expert Comment

by:objects
ID: 34902236
are you sure your printer supports form feeds?
0
 

Author Comment

by:sargent240
ID: 34912999
I have tried it on a Brother DCP 7020 and an Okidata 320 using the Epson FX emulation.  They both react the same.  We have several hundred Okidata printers in another application and we use the form feed there.  I'm not curtain about the Brother and am not sure how to find the info.
0
 

Author Comment

by:sargent240
ID: 34938211
Are we at a lose on this one.
Cheers sargent240
0
 
LVL 92

Expert Comment

by:objects
ID: 34938871
the code is writing the form feed to the string so I'm stuck as to why its not working
0
 

Author Comment

by:sargent240
ID: 34940128
Are you aware of the two printers I have tried?
Thanks
0
 
LVL 92

Expert Comment

by:objects
ID: 34940231
i'm not sorry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now