當前位置: 首頁>>代碼示例>>C#>>正文


C# PdfContentByte.SetLineWidth方法代碼示例

本文整理匯總了C#中iTextSharp.text.pdf.PdfContentByte.SetLineWidth方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfContentByte.SetLineWidth方法的具體用法?C# PdfContentByte.SetLineWidth怎麽用?C# PdfContentByte.SetLineWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.pdf.PdfContentByte的用法示例。


在下文中一共展示了PdfContentByte.SetLineWidth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: DrawTimeTable

        // ---------------------------------------------------------------------------    
        /**
         * Draws the time table for a day at the film festival.
         * @param directcontent a canvas to which the time table has to be drawn.
         */
        protected void DrawTimeTable(PdfContentByte directcontent)
        {
            directcontent.SaveState();
            directcontent.SetLineWidth(1.2f);
            float llx, lly, urx, ury;

            llx = OFFSET_LEFT;
            lly = OFFSET_BOTTOM;
            urx = OFFSET_LEFT + WIDTH;
            ury = OFFSET_BOTTOM + HEIGHT;
            directcontent.MoveTo(llx, lly);
            directcontent.LineTo(urx, lly);
            directcontent.LineTo(urx, ury);
            directcontent.LineTo(llx, ury);
            directcontent.ClosePath();
            directcontent.Stroke();

            llx = OFFSET_LOCATION;
            lly = OFFSET_BOTTOM;
            urx = OFFSET_LOCATION + WIDTH_LOCATION;
            ury = OFFSET_BOTTOM + HEIGHT;
            directcontent.MoveTo(llx, lly);
            directcontent.LineTo(urx, lly);
            directcontent.LineTo(urx, ury);
            directcontent.LineTo(llx, ury);
            directcontent.ClosePathStroke();

            directcontent.SetLineWidth(1);
            directcontent.MoveTo(
              OFFSET_LOCATION + WIDTH_LOCATION / 2, OFFSET_BOTTOM
            );
            directcontent.LineTo(
              OFFSET_LOCATION + WIDTH_LOCATION / 2, OFFSET_BOTTOM + HEIGHT
            );
            float y;
            for (int i = 1; i < LOCATIONS; i++)
            {
                y = OFFSET_BOTTOM + (i * HEIGHT_LOCATION);
                if (i == 2 || i == 6)
                {
                    directcontent.MoveTo(OFFSET_LOCATION, y);
                    directcontent.LineTo(OFFSET_LOCATION + WIDTH_LOCATION, y);
                }
                else
                {
                    directcontent.MoveTo(OFFSET_LOCATION + WIDTH_LOCATION / 2, y);
                    directcontent.LineTo(OFFSET_LOCATION + WIDTH_LOCATION, y);
                }
                directcontent.MoveTo(OFFSET_LEFT, y);
                directcontent.LineTo(OFFSET_LEFT + WIDTH, y);
            }
            directcontent.Stroke();
            directcontent.RestoreState();
        }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:59,代碼來源:MovieTimeTable.cs

示例2: 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

示例3: CreatePdfBox

	private void CreatePdfBox(PdfContentByte content, Configuration.PrintTemplateContentRow row, bool allowFill)
	{
		if (row.IsFillColorNull() && row.IsOutlineWidthNull() && row.IsOutlineColorNull())
		{
			return;
		}

		bool hasFill = false;
		bool hasStroke = false;

		content.SetLineWidth((1 / PixelsPerInch) * PointsPerInch);

		if (!row.IsFillColorNull() && allowFill)
		{
			System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml(row.FillColor);
			content.SetRGBColorFill(c.R, c.G, c.B);
			hasFill = true;
		}

		if (!row.IsOutlineWidthNull())
		{
			content.SetLineWidth((Convert.ToSingle(row.OutlineWidth) / PixelsPerInch) * PointsPerInch);
			hasStroke = true;
		}

		if (!row.IsOutlineColorNull())
		{
			System.Drawing.Color c = System.Drawing.ColorTranslator.FromHtml(row.OutlineColor);
			content.SetRGBColorStroke(c.R, c.G, c.B);
			hasStroke = true;
		}

		float originX = Convert.ToSingle(row.OriginX) * PointsPerInch;
		float originY = Convert.ToSingle(row.OriginY) * PointsPerInch;
		float width = Convert.ToSingle(row.Width) * PointsPerInch;
		float height = Convert.ToSingle(row.Height) * PointsPerInch;

		if (hasFill)
		{
			content.Rectangle(originX, originY, width, height);
			content.Fill();
		}

		if (hasStroke)
		{
			content.Rectangle(originX, originY, width, height);
			content.Stroke();
		}
	}
開發者ID:ClaireBrill,項目名稱:GPV,代碼行數:49,代碼來源:PdfMap.cs

