예제 #1
0
파일: PdfWriter.cs 프로젝트: itadapter/nfx
        /// <summary>
        /// Writes PDF rectangle element into file stream
        /// </summary>
        /// <param name="rectangle">PDF rectangle element</param>
        internal void Write(RectangleElement rectangle)
        {
            var x = TextAdapter.FormatFloat(rectangle.X);
              var y = TextAdapter.FormatFloat(rectangle.Y);
              var w = TextAdapter.FormatFloat(rectangle.X1 - rectangle.X);
              var h = TextAdapter.FormatFloat(rectangle.Y1 - rectangle.Y);

              var rectangleContent = new StringBuilder();
              rectangleContent.AppendLine("q");
              rectangleContent.Append(rectangle.Style.ToPdfString());
              rectangleContent.AppendFormatLine("{0} {1} {2} {3} re", x, y, w, h);
              rectangleContent.AppendLine("B");
              rectangleContent.Append("Q");

              writeStreamedObject(rectangle.ObjectId, rectangleContent.ToString());
        }
예제 #2
0
파일: PdfPage.cs 프로젝트: itadapter/nfx
        /// <summary>
        /// Add rectangle primitive to the page
        /// </summary>
        public RectangleElement AddRectangle(float x1, float y1, float x2, float y2, PdfDrawStyle style)
        {
            var rectangle = new RectangleElement(x1, y1, x2, y2, style);
              Add(rectangle);

              return rectangle;
        }