import com.stevesoft.phreida.*; import java.awt.*; import java.io.*; public class Test1 { public static void main(String[] args) throws Exception { // Create the PGraphics object PGraphics pg = new PGraphics("test1.pdf"); // Draw something -- some text with a box around it. Font f = new Font("Helvetica",Font.PLAIN,25); pg.setFont(f); FontMetrics fm = pg.getFontMetrics(f); int border = 1; int d = fm.getDescent(); int h = fm.getHeight(); int w = fm.getLeading(); String str = "Hello, world"; int y = (10+fm.getAscent()); pg.drawString(str,10,y); pg.drawRect(10-border,10-border+d, fm.stringWidth(str)+w+2*border, h+2*border); // Finish pg.dispose(); // writes out file System.exit(0); // Graphics thread is running still } }