Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Convert Java source to PDF

 
Stas Baturin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1816
33
Firefox Browser IntelliJ IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stas Baturin
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but i didn't want use scripts and writed simple java program for solution my problem.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic