Пример #1
0
        /// <summary>
        /// Generates a new Area inside the base one specifing the width difference.
        /// </summary>
        /// <param name="Difference">the Width difference of the inner Area</param>
        /// <returns></returns>
        public PdfArea InnerArea(double Difference)
        {
            this.PdfDocument = PdfDocument;
            if (Difference < 0)
            {
                throw new Exception("Difference must be non negative.");
            }
            PdfArea pa = this.MemberwiseClone() as PdfArea;

            pa.width  -= (double)Difference;
            pa.Height -= (double)Difference;
            pa.posx   += (double)Difference / 2;
            pa.posy   += (double)Difference / 2;
            return(pa);
        }
Пример #2
0
        internal void SetArea()
        {
            this.area = this.CellArea(startRow, 0).Merge(this.CellArea(endRow, 0));

            double great = 0;

            foreach (PdfArea pa in this.cellAreas.Values)
            {
                double d = pa.BottomRightCornerX;
                if (d > great)
                {
                    great = d;
                }
            }
            this.area.BottomRightCornerX = great;
        }
Пример #3
0
        /// <summary>
        /// Creates the TablePage, the rasterized page of a Table.
        /// </summary>
        /// <param name="PageArea"></param>
        /// <returns></returns>
        public PdfTablePage CreateTablePage(PdfArea PageArea)
        {
            this.TableArea = PageArea.Clone();
            PdfTablePage ptp;

            if (!this.visibleHeaders)
            {
                ptp = this.createTablePage();
            }
            else
            {
                this.header.TableArea = PageArea.Clone();
                double headerHeight = this.HeadersRow.Height;
                this.header.TableArea.height = headerHeight;
                this.TableArea.posy         += headerHeight;
                this.TableArea.height       -= headerHeight;

                this.TableArea.height = this.TableArea.height * 1.0000001;

                ptp = this.createTablePage();


                ByteBuffer byteBuffer = new ByteBuffer();
                byteBuffer.Append(ptp.byteStream);

                if (this.visibleHeaders)
                {
                    byteBuffer.Append(this.header.createTablePage().byteStream);
                }

                ptp.byteStream = byteBuffer.ToByteArray();

                this.header.renderingIndex = 0;
            }


            foreach (PdfColumn pc in this.Columns)
            {
                pc.CompensatedWidth = -1;
            }
            foreach (PdfColumn pc in this.header.Columns)
            {
                pc.CompensatedWidth = -1;
            }
            return(ptp);
        }
Пример #4
0
        /// <summary>
        /// Generates a new Area outside the base one specifing the width difference.
        /// </summary>
        /// <param name="WidthDifference">the Width difference of the inner Area</param>
        /// <param name="HeightDifference">the Height difference of the inner Area</param>
        /// <returns></returns>
        public PdfArea OuterArea(double WidthDifference, double HeightDifference)
        {
            if (WidthDifference < 0)
            {
                throw new Exception("WidthDifference must be non negative.");
            }
            if (HeightDifference < 0)
            {
                throw new Exception("HeightDifference must be non negative.");
            }
            PdfArea pa = this.MemberwiseClone() as PdfArea;

            pa.width  += (double)WidthDifference;
            pa.Height += (double)HeightDifference;
            pa.posx   -= (double)WidthDifference / 2;
            pa.posy   -= (double)HeightDifference / 2;
            return(pa);
        }
Пример #5
0
		/// <summary>
		/// creates a new PdfTextArea
		/// </summary>
		/// <param name="Font">the font that will be used</param>
		/// <param name="Color">the color of the font that will be used</param>
		/// <param name="TextArea">the estabilished area for the Text</param>
		/// <param name="PdfTextAlign">the ContentAlignment for the Text inside the area</param>
		/// <param name="Text">the text that will be written inside the area</param>
		public PdfTextArea(System.Drawing.Font Font,Color Color, PdfArea TextArea, HorizontalAlignment horAlignment, VerticalAlignment verAlignment, string Text, bool vertical)
		{
			if (Text==null) throw new Exception("Text cannot be null.");
			// setting fonts
			this.font = new Font(Font.FontFamily, Font.Size*0.96f, Font.Style);			

			this.foregroundColor = Color;
			this.textArea = TextArea;
			this.text=Text;
			this.horizontalAlignment = horAlignment;
			this.verticalAlignment = verAlignment;

			//this.lineHeight = (double)(Font.Size);
			this.lineHeight = (double)(this.font.Size);			
								
			this.vertical = vertical;
			this.pdfFont = this.PdfDocument.AddFont(this.font);

			if (this.pdfFont.PdfFontType == PdfFont.FontType.TrueType)
			{
				((PdfTrueTypeFont)pdfFont).CalculateMetrics(this.text);
			}

		}
Пример #6
0
		public PdfTextArea(System.Drawing.Font Font,Color Color,PdfArea TextArea, HorizontalAlignment horAlignment, VerticalAlignment verAlignment, string Text):this(Font,Color,TextArea, horAlignment, verAlignment, Text, false)
		{
		}
Пример #7
0
 /// <summary>
 /// creates a new rectangle
 /// </summary>
 /// <param name="RectangleArea"></param>
 /// <param name="BorderColor"></param>
 /// <param name="FillingColor"></param>
 public PdfRectangle(PdfDocument PdfDocument, PdfArea RectangleArea, Color BorderColor, Color FillingColor) : this(PdfDocument, RectangleArea, BorderColor, 0, FillingColor)
 {
 }
Пример #8
0
 /// <summary>
 /// creates a new rectangle
 /// </summary>
 /// <param name="RectangleArea"></param>
 /// <param name="BorderColor"></param>
 /// <param name="BorderWidth"></param>
 public PdfRectangle(PdfDocument PdfDocument, PdfArea RectangleArea, Color BorderColor, double BorderWidth) : this(PdfDocument, RectangleArea, BorderColor, BorderWidth, Color.Transparent)
 {
 }