开发者

Eclipse Project Printing

开发者 https://www.devze.com 2022-12-12 07:11 出处:网络
I have to print out one of my projects and the built-in print function of Eclipse isn\'t doing a good job at all. Font, font size, page border etc..

I have to print out one of my projects and the built-in print function of Eclipse isn't doing a good job at all. Font, font size, page border etc..

Does anyone know a plug-in or tool to print out my whole project easily? Maybe with some formatting options on it?

After a little bit google, I've encountered enscript but its an Linux tool and unfortun开发者_运维百科ately I'm on a Windows machine.

Regards


The most recent plugin about printing and printing preview is:

swt-paperclips

a simple, light weight, extensible Java printing plug-in for SWT.
PaperClips hides the complexity of laying out and rendering documents on the printer, helping you focus on what to print instead of how to print it.

In a nutshell, PaperClips provides an assortment of document "building blocks," which you can tweak and combine to form a custom document.
The assembled document is then sent to PaperClips for printing.
PaperClips includes support for printing text, images, borders, headers and footers, column layouts and grid layouts, to name a few. It can also be extended with your own printable classes.

Here in an example in this article:

alt text http://www.schmeeky.co.uk/assets/drgalleries/19/thumb_print_dialog.png


Eclipse does a terrible job printing on Windows. But there is an excellent version of Enscript that works for Windows and does great printouts. You have to set it up as an external tool which is a bit of a bear, but once it's setup it works well.This how I installed it on XP.

  1. Download and install Enscript for Windows
    http://gnuwin32.sourceforge.net/downlinks/enscript-src.php

  2. Create an external tool for running Enscript in Eclipse

    Goto Eclipse, Run -> Configure External Tools.
    Add a tool (icon looks lie a miniature document with +)
    Name it "Run Enscript". Configure as follows:

    • Main Tab
      Location : browse to the Enscript executable. Should be in:
      C:\Program Files\GnuWin32\bin\enscript.exe
      Working directory: leave empty
      Arguments: --header=${resource_name} -p "${workspace_loc}\${project_name}\print.ps" "${resource_loc}"
      (These options will create a postscript file named print.ps at the top level of your project from the currently selected window.)

    • Build Tab
      Clear "Build before launch" or it will try to rebuild your project each time you print..

  3. Send the file to the printer

    You need to find a way to send the file to the printer. Several utilities to do that, but since I had a postscript capable printer all I had to do is to share it under Windows, and copy the file to the share name. I automated this by adding another external tool, named "send ps file to printer"

    • Main Tab
      Location: C:\WINDOWS\system32\cmd.exe
      Working directory: leave empty
      Arguments: /c copy "${workspace_loc}\${project_name}\print.ps" \\your-machine-name-here\your-printer-share-name-here
      (this will pick up the file we just created and send it to the printer)
    • Build Tab
      Clear "Build before launch"

Voila, two clicks to run the tools one after the other and it prints clean. You can configure it further by adding Enscript options to the argument line. Here are a few useful ones:
- specify a slightly smaller font size (default is 10): -f Courier8
- truncate lines instead of wrapping: -c
- precede line with its line number: -C

0

精彩评论

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