• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# pdf.PdfContentByte类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中iTextSharp.text.pdf.PdfContentByte的典型用法代码示例。如果您正苦于以下问题:C# PdfContentByte类的具体用法?C# PdfContentByte怎么用?C# PdfContentByte使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PdfContentByte类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfContentByte类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateStarsAndCircles

 // ---------------------------------------------------------------------------
 /**
  * Draws a row of stars and circles.
  * @param canvas the canvas to which the shapes have to be drawn
  * @param x      X coordinate to position the row
  * @param y      Y coordinate to position the row
  * @param radius the radius of the circles
  * @param gutter the space between the shapes
  */
 public static void CreateStarsAndCircles(PdfContentByte canvas,
 float x, float y, float radius, float gutter)
 {
     canvas.SaveState();
       canvas.SetColorStroke(new GrayColor(0.2f));
       canvas.SetColorFill(new GrayColor(0.9f));
       CreateStar(canvas, x, y);
       CreateCircle(canvas, x + radius, y - 70, radius, true);
       CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
       canvas.Fill();
       x += 2 * radius + gutter;
       CreateStar(canvas, x, y);
       CreateCircle(canvas, x + radius, y - 70, radius, true);
       CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
       canvas.EoFill();
       x += 2 * radius + gutter;
       CreateStar(canvas, x, y);
       canvas.NewPath();
       CreateCircle(canvas, x + radius, y - 70, radius, true);
       CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
       x += 2 * radius + gutter;
       CreateStar(canvas, x, y);
       CreateCircle(canvas, x + radius, y - 70, radius, true);
       CreateCircle(canvas, x + radius, y - 70, radius / 2, false);
       canvas.FillStroke();
       x += 2 * radius + gutter;
       CreateStar(canvas, x, y);
       CreateCircle(canvas, x + radius, y - 70, radius, true);
       CreateCircle(canvas, x + radius, y - 70, radius / 2, true);
       canvas.EoFillStroke();
       canvas.RestoreState();
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:41,代码来源:PathConstructionAndPainting.cs


示例2: CellLayout

// ---------------------------------------------------------------------------    
    /** Implementation of the cellLayout method. */
    public void CellLayout(
        PdfPCell cell, Rectangle position, PdfContentByte[] canvases) 
    {
      writer.DirectContent.LocalDestination(
        name,
        new PdfDestination(PdfDestination.FITH, position.Top)
      );
    }
开发者ID:,项目名称:,代码行数:10,代码来源:


示例3: Draw

 /**
 * @see com.lowagie.text.pdf.draw.DrawInterface#draw(com.lowagie.text.pdf.PdfContentByte, float, float, float, float, float)
 */
 public override void Draw(PdfContentByte canvas, float llx, float lly, float urx, float ury, float y) {
     canvas.SaveState();
     canvas.SetLineWidth(lineWidth);
     canvas.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
     canvas.SetLineDash(0, gap, gap / 2);
     DrawLine(canvas, llx, urx, y);
     canvas.RestoreState();
 }
开发者ID:yu0410aries,项目名称:itextsharp,代码行数:11,代码来源:DottedLineSeparator.cs


示例4: DrawRectangles

// ---------------------------------------------------------------------------    
    /**
     * Draws three rectangles
     * @param canvas
     */
    public void DrawRectangles(PdfContentByte canvas) {
      canvas.SaveState();
      canvas.SetGrayFill(0.9f);
      canvas.Rectangle(33, 592, 72, 72);
      canvas.Rectangle(263, 406, 72, 72);
      canvas.Rectangle(491, 168, 72, 72);
      canvas.FillStroke();
      canvas.RestoreState();
    }    
开发者ID:,项目名称:,代码行数:14,代码来源:


示例5: CellLayout

 public void CellLayout(PdfPCell cell, Rectangle rectangle, PdfContentByte[] canvases)
 {
     PdfWriter writer = canvases[0].PdfWriter;
     TextField text = new TextField(
         writer, rectangle, FieldName ?? AddBase64Image.NAME
     );
     PdfFormField field = text.GetTextField();
     writer.AddAnnotation(field);
 }
开发者ID:kuujinbo,项目名称:StackOverflow.iTextSharp,代码行数:9,代码来源:AddBase64Image.cs


示例6: Ellipse

 public void Ellipse(PdfContentByte content, Rectangle rect) {
   content.SaveState();
   content.SetRGBColorFill(0x00, 0x00, 0xFF);
   content.Ellipse(
     rect.Left - 3f, rect.Bottom - 5f,
     rect.Right + 3f, rect.Top + 3f
   );
   content.Fill();
   content.RestoreState();
 }
开发者ID:,项目名称:,代码行数:10,代码来源:


示例7: ContentWriter

        internal ContentWriter(PdfContentByte cb)
        {
            if (cb == null)
                throw new ArgumentNullException(nameof(cb));

            this.cb = cb;
        }
开发者ID:deaddog,项目名称:DeadDog.PDF,代码行数:7,代码来源:ContentWriter.cs


示例8: PdfFooter

 private static PdfTemplate PdfFooter(PdfContentByte cb)
 {
     // Create the template and assign height
     PdfTemplate tmpFooter = cb.CreateTemplate(580, 70);
     // Move to the bottom left corner of the template
     tmpFooter.MoveTo(1, 1);
     // Place the footer content
     tmpFooter.Stroke();
     // Begin writing the footer
     tmpFooter.BeginText();
     // Set the font and size
     tmpFooter.SetFontAndSize(_baseFont, 8);
     // Write out details from the payee table
     tmpFooter.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "De facturen zijn contant betaalbaar te Tielt of op rekeningnummer", cb.PdfWriter.PageSize.Width / 2, 45, 0);
     tmpFooter.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "733-0318587-69 bij KBC of 001-6090654-03 bij BNP Paribas Fortis", cb.PdfWriter.PageSize.Width / 2, 35, 0);
     tmpFooter.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Alle klachten dienen binnen de 24 uren, na de uitgevoerde werken schriftelijk medegedeeld te worden.", cb.PdfWriter.PageSize.Width / 2, 25, 0);
     tmpFooter.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Bij geschillen is enkel de rechtbank van Brugge bevoegd.", cb.PdfWriter.PageSize.Width / 2, 15, 0);
     // End text
     tmpFooter.EndText();
     // Stamp a line above the page footer
     cb.SetLineWidth(0f);
     cb.MoveTo(30, 60);
     cb.LineTo(570, 60);
     cb.Stroke();
     // Return the footer template
     return tmpFooter;
 }
