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


C# PdfContentByte.SetGState方法代碼示例

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


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

示例1: AddWaterMarkText

        private static void AddWaterMarkText(PdfContentByte directContent, string textWatermark, BaseFont font, float fontSize, float angle, BaseColor color, Rectangle realPageSize)
        {
            var gstate = new PdfGState { FillOpacity = 0.2f, StrokeOpacity = 0.2f };

            directContent.SaveState();
            directContent.SetGState(gstate);
            directContent.SetColorFill(color);
            directContent.BeginText();
            directContent.SetFontAndSize(font, fontSize);

            var x = (realPageSize.Right + realPageSize.Left) / 2;
            var y = (realPageSize.Bottom + realPageSize.Top) / 2;

            directContent.ShowTextAligned(Element.ALIGN_CENTER, textWatermark, x, y, angle);
            directContent.EndText();
            directContent.RestoreState();
        }
開發者ID:fabiohvp,項目名稱:DocumentSigner,代碼行數:17,代碼來源:PdfHelper.cs

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

示例3: PictureCircles

 /**
  * Prints 3 circles in different colors that intersect with eachother.
  *
  * @param x
  * @param y
  * @param cb
  * @throws Exception
  */
 private void PictureCircles(float x, float y, PdfContentByte cb, PdfWriter writer) {
     PdfGState gs = new PdfGState();
     gs.BlendMode = PdfGState.BM_MULTIPLY;
     gs.FillOpacity = 1f;
     cb.SetGState(gs);
     cb.SetColorFill(BaseColor.LIGHT_GRAY);
     cb.Circle(x + 75, y + 75, 70);
     cb.Fill();
     cb.Circle(x + 75, y + 125, 70);
     cb.Fill();
     cb.Circle(x + 125, y + 75, 70);
     cb.Fill();
     cb.Circle(x + 125, y + 125, 70);
     cb.Fill();
 }
開發者ID:smartleos,項目名稱:itextsharp,代碼行數:23,代碼來源:PdfA2CheckerTest.cs

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

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

示例6: DrawDiamont

        /// <summary>
        /// Draws the diamont.
        /// </summary>
        /// <param name="content">The content.</param>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        public static void DrawDiamont(PdfContentByte content, float x, float y)
        {
            content.SaveState();
            var state = new PdfGState();
            content.SetGState(state);
            content.SetColorFill(BaseColor.BLACK);
            content.MoveTo(x, y);
            var sPoint = new Point(x, y);
            var uMPoint = new Point(x + WPosMarkerMid, y + HPosMarkerMid);
            var rPoint = new Point(uMPoint.X + WPosMarkerMid, uMPoint.Y - HPosMarkerMid);
            var mPoint = new Point(rPoint.X - WPosMarkerMid, rPoint.Y - HPosMarkerMid);

            DrawLines(content, uMPoint, rPoint, mPoint, sPoint);

            content.ClosePathFillStroke();
            content.RestoreState();
        }
開發者ID:rodrigodealer,項目名稱:external_source,代碼行數:23,代碼來源:Program.cs

示例7: PictureCircles

// ---------------------------------------------------------------------------
    /**
     * Prints 3 circles in different colors that intersect with eachother.
     * 
     * @param x
     * @param y
     * @param cb
     * @throws Exception
     */
    public static void PictureCircles(float x, float y, PdfContentByte cb) {
      PdfGState gs = new PdfGState();
      gs.BlendMode = PdfGState.BM_MULTIPLY;
      gs.FillOpacity = 1f;
      cb.SetGState(gs);
      cb.SetColorFill(new CMYKColor(0f, 0f, 0f, 0.15f));
      cb.Circle(x + 75, y + 75, 70);
      cb.Fill();
      cb.Circle(x + 75, y + 125, 70);
      cb.Fill();
      cb.Circle(x + 125, y + 75, 70);
      cb.Fill();
      cb.Circle(x + 125, y + 125, 70);
      cb.Fill();
    }
開發者ID:,項目名稱:,代碼行數:24,代碼來源:

示例8: WriteTextToDocument

        private static void WriteTextToDocument(BaseFont bf,Rectangle tamPagina,
            PdfContentByte over,PdfGState gs,string texto)
        {
            over.SetGState(gs);

            over.SetRGBColorFill(220, 220, 220);

            over.SetTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE);

            over.SetFontAndSize(bf, 46);

            Single anchoDiag =

                (Single)Math.Sqrt(Math.Pow((tamPagina.Height - 120), 2)

                + Math.Pow((tamPagina.Width - 60), 2));

            Single porc = (Single)100

                * (anchoDiag / bf.GetWidthPoint(texto, 46));

            over.SetHorizontalScaling(porc);

            double angPage = (-1)

            * Math.Atan((tamPagina.Height - 60) / (tamPagina.Width - 60));

            over.SetTextMatrix((float)Math.Cos(angPage),

                       (float)Math.Sin(angPage),

                       (float)((-1F) * Math.Sin(angPage)),

                       (float)Math.Cos(angPage),

                       30F,

                       (float)tamPagina.Height - 60);

            over.ShowText(texto);
        }
開發者ID:bulbix,項目名稱:adquisiciones,代碼行數:41,代碼來源:ReportePedido.cs


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