I have an Application that writes some texts in a file . Each five lines must be in distinct page. I have to use Dot Matrix Printers
that invoke continuous pages also I use \\f
for indicating new page. There is no problem in about writing file. But there is a problem when I print text file.
When printer prints first \\f
char , it invokes page completely without printing rest of the file. If I cut continuous page and insert them distinctly, all things will be good, but it is not a good way for printing files that have more than 100 pages. How can I solve this problem?
The simplest way to implement a page break as you would like is to insert unicode character 12, which is a form feed (FF) in ASCII and UTF. This will be interpreted by both Microsoft's Word and the WordPad application that ships with Windows, and a page break will be inserted correctly. You could achieve this in the following code:
import java.io.File;
import java.io.FileWriter;
public class PageBreakTest {
public static void main(String[] args) throws IOException {
File f = new File("page.doc");
FileWriter fw = new FileWriter(f);
fw.write("Page 1 information" + (char)12);
fw.write("Page 2 after page break char");
fw.close();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.