Community
Participate
Working Groups
Printing a Java file from the Java editor has the following issues: - should not highlight the line containing the cursor - should always print on a white background (is completely unreadable otherwise because it gets shaded) -- I use a light shade of blue rather than solid white for window backgrounds because I find it much easier on the eyes. - should support printing all text in black (ie. respect the fonts and styles, but ignore the colours specified in the Editor colour preferences) - should support pagination, headers, and footers - should support specifying different fonts for viewing and for printing
Is there SWT support for these requested printing enhancments? Moving to SWT
StyledText printing problem. KR to investigate.
-should not highlight the line containing the cursor: There are two options to address this: 1) StyledText never prints line highlighting 2) JDT temporarily turns off line highlighting when printing I would favor the latter because there may be clients that want to print the line highlighting. -should always print on a white background Agree. We should change this -should support pagination, headers, and footers StyledText would need to add API for this. Unlikely to happen for 2.0. Printing page numbers seems like a reasonable request, though. -should support printing all text in black -should support specifying different fonts for viewing and for printing JDT can do this now: Right before calling the StyledText print API you would change all styles to black (remove all non-bold styles, change bold styles to black). When the printing API returns you would change the styles back to the original. Same for the font. Note that there may be a flash when you are done with this as the setStyleRange and setFont API issues a redraw. There shouldn't be any visible style change though.
Entered JDT bug 14954 for the line highlight and page background issue (which are related). Entered JDT feature request 14955 to add printing in black and printing using a different font. Entered SWT feature request 14956 to add pagination and headers and footers. Please add yourself to those bugs if you want to track progress.
Reopening because this bug covers all the printing issues. Bug 14955 may still be valid, depending on how we address the printing support. Could not reproduce the background color printing. I always get a white background when I print and I don't think I changed anything wrt. the background color.
Propose adding API to StyledText: Runnable print(Printer printer, StyledTextPrintOption options) StyledTextPrintOptions would define the following fields public String header = null; // "left '\t' center '\t' right" public String footer = null; // left, center, right = <PAGE> | #PCDATA public int options = 0; header and footer is defined as three separate regions for arbitrary text or the page number placeholder <page>. The regions are left aligned, centered or right aligned and are separated by a tab character. options is defined as 0 or more of the following: ST.TEXT_FOREGROUND print the text foreground color as defined in style ranges ST.TEXT_BACKGROUND print the text background color as defined in style ranges ST.FONT_STYLE print the font style (BOLD) ST.LINE_BACKGROUND print the line background color By default none of the styles will be printed, neither will be the line background. The widget font can be set for printing as described in bug 14955. Erich: Please review the proposal/suggest changes/required other print options.
StyledTextPrintOptions should also have a field to specify the print job name. public String jobName
These enhancements make sense. I don't understand the assymetry between header and footer, i.e., I cannot show the page number in the header? Did you consider passing in a formatted string (MessageFormat.format) to support rendering the page number? It would be more flexible and allow rendering the page number like this -1-. The JavaEditor adds additional adornments to the text through PaintListeners (e.g. wiggley lines, matching bracket highlighting, print margin). I assume the recommendation is to remove these listeners before and add them back after, since the StyledTextWidget cannot not about them. I've carboned Kai (but he is on vacation this week).
Header and footer can be exactly the same. I don't see how a formatted string would make the header/footer more flexible. The StyledText printing engine supplies the page number. You can use header = "\t-<page>-" to get a centered page number like -1- Please elaborate if I am missing something. Any extra painting done on top of StyledText needs to be turned off (it already is in the current printing implementation). StyledText has no control over these.
Added new printing API as per bug 14956. See class StyledTextPrintOptions. Moving to JDT Text to add desired printing options. Note that bug 6140 may take care of the print job name.
marking as later since all dependent bugs are also marked later.
*** Bug 45619 has been marked as a duplicate of this bug. ***
*** Bug 51605 has been marked as a duplicate of this bug. ***
*** Bug 52008 has been marked as a duplicate of this bug. ***
*** Bug 64155 has been marked as a duplicate of this bug. ***
Can a target be given for this? Also, it would be nice if eclipse supported some more advanced features, such as printing the source for all selected files / working sets / projects, etc, although this would be more of a request for enhancement rather than a bug. Resolved Later... but when!? :)
*** Bug 70825 has been marked as a duplicate of this bug. ***
*** Bug 35550 has been marked as a duplicate of this bug. ***
*** Bug 73491 has been marked as a duplicate of this bug. ***
*** Bug 78213 has been marked as a duplicate of this bug. ***
*** Bug 78304 has been marked as a duplicate of this bug. ***
*** Bug 78966 has been marked as a duplicate of this bug. ***
*** Bug 90531 has been marked as a duplicate of this bug. ***
(In reply to comment #23) > *** Bug 90531 has been marked as a duplicate of this bug. *** the bug I reported is far from just about printing headers,footers, etc. I cannot print anything meaningful, as the fonts used are so large (40-50points +) that only a few letters per page are output. This is an Eclipse-only problem - all other app's can print happily. Also, the Print dialog (is there one?) is not presented.
(In reply to comment #23) > *** Bug 90531 has been marked as a duplicate of this bug. *** It's been almost a year since this bug had it's 12th duplicate bug. I was wondering where things are on fixing the problem. Is there anything blocking this bug (of the three bugs listed as blocking, the only one that looks to me to be actually blocking was fixed)? Is there some estimate of when "Later" is? Is it that big a task? Thank you very much. Be well.
LATER means that we don't plan to work on this in the near future. We will gladly accept help from people who really want that feature.
*** Bug 189027 has been marked as a duplicate of this bug. ***
Get rid of deprecated state.
It now prints the name in the header and the page number (e.g. "Page 1") in the footer. I can't print the page count due to bug 207196.
Please let the user configure the new printing features (3.4 M3).
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
As far as I know none of the suggestions has been implemented until now. It still has my interest, at least the heading facility. ;JOOP!
Some issues seem to have been repaired: - fonts: since the use of menlo, font size 11 shows acceptable and prints readable with the same amount per line as is reasonable in the editors. - colours: I find it very nice to have the syntax colouring in the editor also on paper. - heading etc.: a heading and page numbering exist now; footers would require extra data inserted somewhere. Anybody other wishes? I'm satisfied with the current status. ;JOOP!
I believe you may close this one. ;JOOP!