コード例 #1
0
ファイル: SimpleCell.cs プロジェクト: pixelia-es/RazorPDF2
        /**
         * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
         */
        public void CellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases)
        {
            float sp_left = spacing_left;

            if (float.IsNaN(sp_left))
            {
                sp_left = 0f;
            }
            float sp_right = spacing_right;

            if (float.IsNaN(sp_right))
            {
                sp_right = 0f;
            }
            float sp_top = spacing_top;

            if (float.IsNaN(sp_top))
            {
                sp_top = 0f;
            }
            float sp_bottom = spacing_bottom;

            if (float.IsNaN(sp_bottom))
            {
                sp_bottom = 0f;
            }
            Rectangle rect = new Rectangle(position.GetLeft(sp_left), position.GetBottom(sp_bottom), position.GetRight(sp_right), position.GetTop(sp_top));

            rect.CloneNonPositionParameters(this);
            canvases[PdfPTable.BACKGROUNDCANVAS].Rectangle(rect);
            rect.BackgroundColor = null;
            canvases[PdfPTable.LINECANVAS].Rectangle(rect);
        }
コード例 #2
0
ファイル: SimpleCell.cs プロジェクト: pixelia-es/RazorPDF2
 /**
 * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
 */
 public void CellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases)
 {
     float sp_left = spacing_left;
     if (float.IsNaN(sp_left)) sp_left = 0f;
     float sp_right = spacing_right;
     if (float.IsNaN(sp_right)) sp_right = 0f;
     float sp_top = spacing_top;
     if (float.IsNaN(sp_top)) sp_top = 0f;
     float sp_bottom = spacing_bottom;
     if (float.IsNaN(sp_bottom)) sp_bottom = 0f;
     Rectangle rect = new Rectangle(position.GetLeft(sp_left), position.GetBottom(sp_bottom), position.GetRight(sp_right), position.GetTop(sp_top));
     rect.CloneNonPositionParameters(this);
     canvases[PdfPTable.BACKGROUNDCANVAS].Rectangle(rect);
     rect.BackgroundColor = null;
     canvases[PdfPTable.LINECANVAS].Rectangle(rect);
 }
コード例 #3
0
 /**
 * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell, com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
 */
 public void CellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvases)
 {
     if (cellField == null || (fieldWriter == null && parent == null)) throw new ArgumentException("You have used the wrong constructor for this FieldPositioningEvents class.");
     cellField.Put(PdfName.RECT, new PdfRectangle(rect.GetLeft(padding), rect.GetBottom(padding), rect.GetRight(padding), rect.GetTop(padding)));
     if (parent == null)
         fieldWriter.AddAnnotation(cellField);
     else
         parent.AddKid(cellField);
 }
コード例 #4
0
 /**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
 public override void OnGenericTag(PdfWriter writer, Document document,
         Rectangle rect, String text)
 {
     rect.Bottom = rect.Bottom - 3;
     PdfFormField field = (PdfFormField) genericChunkFields[text];
     if (field == null) {
         TextField tf = new TextField(writer, new Rectangle(rect.GetLeft(padding), rect.GetBottom(padding), rect.GetRight(padding), rect.GetTop(padding)), text);
         tf.FontSize = 14;
         field = tf.GetTextField();
     }
     else {
         field.Put(PdfName.RECT,  new PdfRectangle(rect.GetLeft(padding), rect.GetBottom(padding), rect.GetRight(padding), rect.GetTop(padding)));
     }
     if (parent == null)
         writer.AddAnnotation(field);
     else
         parent.AddKid(field);
 }
コード例 #5
0
 /// <summary>
 /// Returns the upper right y-coordinate, considering a given margin.
 /// </summary>
 /// <param name="margin">a margin</param>
 /// <returns>the upper right y-coordinate</returns>
 public float GetTop(float margin)
 {
     return(pageSize.GetTop(marginTop + margin));
 }