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


C# PdfContentByte.Clip方法代碼示例

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


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

示例1: WriteSelectedRows

 /**
 * Writes the selected rows to the document.
 * This method clips the columns; this is only important
 * if there are columns with colspan at boundaries.
 * <P>
 * The table event is only fired for complete rows.
 *
 * @param colStart the first column to be written, zero index
 * @param colEnd the last column to be written + 1. If it is -1 all the
 * @param rowStart the first row to be written, zero index
 * @param rowEnd the last row to be written + 1. If it is -1 all the
 * rows to the end are written
 * @param xPos the x write coodinate
 * @param yPos the y write coodinate
 * @param canvas the <CODE>PdfContentByte</CODE> where the rows will
 * be written to
 * @return the y coordinate position of the bottom of the last row
 */
 public float WriteSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos, PdfContentByte canvas)
 {
     if (colEnd < 0)
         colEnd = absoluteWidths.Length;
     colEnd = Math.Min(colEnd, absoluteWidths.Length);
     if (colStart < 0)
         colStart = 0;
     colStart = Math.Min(colStart, absoluteWidths.Length);
     if (colStart != 0 || colEnd != absoluteWidths.Length) {
         float w = 0;
         for (int k = colStart; k < colEnd; ++k)
             w += absoluteWidths[k];
         canvas.SaveState();
         float lx = 0;
         float rx = 0;
         if (colStart == 0)
             lx = 10000;
         if (colEnd == absoluteWidths.Length)
             rx = 10000;
         canvas.Rectangle(xPos - lx, -10000, w + lx + rx, 20000);
         canvas.Clip();
         canvas.NewPath();
     }
     PdfContentByte[] canvases = BeginWritingRows(canvas);
     float y = WriteSelectedRows(colStart, colEnd, rowStart, rowEnd, xPos, yPos, canvases);
     EndWritingRows(canvases);
     if (colStart != 0 || colEnd != absoluteWidths.Length)
         canvas.RestoreState();
     return y;
 }
開發者ID:hjgode,項目名稱:iTextSharpCF,代碼行數:48,代碼來源:PdfPTable.cs

示例2: WriteSelectedRows

        /**
         * Writes the selected rows and columns to the document.
         * This method clips the columns; this is only important
         * if there are columns with colspan at boundaries.
         * The table event is only fired for complete rows.
         *
         * @param colStart  the first column to be written, zero index
         * @param colEnd    the last column to be written + 1. If it is -1 all the
         *                  columns to the end are written
         * @param rowStart  the first row to be written, zero index
         * @param rowEnd    the last row to be written + 1. If it is -1 all the
         *                  rows to the end are written
         * @param xPos      the x write coordinate
         * @param yPos      the y write coordinate
         * @param canvas    the <CODE>PdfContentByte</CODE> where the rows will
         *                  be written to     
         * @return the y coordinate position of the bottom of the last row
         * @param   reusable if set to false, the content in the cells is "consumed";
         * if true, you can reuse the cells, the row, the parent table as many times you want.
         * @since 5.1.0 added the reusable parameter
         */

        virtual public float WriteSelectedRows(int colStart, int colEnd, int rowStart, int rowEnd, float xPos, float yPos,
                                       PdfContentByte canvas, bool reusable)
        {
            int totalCols = NumberOfColumns;
            if (colStart < 0)
                colStart = 0;
            else
                colStart = Math.Min(colStart, totalCols);

            if (colEnd < 0)
                colEnd = totalCols;
            else
                colEnd = Math.Min(colEnd, totalCols);

            bool clip = (colStart != 0 || colEnd != totalCols);

            if (clip)
            {
                float w = 0;
                for (int k = colStart; k < colEnd; ++k)
                    w += absoluteWidths[k];
                canvas.SaveState();
                float lx = (colStart == 0) ? 10000 : 0;
                float rx = (colEnd == totalCols) ? 10000 : 0;
                canvas.Rectangle(xPos - lx, -10000, w + lx + rx, PdfPRow.RIGHT_LIMIT);
                canvas.Clip();
                canvas.NewPath();
            }

            PdfContentByte[] canvases = BeginWritingRows(canvas);
            float y = WriteSelectedRows(colStart, colEnd, rowStart, rowEnd, xPos, yPos, canvases, reusable);
            EndWritingRows(canvases);

            if (clip)
                canvas.RestoreState();

            return y;
        }
開發者ID:,項目名稱:,代碼行數:60,代碼來源:

示例3: InsertFormXObj

        private void InsertFormXObj(PdfContentByte canvas, PdfDictionary pageDict, PdfStream formXObj, IList<Rectangle> clippingRects, Rectangle annotRect) {
            PdfName xobjName = GenerateNameForXObj(pageDict);
            canvas.SaveState();

            foreach (Rectangle rect in clippingRects) {
                canvas.Rectangle(rect.Left, rect.Bottom, rect.Width, rect.Height);
            }

            canvas.Clip();
            canvas.NewPath();

            canvas.AddFormXObj(formXObj, xobjName, 1, 0, 0, 1, annotRect.Left, annotRect.Bottom);

            canvas.RestoreState();
        }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:15,代碼來源:PdfCleanUpProcessor.cs


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