示例4: 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

示例5: DirectDrawReport

        private void DirectDrawReport(PdfContentByte canvas)
        {
            //畫線
            canvas.SaveState();
            canvas.SetLineWidth(2f);
            canvas.MoveTo(100, 100);
            canvas.LineTo(200, 200);
            canvas.Stroke();
            canvas.RestoreState();

            //文本
            ColumnText.ShowTextAligned(canvas, Element.ALIGN_RIGHT, new Phrase("JulyLuo測試", new Font(BF_Light, 10)), 100, 20, 0);
        }
開發者ID:GitForShadow,項目名稱:PersonalProfile,代碼行數:13,代碼來源:ReportDemo.cs

示例6: Render_BackBase

        private static void Render_BackBase(PdfContentByte under)
        {
            // Y relative to card top, line width, <repeat>
            float[] measures = new[] { 37, 3f, 144, 1.5f };

            under.SaveState();
            for (int i = 0; i < measures.Length / 2; i++)
            {
                under.SetLineWidth(measures[i * 2 + 1]);
                under.MoveTo(0, CARD_HEIGHT - measures[i * 2]);
                under.LineTo(CARD_WIDTH, CARD_HEIGHT - measures[i * 2]);
                under.Stroke();
            }

            under.SetFontAndSize(baseFont, 7);
            under.ShowTextAlignedKerned(Element.ALIGN_CENTER, "If found, please call KCSAR at (206) 205-8226", CARD_WIDTH / 2, 7, 0);

            under.RestoreState();
        }
開發者ID:mattkur,項目名稱:KCSARA-Database,代碼行數:19,代碼來源:BadgeService.cs

示例7: Render

        /// <summary>
        /// Renders the object in a document using a <see cref="PdfContentByte"/> by invoking the <see cref="Render(ContentWriter, Vector2D)"/> method.
        /// This method can be overridden in derived classes to specify rendering.
        /// </summary>
        /// <param name="cb">The <see cref="PdfContentByte"/> used for rendering.</param>
        /// <param name="offset">The calculated offset for the rendered item.</param>
        protected internal virtual void Render(PdfContentByte cb, Vector2D offset)
        {
            using (var writer = new ContentWriter(cb))
            {
                var stroke = this as StrokeObject;
                var fill = this as FillObject;

                bool hasstroke = stroke?.BorderColor.HasValue ?? false;
                bool hasfill = fill?.FillColor.HasValue ?? false;

                if (hasstroke)
                {
                    cb.SetLineWidth((float)stroke.BorderWidth.Value(UnitsOfMeasure.Points));
                    cb.SetColorStroke(new Color(stroke.BorderColor.Value));
                }
                if (hasfill)
                    cb.SetColorFill(new Color(fill.FillColor.Value));

                Render(writer, offset);

                if (hasstroke && hasfill)
                {
                    if (writer.CloseShape)
                        cb.ClosePathFillStroke();
                    else
                        cb.FillStroke();
                }
                else if (hasstroke)
                {
                    if (writer.CloseShape)
                        cb.ClosePathStroke();
                    else
                        cb.Stroke();
                }
                else if (hasfill)
                    cb.Fill();
            }
        }
開發者ID:deaddog,項目名稱:DeadDog.PDF,代碼行數:44,代碼來源:LeafObject.cs

示例8: PictureBackdrop

 /**
  * Prints a square and fills half of it with a gray rectangle.
  *
  * @param x
  * @param y
  * @param cb
  * @throws Exception
  */
 private void PictureBackdrop(float x, float y, PdfContentByte cb) {
     cb.SetColorStroke(BaseColor.BLACK);
     cb.SetColorFill(BaseColor.LIGHT_GRAY);
     cb.Rectangle(x, y, 100, 200);
     cb.Fill();
     cb.SetLineWidth(2);
     cb.Rectangle(x, y, 200, 200);
     cb.Stroke();
 }
開發者ID:smartleos,項目名稱:itextsharp,代碼行數:17,代碼來源:PdfA2CheckerTest.cs

示例9: DrawPageBorder

        /// <summary>
        /// Draws the page border.
        /// </summary>
        /// <param name="writer"> </param>
        /// <param name="document"> </param>
        /// <param name="canvas"> </param>
        /// <returns></returns>
        protected void DrawPageBorder(PdfWriter writer, Document document, PdfContentByte canvas)
        {
            var pageBorderRect = new Rectangle(document.PageSize);
            var content = writer.DirectContent;

            pageBorderRect.Left += document.LeftMargin - BorderDifference;
            pageBorderRect.Right -= document.RightMargin - BorderDifference;
            pageBorderRect.Top -= document.TopMargin - BorderDifference;
            pageBorderRect.Bottom += document.BottomMargin - BorderDifference;
            content.SetColorStroke(BaseColor.BLACK);
            canvas.SetLineWidth(FillOpacity);
            canvas.SetRGBColorStroke(0, 0, 0);
            canvas.SetLineDash(6f, 6f, 0f);
            content.Rectangle(pageBorderRect.Left, pageBorderRect.Bottom, pageBorderRect.Width, pageBorderRect.Height);
            content.Stroke();
        }
