Skip to main content

Little Favours

Posted by editor on December 13, 2007 at 7:53 AM PST

Java2D picks up another trick: PDF support

Well, we've been teasing Josh Marinacci's big surprise all week, and now it's out, by way of an announcement at JavaPolis: the SwingLabs PDF Renderer. The project is an open-source, all-Java library that renders PDF data to Java2D, meaning it can be used in Swing or any other Java code that works with Java2D grpahics (like, say, mapping a PDF to a 3D surface in Project Wonderland).

So, for the sake of argument, why does Java need to support PDF? As the project explains:

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. We hope that the community will embrace this PDF Renderer in ways we've never thought of. 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.

A set of javadocs is online, as is a Java Web Start demo, which lets you open arbitrary PDFs. Here's a look at it rendering a real-world PDF document, the QC1 proofs from a book (click for full-size):


The SwingLabs PDF Renderer is licensed under the LGPL. Surely you have PDFs, so go try it out.

Also in Java Today,
the project is migrating its repository from CVS ( to Mercurial (, and this change will effect all community members who are integrating code changes to repository. The migration to Mercurial is planned to be completed as soon as possible, but with a minimal impact on current development. A small team has been put in place to facilitate this migration. They will deliver documentation and training materials to the community before the switch is done. Expect messages on the NetBeans mailing lists with more detailed information during December and at the beginning of January. For more information, check out the NetBeans wiki pages on Reasons for the Move and the Migration Plan.

Kelly O'Hair has posted a set of answers to common Mercurial OpenJDK Questions. He takes on the topics of why Mercurial was chosen for OpenJDK, why no history was imported from the TeamWare or Subversion repositories, why multiple repositories are used for the project, and more. He goes on to say, "I'll add more to this as time goes on, assuming people find it useful. Add your questions to the comments, I'll try and answer them."

Today's Weblogs section focuses entirely on the Javapolis conference, starting with James Gosling's report
I had a great day at JavaPolis. Congratulations to Stephan Janssen, the Belgian Java Users Group, and everyone else involved: you all did a great job. It really was packed. The venue was a total mob scene.

Fabrizio Giudici has been posting a series of updates from the conference, the latest being
JavaPolis update.
"Well, this morning I started writing on the blog quite early (8:55), an unusual thing since at that hour either I'm going to a customer or I'm still sleeping :-) but the fire alarm woke me up at 7:25 (and there was smoke smell too!), so at 7:30 I was ready to escape with my photographic gear in one hand and my laptop in the other. Fortunately, the alarm stopped buzzing."

Jean-Francois Arcand has blogged his travels en route to Javapolis, and gets there at last in
On the Javapolis: Finally arrived in Antwerp. "Finally, I'm at JavaPolis. I've arrived yesterday and realized that my session and BoF two hours usual, I should have looked earlier at the schedule!"

Today's Forums start with a post from the new JavaFX Scene Graph forum, as Joshua Marinacci helps get a basic example working in
Re: Hello World example.
"You need to set the font and location of the text. Keep in mind that the text node will drawn on the baseline. This means that if you set the location to (0,0) then your text will be above the top of the screen. This code should work..."

Also from the OpenJFX forums, ramon_lopes seeks help
Invoking a JavaFX Script.
"I built a simple application, then I want run it outside my IDE, ie, by jar file. I've found some materials, then I've tried this simple example: But when I run this application, it generates a NullPointerException!"

Finally, irond13 makes a SwingX feature request in
JXMonthView Modification Request: Traverse by year.
"The need for this becomes apparent when using a DatePicker to select a birthday; only being able to traverse in monthly intervals means it could take literally hundreds of mouse clicks to come close to your birthday. Setting the default date to something earlier is not a viable alternative either, being off by only 10 years would mean your user would have to click at least 120 times. I would propose having two pairs of buttons, an inner pair which scroll by month (as it is currently) and an outer pair which scroll by year. The month buttons could have single arrow heads while the year buttons could have double arrow heads."

Current and upcoming Java

Registered users can submit event listings for the href=""> Events Page using our href="">events submission form.
All submissions go through an editorial review before being posted to the

Archives and Subscriptions: This blog is delivered weekdays as
the Java
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Java2D picks up another trick: PDF support