Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 556297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:54:18+00:00 2026-05-13T11:54:18+00:00

I have to print the whole sourcecode of a java-project. The final version should

  • 0

I have to print the whole sourcecode of a java-project.
The final version should look like: Eclipse: File -> Print.
But with this function you can only print one file at once.

Is there a way to print (or create a pdf/rtf of) the whole project (all *.java, *.xml, … files) with one command?

Im using eclipse galileo on windows xp sp3


EDIT: For each class/file the page should (more or less) look like this:

C:\..\..\..\LibraryExtractor.java

1 package utils.libraries;
2
3 import java.io.File;
9
10 /**
11 * @
12 * @
13 * @
14 */
15 public class LibraryExtractor {
16
17 /**
18 * 
19 * 
20 *
21 * 
22 * 
23 *
24 *
25 */
26 public static void extranctLibrary(String library, File targetFile) throws
IOException, URISyntaxException {
27 targetFile.getParentFile().mkdirs();
28 if (!targetFile.exists())
29 targetFile.createNewFile();
30
31 ClassLoader classLoader = LibraryExtractor.class.getClassLoader();
32 InputStream in = classLoader.getResourceAsStream(library);
33 OutputStream out = new FileOutputStream(targetFile);
34
35 byte[] buf = new byte[1024];
36 int len;
37
38 while ((len = in.read(buf)) > 0)
39 out.write(buf, 0, len);
40
41 in.close();
42 out.close();
43 }
44 }
45

SOLUTION:

  1. enscript (with Cygwin)

  2. Java2Html Eclipse-Plugin (only
    works with Europa)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:54:18+00:00Added an answer on May 13, 2026 at 11:54 am

    If you don’t mind installing Cygwin, or running on Linux, the following command will do what you want:

    enscript -r -2 --file-align=2 --highlight --line-numbers -o - `find . -name '*.java'` | ps2pdf - files.pdf
    

    enscript is a program for converting text files to a variety of output formats; PostScript is the default, but you can also produce HTML, RTF, and a few others. The -r option says to print in landscape, -2 is two columns per page (save trees), --file-align=2 says that each new file should start on its own physical page, --highlight turns on language-specific syntax highlighting (it will try to figure out the language, or you can specify “java”), --line-numbers should be obvious, and -o - sends the output to standard-out (where it’s piped to ps2pdf).

    find generates the list of files; here I’m telling it to find all Java files under in the current directory. The output is passed as arguments to enscript; for “50-100 files” you should be OK, but you might need to read about xargs. You could get rid of the -name argument to generate a list of all files, or add multiple -name arguments to add more file types to the list; I wouldn’t go with the “all files” approach, because then you’ll get source-control files.

    ps2pdf takes the PostScript output from enscript and converts it to PDF, which you can print.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a function to print database table to an array like this
I have to use java.util.Calendar in GWT entry point, but I got error while
I have this gdb macro, which is used to print meaningful stacktraces when debugging
I have a project in mind whose main selling point would be very good
I have a situation where I have to print out a NUL character if
if for example i have : #define PRINT(x) fprintf(stderr, x); and in code i
Is there a way to have rails print out a number with commas in
I have a generic Print method that iterates over a list and simply prints
I have the following code print Starting stage 1<br> # Something that takes about
I have a javascript backed 'print' button on my webpage where the user can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.