开发者ID:desmetjens,项目名称:DuraFact,代码行数:27,代码来源:FactuurHelper.cs


示例9: CheckmarkImage

        /// <summary>
        /// A vector checkmark image's definition
        /// </summary>
        /// <param name="contentByte">drawing canvas</param>
        /// <param name="color">fill color</param>
        /// <returns>a vector image</returns>
        public static Image CheckmarkImage(PdfContentByte contentByte, System.Drawing.Color color)
        {
            var template = contentByte.CreateTemplate(260, 260);

            template.MoveTo(38.33889376f, 67.35513328f);
            template.CurveTo(39.90689547f, 67.35509017f, 41.09296342f, 66.03921993f, 41.89711165f, 63.40748424f);
            template.CurveTo(43.50531445f, 58.47289182f, 44.65118131f, 56.00562195f, 45.33470755f, 56.0056459f);
            template.CurveTo(45.85735449f, 56.00562195f, 46.40013944f, 56.41682961f, 46.96305772f, 57.23928802f);
            template.CurveTo(58.2608517f, 75.74384316f, 68.7143666f, 90.71198997f, 78.32362116f, 102.14379168f);
            template.CurveTo(80.81631349f, 105.10443984f, 84.77658911f, 106.58480942f, 90.20445269f, 106.58489085f);
            template.CurveTo(91.49097185f, 106.58480942f, 92.35539361f, 106.46145048f, 92.79773204f, 106.21480444f);
            template.CurveTo(93.23991593f, 105.96799555f, 93.4610547f, 105.65958382f, 93.46113432f, 105.28956447f);
            template.CurveTo(93.4610547f, 104.71379041f, 92.7976618f, 103.58294901f, 91.47094155f, 101.89705463f);
            template.CurveTo(75.95141033f, 82.81670149f, 61.55772504f, 62.66726353f, 48.28984822f, 41.44869669f);
            template.CurveTo(47.36506862f, 39.96831273f, 45.47540199f, 39.22812555f, 42.62081088f, 39.22813992f);
            template.CurveTo(39.72597184f, 39.22812555f, 38.0172148f, 39.35149407f, 37.49457722f, 39.5982407f);
            template.CurveTo(36.12755286f, 40.2150402f, 34.51931728f, 43.36081778f, 32.66987047f, 49.03557823f);
            template.CurveTo(30.57914689f, 55.32711903f, 29.53378743f, 59.27475848f, 29.53381085f, 60.87852533f);
            template.CurveTo(29.53378743f, 62.60558406f, 30.94099884f, 64.27099685f, 33.75542165f, 65.87476369f);
            template.CurveTo(35.48425582f, 66.86164481f, 37.01207517f, 67.35509017f, 38.33889376f, 67.35513328f);

            template.SetRGBColorFill(color.R, color.G, color.B);
            template.Fill();

            var img = Image.GetInstance(template);
            return img;
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:33,代码来源:VectorImages.cs


示例10: ApplyForText

        public void ApplyForText(PdfContentByte cb, IDictionary<String, String> css, Chunk chunk)
        {
            SetStrokeAndFillColor(cb, css);
            SetStrokeAndFill(cb, css);

            try
            {
                Font font = new Font(Font.FontFamily.COURIER, 6, Font.NORMAL, BaseColor.BLACK);

                Font font2 = chunk.Font;

                BaseFont bf2 = font2.BaseFont;
                //BaseFont bf = ;

                if (bf2 == null)
                {
                    cb.SetFontAndSize(font.GetCalculatedBaseFont(false), font2.Size);
                }
                else
                {
                    cb.SetFontAndSize(bf2, font2.Size);
                }
            } catch { }

        }
开发者ID:,项目名称:,代码行数:25,代码来源:


示例11: Draw

	    public void Draw(PdfContentByte cb, IDictionary<String, String> css){
		    CssSvgAppliers.GetInstance().Apply(cb, css);

		    Draw(cb);
    		
		    CssSvgAppliers.GetInstance().Close(cb, css);
	    }	
开发者ID:,项目名称:,代码行数:7,代码来源:


示例12: CellLayout

 /**
  * @see com.itextpdf.text.pdf.PdfPCellEvent#cellLayout(com.itextpdf.text.pdf.PdfPCell,
  *      com.itextpdf.text.Rectangle, com.itextpdf.text.pdf.PdfContentByte[])
  */
 virtual public void CellLayout(PdfPCell cell, Rectangle position,
         PdfContentByte[] canvases) {
     float effectivePadding = styleValues.BorderWidthLeft/2 + styleValues.HorBorderSpacing;
     float x1 = position.Left + effectivePadding;
     if (styleValues.IsLastInRow){
         effectivePadding = styleValues.BorderWidthRight/2 + styleValues.HorBorderSpacing;
     } else {
         effectivePadding = styleValues.BorderWidthRight/2;
     }
     float x2 = position.Right - effectivePadding;
     effectivePadding = styleValues.BorderWidthTop/2 + styleValues.VerBorderSpacing;
     float y1 = position.Top - effectivePadding;
     effectivePadding = styleValues.BorderWidthBottom/2;
     float y2 = position.Bottom + effectivePadding;
     PdfContentByte cb = canvases[PdfPTable.LINECANVAS];
     BaseColor color = styleValues.Background;
     if (color != null) {
         cb.SetColorStroke(color);
         cb.SetColorFill(color);
         cb.Rectangle(x1, y1, x2-x1, y2-y1);
         cb.Fill();
     }
     BaseColor borderColor = styleValues.BorderColorLeft;
     float width = styleValues.BorderWidthLeft;
     if (borderColor != null && width != 0) {
         cb.SetLineWidth(width);
         cb.SetColorStroke(borderColor);
         cb.MoveTo(x1, y1); // start leftUpperCorner
         cb.LineTo(x1, y2); // left
         cb.Stroke();
     }
     borderColor = styleValues.BorderColorBottom;
     width = styleValues.BorderWidthBottom;
     if (borderColor != null && width != 0) {
         cb.SetLineWidth(width);
         cb.SetColorStroke(borderColor);
         cb.MoveTo(x1, y2); // left
         cb.LineTo(x2, y2); // bottom
         cb.Stroke();
     }
     borderColor = styleValues.BorderColorRight;
     width = styleValues.BorderWidthRight;
     if (borderColor != null && width != 0) {
         cb.SetLineWidth(width);
         cb.SetColorStroke(borderColor);
         cb.MoveTo(x2, y2); // bottom
         cb.LineTo(x2, y1); // right
         cb.Stroke();
     }
     borderColor = styleValues.BorderColorTop;
     width = styleValues.BorderWidthTop;
     if (borderColor != null && width != 0) {
         cb.SetLineWidth(width);
         cb.SetColorStroke(borderColor);
         cb.MoveTo(x2, y1); // right
         cb.LineTo(x1, y1); // top
         cb.Stroke();
     }
     cb.ResetRGBColorStroke();
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:64,代码来源:CellSpacingEvent.cs


示例13: CellLayout

 /**
  * @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[] canvas
 )
 {
     PdfContentByte cb = canvas[PdfPTable.BACKGROUNDCANVAS];
     cb.SaveState();
     if (duration < 90)
     {
         cb.SetRGBColorFill(0x7C, 0xFC, 0x00);
     }
     else if (duration > 120)
     {
         cb.SetRGBColorFill(0x8B, 0x00, 0x00);
     }
     else
     {
         cb.SetRGBColorFill(0xFF, 0xA5, 0x00);
     }
     cb.Rectangle(
       rect.Left, rect.Bottom,
       rect.Width * duration / 240, rect.Height
     );
     cb.Fill();
     cb.RestoreState();
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:30,代码来源:RunLengthEvent.cs


示例14: ApplyGradientBackground

        /// <summary>
        /// Draws a rectangular gradient background color.
        /// </summary>
        /// <param name="pdfRowType">Main table's row types</param>
        /// <param name="sharedData">PdfCells Shared Data</param>        
        /// <param name="position">The coordinates of the cell</param>
        /// <param name="canvases">An array of PdfContentByte to add text or graphics</param>
        public static void ApplyGradientBackground(RowType pdfRowType, CellSharedData sharedData, Rectangle position, PdfContentByte[] canvases)
        {
            BaseColor startColor = null;
            BaseColor endColor = null;

            switch (pdfRowType)
            {
                case RowType.HeaderRow:
                    if (sharedData.Template.HeaderBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.HeaderBackgroundColor[0];
                    endColor = sharedData.Template.HeaderBackgroundColor[1];
                    break;
                case RowType.PreviousPageSummaryRow:
                    if (sharedData.Template.PreviousPageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PreviousPageSummaryRowBackgroundColor[1];
                    break;
                case RowType.SummaryRow:
                case RowType.AllGroupsSummaryRow:
                    if (sharedData.Template.SummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.SummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.SummaryRowBackgroundColor[1];
                    break;
                case RowType.PageSummaryRow:
                    if (sharedData.Template.PageSummaryRowBackgroundColor.Count < 2) return;
                    startColor = sharedData.Template.PageSummaryRowBackgroundColor[0];
                    endColor = sharedData.Template.PageSummaryRowBackgroundColor[1];
                    break;
            }

            DrawGradientBackground(position, canvases, startColor, endColor);
        }
开发者ID:VahidN,项目名称:PdfReport,代码行数:39,代码来源:GradientBackground.cs


示例15: DrawLine

 public void DrawLine(
   PdfContentByte cb, float x1, float x2, float y
   )
 {
     cb.MoveTo(x1, y);
     cb.LineTo(x2, y);
     cb.Stroke();
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:8,代码来源:MovieHistory1.cs


示例16: CellLayout

 // ---------------------------------------------------------------------------
 /** Implementation of the cellLayout method. */
 public void CellLayout(
 PdfPCell cell, Rectangle position, PdfContentByte[] canvases)
 {
     writer.AddAnnotation(new PdfAnnotation(
     writer,
     position.Left, position.Bottom, position.Right, position.Top,
     action
       ));
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:11,代码来源:PdfActionEvent.cs


示例17: CreateStar

 // ---------------------------------------------------------------------------
 /**
  * Creates a path for a five pointed star.
  * This method doesn't fill or stroke the star!
  * @param canvas the canvas for which the star is constructed
  * @param x      the X coordinate of the center of the star
  * @param y      the Y coordinate of the center of the star
  */
 public static void CreateStar(PdfContentByte canvas, float x, float y)
 {
     canvas.MoveTo(x + 10, y);
       canvas.LineTo(x + 80, y + 60);
       canvas.LineTo(x, y + 60);
       canvas.LineTo(x + 70, y);
       canvas.LineTo(x + 40, y + 90);
       canvas.ClosePath();
 }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:17,代码来源:PathConstructionAndPainting.cs


示例18: CellLayout

// ---------------------------------------------------------------------------    
    /**
     * @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[] cb)
    {
      parent.AddKid(kid);
      kid.SetWidget(
        new Rectangle(rect.GetLeft(padding), rect.GetBottom(padding),
        rect.GetRight(padding), rect.GetTop(padding)),
        PdfAnnotation.HIGHLIGHT_INVERT
      );
    }
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:17,代码来源:ChildFieldEvent.cs


示例19: RenderPhase

 private static void RenderPhase(int pageNumber, Dictionary<int, Point> locations, PdfContentByte canvas, string phase, Font font)
 {
     Point position;
     locations.TryGetValue(pageNumber, out position);
     if (!position.IsEmpty)
     {
         ColumnText.ShowTextAligned(canvas, Element.ALIGN_LEFT, new Phrase(phase, font), position.X, position.Y, textRotation);
     }
 }
开发者ID:oleksiyo,项目名称:PdfExamples,代码行数:9,代码来源:PdfDocumentWriter.cs


示例20: PdfText

        private static void PdfText(PdfContentByte cb, TextAlignedPdfConfig parms)
        {
            var bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
            cb.SetColorFill(BaseColor.BLACK);
            cb.SetFontAndSize(bf, 18);

            cb.BeginText();
            cb.ShowTextAligned(parms.Alignment, parms.Text, parms.X, parms.Y, parms.Rotation);
            cb.EndText();
        }
开发者ID:watcharayarnu,项目名称:MvcPdfReport,代码行数:10,代码来源:DrawPdfPage.cs



注:本文中的iTextSharp.text.pdf.PdfContentByte类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# pdf.PdfCopy类代码示例发布时间:2022-05-26
下一篇:
C# pdf.PdfChunk类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap