File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Convert Java source to PDF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Convert Java source to PDF" Watch "Convert Java source to PDF" New topic
Author

Convert Java source to PDF

Stas Baturin
Greenhorn

Joined: Dec 21, 2011
Posts: 5
Hi everyone, I have very stupid request from Manager.
I need convert Java source to PDF file. I have local repository with source files, how can i convert it to PDF recursively? What software can i use?
Sorry for my English))
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
Without knowing what this is intended for, check out PDFBox's TextToPDF tool. You could call this as part of a shell script invocation (possibly using find to identify all .java files).
Paweł Baczyński
Bartender

Joined: Apr 18, 2013
Posts: 1048
    
  17

When I had to include code listings inside a pdf I used minted – highlighted source code for LaTeX.
But I needed code highlighting. If you do not need it this will be an overkill.

Or maybe you could just print out all sources and then scan them saving as pdf?

BTW, why on earth anybody would need sources in pdf? Have you asked your manager why he/she needs it?

Formely Pawel Pawlowicz
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 1066
    
  13

Stas Baturin wrote:Hi everyone, I have very stupid request from Manager.

Thanks for the laugh. The first thing I thought of was "Have you seen the memo about the new cover page for the TPS reports?" (Office Space reference for those who haven't seen the movie).

But seriously, you might look at CutePDF Writer. It installs as a printer driver so you can can just print anything to a PDF. It might work for you if you just have a few files. If you need to work through a bunch of files in a directory tree, the program Ulf mentioned is probably your best option.


"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Stas Baturin
Greenhorn

Joined: Dec 21, 2011
Posts: 5
Thanks, but i didn't want use scripts and writed simple java program for solution my problem.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42913
    
  68
I would estimate that the effort required to script/program this is probably about the same as learning how to set up some application that can do it by itself (assuming such an application exists). Further benefit is that it could then also be part of the build pipeline, and thus happen automatically.

Why the reluctance to automate this?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Java source to PDF