開發者ID:rodrigodealer,項目名稱:external_source,代碼行數:23,代碼來源:Program.cs

示例10: DrawUpperRectangle

        public static Point DrawUpperRectangle(PdfContentByte content, Rectangle pageRect, float barSize)
        {
            content.SaveState();
            var state = new PdfGState {FillOpacity = FillOpacity};
            content.SetGState(state);
            content.SetColorFill(BaseColor.BLACK);

            content.SetLineWidth(0);
            var result = new Point(SideBorder + BorderPage,
                                   pageRect.Height - (BorderPage + LeaderEdge + BarHeight + 1));
            content.Rectangle(result.X, result.Y, barSize, BarHeight);
            content.ClosePathFillStroke();
            content.RestoreState();
            return result;
        }
開發者ID:rodrigodealer,項目名稱:external_source,代碼行數:15,代碼來源:Program.cs

示例11: DrawSquare

        public static void DrawSquare(PdfContentByte content, Point point, System.Data.IDataReader reader)
        {
            content.SaveState();
            var state = new PdfGState {FillOpacity = FillOpacity};
            content.SetGState(state);
            var color = new CMYKColor(reader.GetFloat(1), reader.GetFloat(2), reader.GetFloat(3), reader.GetFloat(4));
            content.SetColorFill(color);

            content.SetLineWidth(0);
            content.Rectangle(point.X, point.Y, PatchSize, PatchSize);
            content.Fill();
            content.RestoreState();
        }
開發者ID:rodrigodealer,項目名稱:external_source,代碼行數:13,代碼來源:Program.cs

