开发者

How to print Java code on A3 page avoiding line-wrapping

开发者 https://www.devze.com 2023-01-24 22:50 出处:网络
I have to print Java code that some times reaches 300 columns (characters per line) in A3 paper and whatever editor I use (e.g. textmate) wraps the lines in order to fit in A4 paper.

I have to print Java code that some times reaches 300 columns (characters per line) in A3 paper and whatever editor I use (e.g. textmate) wraps the lines in order to fit in A4 paper.

Any suggestions?

cheers, Asterio开发者_StackOverflow社区s


Your editor undoubtably has either a Page Setup dialog or a Preferences dialogue as part of the Print Dialogue which will allow you to set the Paper Size to use for printing.

Even Notepad supports this


I finally made it to print using enscript. Here is the command I used to print Java code into PDF (and the used the pdf to print).

enscript -r -Ejava -M A3 -C -f "Courier8" input.java -o - |  ps2pdf - output.pdf

where:

  • -r prints in landscape mode
  • -C prints the line numbers
  • -f changes the font and size
  • -M sets the output media to A3 (default is A4)
  • -Ejava adds syntax highlighting (you can also use --color if you need colors in syntax highlighting but they are not nicely printed in greyscale)


It seems unlikely that every editor tries to format for A4. Which other editors have you tried? Does textmate not have a page size option? (Hmm... seems not)

Try a different editor that does let you set page size. Word, even.

0

精彩评论

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