开发者

How do I change the font size when printing from Eclipse?

开发者 https://www.devze.com 2023-04-09 23:27 出处:网络
Sometimes I\'d like to print my code and read it during lunch. In Eclipse I\'m using 10pt Helvetica font, but printing at this size is a waste of paper I think. I changed to font size 6pt, and the pri

Sometimes I'd like to print my code and read it during lunch. In Eclipse I'm using 10pt Helvetica font, but printing at this size is a waste of paper I think. I changed to font size 6pt, and the print was perfect; fully readable and pa开发者_如何学Pythonper saving.

However, coding in 6pt font is very hard and stressing for my eyes, so I cannot keep the setting. Also, changing font size everytime I print is a pain.

Is there a way to keep 10pt for my editor AND have the printer run at 6pt, at the same time?


I ended up changing the paper size to A5 and printing to PDF, then printing the PDF to A4.


The best workaround I've found is to copy-and-paste the entire program into a text editor where one can tweak the page/font settings (I use gedit) and print from there. A pain, but less so than changing the font size within Eclipse.


This question was awhile back but I found a work-around to the original question posted. When I select File-Print then a Print menu options comes up (every print menu options is different depending on the OS. This is on a Macbook) I scaled the size of the printing down. Works great to read and more importantly, save trees!:-) Scaling the printing of source code


I tried scaling printout to 50-75% and it works for me also: Large font on screen but small font to fit all in less amount of paper


Give this a try:
Go to preferences > appearance > colors and fonts then select 'basic'. In that drop down select 'text font'. Click 'edit' make your changes and print. When you're done you may want to change it back by clicking reset.

I found this information in two places
1: http://blog.alagad.com/2007/06/15/changing-the-font-size-in-eclipse/
2: http://people.reed.edu/~jerry/121/handouts/04a-eclipse-printing.pdf [PDF]


I agree, Eclipse should have a 'Print font' setting.

This solution is late, but works so well, that I'm posting it anyway.

However, I have found a pretty good solution for me: format for Ledger (11x17) but scale to Letter (8.5x11). This is essentially 6 pt, which gets me 116 lines down, 140 cols across, in Portrait mode.

I like this so much, that for personal work, I have tweaked Eclipse to assume a 120 column print margin. Here's how:

  • Set Editing font to Consolas 10 pt. (This is my preference, however it doesn't make much difference, as you will see. (Window > Preferences > General > Appearance > Colors and Fonts > Basic > Text Font)
  • Set Print margin at 120 characters. (Window > Preferences > General > Editors > Text Editors > Show print margin > Print margin column 120)
  • Set code style formatter's line wrapping to 120 characters. (Window > Preferences > Java > Code Style > Formatter > Active Profile > [your custom profile name] Edit > Line Wrapping > Maximum line width > 120).

The details of how you select the Paper size to format for, vary by printer. For me, it is done from File > Print... > Preferences > Basic > Paper Size > Ledger.

Likewise, selecting page scaling is a printer preference. For me, it is File > Print... > Preferences > Advanced > Scaling > Fit to Paper Size > Letter.


Using Mars.1 Release (4.5.1) I still see this as a problem. I tried the scaling in the printer dialog as suggested by Allen and Eclipsed, and my Brother printer under Windows used just as much paper, using same page breaks, leaving white space at bottom of each page.

So do an experiment with a small selection before trying this. Your mileage may vary.

I'm almost ashamed to admit it, but, so that I could get colors, and preview before printing, I ended up pasting into Microsoft Word and printing from there.


Just print to pdf with A3 paper size then print from your pdf reader. Works for me! Can get about 100 lines of code per sheet.


The mismatch of screen font size with printed font size is supposed to be fixed in Eclipse version 3.7 (Indigo). Perhaps you need a newer version of eclipse.


I had a similar problem, and was given the following by a colleague. The following should be entered on the command line:

  • To check default font: query default.print.font
  • To change font temporarily: print.font "Courier New-10"
  • To change font permanently: default.print.font "Courier New-8"

Hope it helps

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号