public Example_02() { PDF pdf = new PDF(new BufferedStream( new FileStream("Example_02.pdf", FileMode.Create))); Page page = new Page(pdf, Letter.PORTRAIT); Box flag = new Box(85.0f, 85.0f, 64.0f, 32.0f); PDFjet.NET.Path path = new PDFjet.NET.Path(); path.Add(new Point(13.0f, 0.0f)); path.Add(new Point(15.5f, 4.5f)); path.Add(new Point(18.0f, 3.5f)); path.Add(new Point(15.5f, 13.5f, Point.CONTROL_POINT)); path.Add(new Point(15.5f, 13.5f, Point.CONTROL_POINT)); path.Add(new Point(20.5f, 7.5f)); path.Add(new Point(21.0f, 9.5f)); path.Add(new Point(25.0f, 9.0f)); path.Add(new Point(24.0f, 13.0f)); path.Add(new Point(25.5f, 14.0f)); path.Add(new Point(19.0f, 19.0f)); path.Add(new Point(20.0f, 21.5f)); path.Add(new Point(13.5f, 20.5f)); path.Add(new Point(13.5f, 27.0f)); path.Add(new Point(12.5f, 27.0f)); path.Add(new Point(12.5f, 20.5f)); path.Add(new Point(6.0f, 21.5f)); path.Add(new Point(7.0f, 19.0f)); path.Add(new Point(0.5f, 14.0f)); path.Add(new Point(2.0f, 13.0f)); path.Add(new Point(1.0f, 9.0f)); path.Add(new Point(5.0f, 9.5f)); path.Add(new Point(5.5f, 7.5f)); path.Add(new Point(10.5f, 13.5f, Point.CONTROL_POINT)); path.Add(new Point(10.5f, 13.5f, Point.CONTROL_POINT)); path.Add(new Point(8.0f, 3.5f)); path.Add(new Point(10.5f, 4.5f)); path.SetClosePath(true); path.SetColor(Color.red); path.SetFillShape(true); path.PlaceIn(flag, 19.0f, 3.0f); path.DrawOn(page); Box box = new Box(); box.SetSize(16, 32); box.SetColor(Color.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); float[] xy = path.DrawOn(page); box = new Box(); box.SetLocation(xy[0], xy[1]); box.SetSize(20f, 20f); box.DrawOn(page); pdf.Complete(); }
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(); }
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(); }
public Example_22() { PDF pdf = new PDF(new BufferedStream( new FileStream("Example_22.pdf", FileMode.Create)), Compliance.PDF_UA); Font f1 = new Font(pdf, new FileStream( "fonts/OpenSans/OpenSans-Regular.ttf.stream", FileMode.Open, FileAccess.Read), Font.STREAM); /* * PDF pdf = new PDF(new FileStream("Example_22.pdf", FileMode.Create)); * * Font f1 = new Font(pdf, CoreFont.HELVETICA); */ Page page = new Page(pdf, Letter.PORTRAIT); TextLine text = new TextLine(f1, "Page #1 -> Go to Destination #3."); text.SetGoToAction("dest#3"); text.SetLocation(90f, 50f); page.AddDestination("dest#0", 0f); page.AddDestination("dest#1", text.GetDestinationY()); text.DrawOn(page); page = new Page(pdf, Letter.PORTRAIT); text = new TextLine(f1, "Page #2 -> Go to Destination #3."); text.SetGoToAction("dest#3"); text.SetLocation(90f, 550f); page.AddDestination("dest#2", text.GetDestinationY()); text.DrawOn(page); page = new Page(pdf, Letter.PORTRAIT); text = new TextLine(f1, "Page #3 -> Go to Destination #4."); text.SetGoToAction("dest#4"); text.SetLocation(90f, 700f); page.AddDestination("dest#3", text.GetDestinationY()); text.DrawOn(page); page = new Page(pdf, Letter.PORTRAIT); text = new TextLine(f1, "Page #4 -> Go to Destination #0."); text.SetGoToAction("dest#0"); text.SetLocation(90f, 100f); page.AddDestination("dest#4", text.GetDestinationY()); text.DrawOn(page); text = new TextLine(f1, "Page #4 -> Go to Destination #2."); text.SetGoToAction("dest#2"); text.SetLocation(90f, 200f); text.DrawOn(page); // Create a box with invisible borders Box box = new Box(20f, 20f, 20f, 20f); box.SetColor(Color.white); box.SetGoToAction("dest#0"); box.DrawOn(page); // Create an up arrow and place it in the box PDFjet.NET.Path path = new PDFjet.NET.Path(); path.Add(new Point(10f, 1f)); path.Add(new Point(17f, 9f)); path.Add(new Point(13f, 9f)); path.Add(new Point(13f, 19f)); path.Add(new Point(7f, 19f)); path.Add(new Point(7f, 9f)); path.Add(new Point(3f, 9f)); path.SetClosePath(true); path.SetColor(Color.oldgloryblue); path.SetColor(Color.deepskyblue); path.SetFillShape(true); path.PlaceIn(box); path.DrawOn(page); FileStream fis = new FileStream( "images/up-arrow.png", FileMode.Open, FileAccess.Read); Image image = new Image(pdf, fis, ImageType.PNG); image.SetLocation(40f, 40f); image.SetGoToAction("dest#0"); image.DrawOn(page); pdf.Complete(); }