Not sure if you have gone through the 'Caveats' section mentioned in the bottom part of the article. That may give you hints.
Also, you should go through part 2 of the same example which fixes many issues found in the part 1.
SCJP 1.4, OCMJEA/SCEA 5.0.
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF