Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to copy code from eclipse including ine numbers

I am writing a little bit of documentation and code explanation. I would like to copy code from eclipse including line numbers, so that it becomes easier to reference the code in the text.

Is there any way to do this in eclipse or some other IDE, editor?

like image 504
mrt181 Avatar asked May 20 '10 11:05

mrt181


2 Answers

Since Eclipse 3.4 and bug 19602, you will print the line numbers if you have activated them on the Eclipse editor.

alt text http://img706.imageshack.us/img706/7605/eclipseshowlines.png

Printing a source will give you:

alt text http://img341.imageshack.us/img341/9899/eclipseprint.png

like image 108
VonC Avatar answered Nov 15 '22 04:11

VonC


You can do it by printing a PDF of source file, then copying source with line numbers from the PDF document.

It works for me with eclipse PDT + CutePDF, it should also work with Acrobat PDF printer

like image 35
Benoit Avatar answered Nov 15 '22 04:11

Benoit