public Example_01() { FileStream fos = new FileStream("Example_01.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); Page page = new Page(pdf, Letter.PORTRAIT); Box flag = new Box(); flag.SetPosition(100.0, 100.0); flag.SetSize(190.0, 100.0); flag.SetColor(RGB.WHITE); flag.DrawOn(page); double sw = 7.69; // stripe width Line stripe = new Line(0.0, sw/2, 190.0, sw/2); stripe.SetWidth(sw); stripe.SetColor(RGB.OLD_GLORY_RED); for (int row = 0; row < 7; row++) { stripe.PlaceIn(flag, 0.0, row * 2 * sw); stripe.DrawOn(page); } Box union = new Box(); union.SetSize(76.0, 53.85); union.SetColor(RGB.OLD_GLORY_BLUE); union.SetFillShape(true); union.PlaceIn(flag, 0.0, 0.0); union.DrawOn(page); double h_si = 12.6; // horizontal star interval double v_si = 10.8; // vertical star interval Point star = new Point(h_si/2, v_si/2); star.SetShape(Point.STAR); star.SetRadius(3.0); star.SetColor(RGB.WHITE); star.SetFillShape(true); for (int row = 0; row < 6; row++) { for (int col = 0; col < 5; col++) { star.PlaceIn(union, row * h_si, col * v_si); star.DrawOn(page); } } star.SetPosition(h_si, v_si); for (int row = 0; row < 5; row++) { for (int col = 0; col < 4; col++) { star.PlaceIn(union, row * h_si, col * v_si); star.DrawOn(page); } } pdf.Flush(); bos.Close(); }
public Example_02() { FileStream fos = new FileStream("Example_02.pdf", FileMode.Create); BufferedStream bos = new BufferedStream(fos); PDF pdf = new PDF(bos); pdf.setCompressor(Compressor.ORIGINAL_ZLIB); Page page = new Page(pdf, Letter.PORTRAIT); Box flag = new Box(85, 85, 64, 32); PDFjet.NET.Path path = new PDFjet.NET.Path(); path.Add(new Point(13.0, 0.0)); path.Add(new Point(15.5, 4.5)); path.Add(new Point(18.0, 3.5)); path.Add(new Point(15.5, 13.5, Point.IS_CURVE_POINT)); path.Add(new Point(15.5, 13.5, Point.IS_CURVE_POINT)); path.Add(new Point(20.5, 7.5, Point.IS_CURVE_POINT)); path.Add(new Point(21.0, 9.5)); path.Add(new Point(25.0, 9.0)); path.Add(new Point(24.0, 13.0)); path.Add(new Point(25.5, 14.0)); path.Add(new Point(19.0, 19.0)); path.Add(new Point(20.0, 21.5)); path.Add(new Point(13.5, 20.5)); path.Add(new Point(13.5, 27.0)); path.Add(new Point(12.5, 27.0)); path.Add(new Point(12.5, 20.5)); path.Add(new Point( 6.0, 21.5)); path.Add(new Point( 7.0, 19.0)); path.Add(new Point( 0.5, 14.0)); path.Add(new Point( 2.0, 13.0)); path.Add(new Point( 1.0, 9.0)); path.Add(new Point( 5.0, 9.5)); path.Add(new Point( 5.5, 7.5)); path.Add(new Point(10.5, 13.5, Point.IS_CURVE_POINT)); path.Add(new Point(10.5, 13.5, Point.IS_CURVE_POINT)); path.Add(new Point( 8.0, 3.5, Point.IS_CURVE_POINT)); path.Add(new Point(10.5, 4.5)); path.setClosePath(true); path.SetColor(RGB.RED); path.SetFillShape(true); path.PlaceIn(flag, 19.0, 3.0); path.DrawOn(page); Box box = new Box(); box.SetSize(16, 32); box.SetColor(RGB.RED); box.SetFillShape(true); box.PlaceIn(flag, 0.0, 0.0); box.DrawOn(page); box.PlaceIn(flag, 48.0, 0.0); box.DrawOn(page); path.ScaleBy(15.0); path.SetFillShape(false); path.DrawOn(page); pdf.Flush(); bos.Close(); }