Sun Releases 100% Java PDF Renderer and Viewer

What is it?

The PDF Renderer is just what the name implies: an open source, all Java library which renders PDF documents to the screen using Java2D. Typically this means drawing into a Swing panel, but it could also draw to other Graphics2D implementations. We hope you will come up with cool things to do with it that we never thought of.

PDF is one of the core file formats of the Internet, so it is very important for Java programmers to be able to both read and write PDFs. Great open source libraries like iText have long handled the writing half, but until now there has not been a good way to read PDFs using open source Java libraries. It could be used to draw on top of PDFs, share them over a network, convert PDFs to PNG images, or maybe even project PDFs into a 3D scene.

Note, the PDFRenderer does not generate PDF documents, instead it views them. To generate PDFs you should try iText or one of many other great Java libraries.

What can I use it for?

Some ideas to get you started:

  • view PDFs in your own app
  • print-preview before exporting PDF files
  • render PDFs to PNGs in a server-side web application
  • view PDFs in a 3D scene
  • draw on top of PDFs and annotate them in a networked viewer

What are the runtime requirements?

The PDF Renderer requires Java 5 (Java SE 1.5). It has no other dependencies

Getting Started

Since this is the first release we don’t have much content yet. You can download the code using CVS,
read the javadocs, or try out the viewer demo. Also, please join the dev or user’s mailing list.

Our examples page has some sample code to opening PDFs in Swing, as an image, and other basic usages.

The SwingLabs PDF Renderer was originally written in 2003 by researchers at Sun Labs for an internal collaboration tool called Sun Labs Meeting Suite. It was originally targeted at output from OpenOffice, and so can support most OpenOffice PDF exports.

Sun engineer Joshua Marinacci says: “Several of us inside the desktop Java team here at Sun have been working hard on getting this released and now it’s finally here.”

“Go check it out at pdf-renderer.dev.java.net.” he adds. 

PDF is the standard way of exchanging non-interactive documents on the web, Marinacci reminds.  Everything from tax forms to clip art can be stored in PDFs. Mac OSX makes heavy use of PDF both as an asset format (the many widget images found in Aqua) and also as an ideal archive format using AppleScript workflows. PDF is everywhere.

“Once a PDF is created you know with great certainty that it will display and print exactly as you want on any platform,” he says, adding:

“Hmm. Write a PDF once and run it anywhere? Sounds like a good fit for Java! Combined with PDF writing libraries (like iText), you can do pretty much anything you want with PDFs.”

reference:
https://pdf-renderer.dev.java.net/
Sun Releases Open Source 100% Java PDF Renderer/Viewer

Leave a Reply