示例12: DrawRectangle

 // ---------------------------------------------------------------------------    
 /**
  * Draws a rectangle
  * @param content the direct content layer
  * @param width the width of the rectangle
  * @param height the height of the rectangle
  */
 public static void DrawRectangle(
   PdfContentByte content, float width, float height)
 {
     content.SaveState();
     PdfGState state = new PdfGState();
     state.FillOpacity = 0.6f;
     content.SetGState(state);
     content.SetRGBColorFill(0xFF, 0xFF, 0xFF);
     content.SetLineWidth(3);
     content.Rectangle(0, 0, width, height);
     content.FillStroke();
     content.RestoreState();
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:20,代碼來源:Layers.cs

示例13: PrintTerms


//.........這裏部分代碼省略.........
                }

                PdfContentByte cb = writer.DirectContent;
                ColumnText ct = new ColumnText(cb);

                int[] left = {
                    Convert.ToInt32(Column1Left * ppi),
                    Convert.ToInt32(Column2Left * ppi)
                };
                int[] right = {
                    Convert.ToInt32(Column1Right * ppi),
                    Convert.ToInt32(Column2Right * ppi)
                };

                foreach (var term in terms) {
                    ct.AddText(new Phrase(term.Term.Trim() + Environment.NewLine, fntTerm));
                    ct.AddText(new Phrase(Regex.Replace(term.Definition.Trim().Replace("<br/>", "\r"), @"<[^>]+>", "") + Environment.NewLine + Environment.NewLine, fntDefinition));
                }

                int status = 0;
                int column = 0;
                int PageNumber = 0;
                if (HasMultipleDefinitions) {
                    PageNumber = 3;
                } else {
                    PageNumber = 1;
                }
                while ((status & ColumnText.NO_MORE_TEXT) == 0) {
                    ///////////////////////////////////////////

                    PdfContentByte cbPage = new PdfContentByte(writer);
                    cbPage = writer.DirectContent;

                    cbPage.SetLineWidth(0.5f);
                    cbPage.SetRGBColorStroke(50, 50, 50);
                    cbPage.MoveTo(LeftRightMargin * ppi, (PageHeight - TopBottomMargin - (HeaderFooterHeight / 2)) * ppi);
                    cbPage.LineTo((PageWidth - LeftRightMargin) * ppi, (PageHeight - TopBottomMargin - (HeaderFooterHeight / 2)) * ppi);
                    cbPage.Stroke();

                    cbPage.SetLineWidth(0.5f);
                    cbPage.SetRGBColorStroke(50, 50, 50);
                    cbPage.MoveTo(LeftRightMargin * ppi, (TopBottomMargin + HeaderFooterHeight) * ppi);
                    cbPage.LineTo((PageWidth - LeftRightMargin) * ppi, (TopBottomMargin + HeaderFooterHeight) * ppi);
                    cbPage.Stroke();

                    cbPage.BeginText();

                    cbPage.SetFontAndSize(bfGaramond, 10);
                    cbPage.SetRGBColorFill(0, 0, 0);
                    cbPage.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "The Glossary of Systematic Christian Theology", (PageWidth / 2) * ppi, (PageHeight - TopBottomMargin) * ppi, 0);

                    if (PageNumber % 2 == 0) {
                        cbPage.SetFontAndSize(bfGaramond, 8);
                        cbPage.SetRGBColorFill(0, 0, 0);
                        cbPage.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "© 1971-" + DateTime.Today.Year.ToString() + " Dr. Ron Killingsworth, Rephidim Doctrinal Bible Studies, Inc.", (PageWidth - LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);

                        cbPage.SetFontAndSize(bfGaramond, 8);
                        cbPage.SetRGBColorFill(0, 0, 0);
                        cbPage.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Page " + PageNumber.ToString(), (LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);
                    } else {
                        cbPage.SetFontAndSize(bfGaramond, 8);
                        cbPage.SetRGBColorFill(0, 0, 0);
                        cbPage.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "© 1971-" + DateTime.Today.Year.ToString() + " Dr. Ron Killingsworth, Rephidim Doctrinal Bible Studies, Inc.", (LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);

                        cbPage.SetFontAndSize(bfGaramond, 8);
                        cbPage.SetRGBColorFill(0, 0, 0);
開發者ID:jslaybaugh,項目名稱:rephidim-web,代碼行數:67,代碼來源:GlossaryController.cs

示例14: DrawTimeSlots

// ---------------------------------------------------------------------------    
    /**
     * Draws the time slots for a day at the film festival.
     * @param directcontent the canvas to which the time table has to be drawn.
     */
    protected void DrawTimeSlots(PdfContentByte directcontent) {
      directcontent.SaveState();
      float x;
      for (int i = 1; i < TIMESLOTS; i++) {
        x = OFFSET_LEFT + (i * WIDTH_TIMESLOT);
        directcontent.MoveTo(x, OFFSET_BOTTOM);
        directcontent.LineTo(x, OFFSET_BOTTOM + HEIGHT);
      }
      directcontent.SetLineWidth(0.3f);
      directcontent.SetColorStroke(BaseColor.GRAY);
      directcontent.SetLineDash(3, 1);
      directcontent.Stroke();
      directcontent.RestoreState();
    }    
開發者ID:,項目名稱:,代碼行數:19,代碼來源:

示例15: WriteLine

        internal void WriteLine(PdfLine line, PdfContentByte text, PdfContentByte graphics)
        {
            PdfFont currentFont = null;
            foreach(PdfChunk chunk in line) {
                if (chunk.Font.CompareTo(currentFont) != 0) {
                    currentFont = chunk.Font;
                    text.SetFontAndSize(currentFont.Font, currentFont.Size);
                }
                Object[] textRender = (Object[])chunk.GetAttribute(Chunk.TEXTRENDERMODE);
                int tr = 0;
                float strokeWidth = 1;
                BaseColor color = chunk.Color;
                BaseColor strokeColor = null;
                if (textRender != null) {
                    tr = (int)textRender[0] & 3;
                    if (tr != PdfContentByte.TEXT_RENDER_MODE_FILL)
                        text.SetTextRenderingMode(tr);
                    if (tr == PdfContentByte.TEXT_RENDER_MODE_STROKE || tr == PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE) {
                        strokeWidth = (float)textRender[1];
                        if (strokeWidth != 1)
                            text.SetLineWidth(strokeWidth);
                        strokeColor = (BaseColor)textRender[2];
                        if (strokeColor == null)
                            strokeColor = color;
                        if (strokeColor != null)
                            text.SetColorStroke(strokeColor);
                    }
                }

                object charSpace = chunk.GetAttribute(Chunk.CHAR_SPACING);
                // no char space setting means "leave it as is".
                if (charSpace != null && !curCharSpace.Equals(charSpace)) {
                    curCharSpace = (float)charSpace;
                    text.SetCharacterSpacing(curCharSpace);
                }
                if (color != null)
                    text.SetColorFill(color);
                text.ShowText(chunk.ToString());
                if (color != null)
                    text.ResetRGBColorFill();
                if (tr != PdfContentByte.TEXT_RENDER_MODE_FILL)
                    text.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
                if (strokeColor != null)
                    text.ResetRGBColorStroke();
                if (strokeWidth != 1)
                    text.SetLineWidth(1);
            }
        }
開發者ID:mapo80,項目名稱:iTextSharp-Monotouch,代碼行數:48,代碼來源:VerticalText.cs


注:本文中的iTextSharp.text.pdf.PdfContentByte.SetLineWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。