edu.stanford.hci.r3.pattern.output
Class PDFPatternGenerator

java.lang.Object
  extended by edu.stanford.hci.r3.pattern.output.PDFPatternGenerator

public class PDFPatternGenerator
extends java.lang.Object

This sits on top of PatternPackage and/or TiledPattern to create PDFs that can be printed. It uses the iText library to create and manipulate PDFs.

The circle approach works best. We draw and fill a circle the size of an Anoto pattern dot.

Other approaches that this class supports: Printing dots with the bullet point in Tahoma works decently. We will also try drawing circles, or using some sort of stamping pattern if possible. setFontSize(...) is an important method, as you will need to adjust it based on your printer. We picked a decent default (21 pt Tahoma) since it works for both of our printers. ZapfDingbats seems to work even better, as it is a built-in Adobe font. The 'l' lowercase L character looks like a dot. =)

This software is distributed under the BSD License.


Constructor Summary
PDFPatternGenerator(PdfContentByte cb, Units w, Units h)
           
 
Method Summary
 void adjustPatternSize(int patternDotSizeAdjustment)
          0 means no adjustment.
 void renderPattern(TiledPattern pattern, Units xOrigin, Units yOrigin)
          Render the given pattern starting at the designated origin.
 void setPatternColor(java.awt.Color c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PDFPatternGenerator

public PDFPatternGenerator(PdfContentByte cb,
                           Units w,
                           Units h)
Parameters:
cb - The content byte that you pass into this object will be transformed! Beware if you want to use it later on for another purpose. Probably, it would be good to dedicate a content layer for this pattern generator.
w - Width of the PDF Document.
h - Height of the PDF Document.
Method Detail

adjustPatternSize

public void adjustPatternSize(int patternDotSizeAdjustment)
0 means no adjustment. - implies smaller pattern, + implies calls to larger pattern

Parameters:
patternDotSizeAdjustment -

renderPattern

public void renderPattern(TiledPattern pattern,
                          Units xOrigin,
                          Units yOrigin)
Render the given pattern starting at the designated origin. Also render a white box underneath the pattern, if we were asked to do so... This helps the pattern stand out better.

Parameters:
pattern -
xOrigin -
yOrigin -

setPatternColor

public void setPatternColor(java.awt.Color c)
Parameters:
c -

Copyright 2006 Stanford University