This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes java-to-PDF with jdk1.4 (or java 5) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java-to-PDF with jdk1.4 (or java 5)" Watch "java-to-PDF with jdk1.4 (or java 5)" New topic
Author

java-to-PDF with jdk1.4 (or java 5)

Mika Tapanainen
Ranch Hand

Joined: Jun 11, 2009
Posts: 95
Hello,

Is it easy to produce the simple PDF documents without third party libraries only using jdk1.4? Maybe in the future java 5 is also available.

Which packages and classes to use in the task?

Thanks,

Mika


SCJP, SCJD, SCEA
http://fi.linkedin.com/in/mikatapanainen
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41124
    
  45
The class libraries that come with the JRE have no provisions for creating PDFs. Check out iText, which is the premier open source library to create PDFs. Its 2.x versions run under Java 1.4, while the 5.x versions requires Java 5.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Mika Tapanainen wrote:Is it easy to produce the simple PDF documents without third party libraries only using jdk1.4?

No. PDF documents have a complex structure and there are no classes for that in the Java core library.

Maybe in the future java 5 is also available.

Java 6 is even available and Java 7 is on its way, but there is still no PDF support.

Frankly, if you want to create PDF documents, there is one obvious choice: iText. See also AccessingFileFormats for a link and alternatives.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Gopi Chella
Ranch Hand

Joined: Apr 26, 2010
Posts: 53
I am not sure whether we have API in Jdk 1.4 or 1.5. However with help of iText.jar(Third Party Library) we can create or Modify pdf files.

You will get enough information about PDF file creation in the below site

http://www.ehow.com/how_5980444_generate-pdf-using-java.html


SCJP 1.5
Mika Tapanainen
Ranch Hand

Joined: Jun 11, 2009
Posts: 95
Thanks for the answers.

The problem is that any third party libraries are strictly not allowed in the environment I'm working with. And we are using currently Java 1.4.

I know many ways to implement the PDF functionality if the third party libraries are allowed.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19654
    
  18

Why are third party libraries not allowed? Is it because of licensing? Because yes, iText's licensing (AGPL) can be a reason to not use it.

Nothing prevents you from rewriting something similar from scratch, but you should tell your project manager that that will require several months of extra work. Perhaps purchasing a commercial library is cheaper.
Mika Tapanainen
Ranch Hand

Joined: Jun 11, 2009
Posts: 95
The licensing is the problem. At worst case the both open source and commercial products are not allowed.

I know the producing of the PDF is not simple, I have been involved in several projects where one task has been PDF producing. But now the situation is a lot more challenging
 
jQuery in Action, 2nd edition
 
subject: java-to-PDF with jdk1.4 (or java 5)
 
Similar Threads
Java 1.4 Enhancements
Thread Scheduler
web services with jdk1.4
New Learner in Java
weblogic appc class file has wrwong version problem??!!please help!!