简体   繁体   中英

Implementing underlined header and footer while printing Java Swing

I am creating a program that prints a multipage document with underlined header and footer. My document is in a JTextPane. The print method of JComponent class is:

JTextComponent.print(MessageFormat headerFormat, MessageFormat footerFormat, 
boolean showPrintDialog, PrintService service, PrintRequestAttributeSet attributes,
boolean interactive)

prints my document along with a header and footer passed as headerFormat and footerFormat response. However I need to underline the header and footer along with changing its font size.

Please help me out.

See http://java-sl.com/articles.html 4 articles about printing of JTextPane with custom header and footer. The article about headers and footers.

Alternatively you can try this one to print/preview content. It would require custom header/footer implementation but also it's possibly.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM