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


C# PdfWriter.GetVerticalPosition方法代碼示例

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


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

示例1: OnEndPage

 public override void OnEndPage(PdfWriter writer, Document document) {
     Rectangle pageSize = writer.PageSize;
     float verticalPosition = writer.GetVerticalPosition(false);
     PdfContentByte canvas = writer.DirectContent;
     Rectangle rect = new Rectangle(0, verticalPosition, pageSize.Right, pageSize.Top);
     rect.Border = Rectangle.BOX;
     rect.BorderWidth = 1;
     rect.BorderColor = BaseColor.BLUE;
     canvas.Rectangle(rect);
 }
開發者ID:newlysoft,項目名稱:itextsharp,代碼行數:10,代碼來源:VerticalPositionTest.cs

示例2: Write

 public override void Write(PdfWriter writer, Document doc) {
     PdfDestination destination = new PdfDestination(PdfDestination.XYZ, 20,
             writer.GetVerticalPosition(false), 0);
     IDictionary<String, Object> memory = context.GetMemory();
     HeaderNode tree = null;
     if (memory.ContainsKey(HtmlPipelineContext.BOOKMARK_TREE))
         tree = (HeaderNode)memory[HtmlPipelineContext.BOOKMARK_TREE];
     int level = header.GetLevel(tag);
     if (null == tree) {
         // first h tag encounter
         tree = new HeaderNode(0, writer.RootOutline, null);
     }
     else {
         // calculate parent
         int lastLevel = tree.Level;
         if (lastLevel == level) {
             tree = tree.Parent;
         }
         else if (lastLevel > level) {
             while (lastLevel >= level) {
                 lastLevel = tree.Parent.Level;
                 tree = tree.Parent;
             }
         }
     }
     if (LOGGER.IsLogging(Level.TRACE)) {
         LOGGER.Trace(String.Format(LocaleMessages.GetInstance().GetMessage(LocaleMessages.ADD_HEADER), title.ToString()));
     }
     HeaderNode node = new HeaderNode(level, new PdfOutline(tree.Outline, destination, title), tree);
     memory[HtmlPipelineContext.BOOKMARK_TREE] = node;
 }
開發者ID:yu0410aries,項目名稱:itextsharp,代碼行數:31,代碼來源:Header.cs

示例3: ResultSheets

        public int ResultSheets(Document doc, int ShowID, int RingID, int Position , bool pagePerClass, PdfWriter writer )
        {
            int ret = 0;
            Font smallFont = new Font(Font.COURIER, 8, Font.NORMAL, Color.BLACK);
            Font normalFont = new Font(Font.COURIER, 10, Font.NORMAL, Color.BLACK);
            Font bigFont = new Font(Font.HELVETICA, 25, Font.NORMAL, Color.BLACK);
            Font mediumFont = new Font(Font.HELVETICA, 20, Font.NORMAL, Color.BLACK);
            ShowClasses sc = new ShowClasses();
            Rings currentRing = new Rings(RingID);
            List<ShowClasses> showClasses = ShowClasses.GetAllClassesForShowRing(ShowID, RingID, Position);
            var storedResults = Business.TrophiesRosettes.getTandRForShow(ShowID);
            var lineLeft = writer.GetVerticalPosition(false) - doc.BottomMargin;

            ret = showClasses.Count;
            PdfPTable callingListTbl = null;
            foreach (ShowClasses showClass in showClasses)
            {
                var resultCnts = storedResults.Where(x => x.ClsNo == showClass.ClassNo);

                int gradeidx = 0;
                foreach (var totals in resultCnts)
                {
                    PdfPTable ptable = new PdfPTable(3);
                    PdfPCell cell;

                    String grades;
                    String subTitle;

                    if (_writer != null)
                    {
                        _writer.GetVerticalPosition(false);
                    }

                    if (showClass.Catagory == 0)
                    {
                        if (gradeidx < showClass.Grades.Length)
                        {
                            grades = "Grade " + showClass.Grades[gradeidx];
                        }
                        else
                        {
                            grades = showClass.Grades;
                        }
                        subTitle = String.Format("{0} {1} {2} {3} {5}{6} Judge: {4}", showClass.longHeight, showClass.longCatagory, showClass.LongClassName, grades, Judge.getJudgeForClass(showClass.ID).JudgeName, showClass.ClassName, (showClass.Part > 0 ? "Part " + showClass.Part : ""));
                    }
                    else
                    {
                        if (showClass.Grades.Length == 1)
                        {
                            grades = showClass.Grades;
                        }
                        else
                        {
                            grades = showClass.Grades[0] + " - " + showClass.Grades[showClass.Grades.Length - 1];
                        }
                        subTitle = String.Format("{0} {1} Judge: {2}", showClass.NormalName(withClassNo:false), (showClass.Part > 0 ? "Part " + showClass.Part : ""), Judge.getJudgeForClass(showClass.ID).JudgeName);

                    }
                    String tmp = String.Format("Ring No:{0} - Result Sheet ", currentRing.RingNo);
                    cell = new PdfPCell(new Phrase(new Chunk(tmp, bigFont)));
                    cell.Colspan = 2;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);

                    tmp = String.Format("Class No:{0}", showClass.ClassNo);
                    cell = new PdfPCell(new Phrase(new Chunk(tmp, bigFont)));
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    cell.BorderWidth = 2;
                    cell.Padding = 5;
                    ptable.AddCell(cell);

                    cell = new PdfPCell(new Phrase(new Chunk(subTitle, mediumFont)));
                    cell.Colspan = 3;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);

                    cell = new PdfPCell(new Phrase(new Chunk("", ClassTitleFont)));
                    cell.Colspan = 3;
                    cell.BorderWidth = 0;
                    ptable.AddCell(cell);
                    ptable.AddCell(cell);
                    ptable.AddCell(cell);
                    doc.Add(ptable);
                    DrawCourseBoxes(doc);

                    float[] colWidths = { 75, 75, 200, 200, 50, 75 };
                    callingListTbl = new PdfPTable(colWidths);

                    cell = new PdfPCell(new Phrase(new Chunk("Place", headerHFont)));
                    cell.BorderWidth = 1;
                    cell.BorderWidthBottom = 0;
                    cell.FixedHeight = 35f;
                    cell.HorizontalAlignment = Element.ALIGN_CENTER;
                    callingListTbl.AddCell(cell);

                    if (TeamPairsManager.isMultiDog(showClass.EntryType))
                    {
                        if (TeamPairsManager.isTeam(showClass.EntryType))
                        {
                            cell = new PdfPCell(new Phrase(new Chunk("Team Name", headerHFont)));
//.........這裏部分代碼省略.........
開發者ID:woofwoof88,項目名稱:first-place-processing,代碼行數:101,代碼來源:DocumentManager.cs

示例4: CallingSheets


//.........這裏部分代碼省略.........
                            if (dogCnt < team.DogCount)
                            {
                                if (dogCnt > 0)
                                {
                                    handlerPara.Add(new Phrase(Chunk.NEWLINE));
                                    dogPara.Add(new Phrase(Chunk.NEWLINE));
                                }

                                handlerPara.Add(new Phrase(new Chunk(Utils.TitleCaseString(member.HandlerName).Replace("&#39;", "'"), font)));
                                dogPara.Add(new Phrase(new Chunk(Utils.TitleCaseString(member.DogName).Replace("&#39;", "'"), font)));
                            }
                            dogCnt++;
                        }
                        cell = new PdfPCell(handlerPara)
                        {
                            BorderWidth = 0,
                            BorderWidthTop = 0,
                            BackgroundColor = altColor
                        };
                        callingListTbl.AddCell(cell);

                        cell = new PdfPCell(dogPara)
                        {
                            BorderWidth = 0,
                            BorderWidthTop = 0,
                            BackgroundColor = altColor
                        };
                        callingListTbl.AddCell(cell);
                        doc.Add(callingListTbl);

                        altFlag++;
                        callingListTbl = new PdfPTable((TeamPairsManager.isMultiDog(showClass.EntryType) ? colWidthsTeam : colWidths));

                        var lineLeft = writer.GetVerticalPosition(false) - doc.BottomMargin;
                        if (lineLeft < 50)
                        {
                            doc.NewPage();
                        }
                    }
                }
                else
                {
                    var callingList = sc.GetCallingList(showId, showClass.ID);
                    foreach (var item in callingList)
                    {

                        Color altColor = Color.WHITE;
                        if (altFlag % 2 == 0 && showClass.EntryType != 5)
                        {
                            altColor = altLine;
                        }

                        callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk($"{item.Ro}", font)))
                        {
                            BorderWidth = 0,
                            BackgroundColor = altColor,
                            HorizontalAlignment = Element.ALIGN_RIGHT
                        });

                        var borderWidth = 0;
                        callingListTbl.AddCell(new PdfPCell(new Phrase(new Chunk(item.Lho == 0 ? "" : "LHO", font)))
                        {
                            HorizontalAlignment = Element.ALIGN_RIGHT,
                            BackgroundColor = altColor,
                            BorderWidth = borderWidth
                        });
開發者ID:woofwoof88,項目名稱:first-place-processing,代碼行數:67,代碼來源:DocumentManager.cs

示例5: ScribeSheets


//.........這裏部分代碼省略.........
                                {
                                    cell = new PdfPCell(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.DogName), normal8)));
                                    cell.BorderWidth = 0;
                                    callingListTbl.AddCell(cell);

                                    cell = new PdfPCell(new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.HandlerName), normal8)));
                                    cell.BorderWidth = 0;
                                    cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                                    callingListTbl.AddCell(cell);
                                }
                                else
                                {
                                    if (md.HandlerName.Length > 0  )
                                    {
                                        if (reserves.Length > 0) reserves += ",";
                                        reserves +=
                                            $"{Utils.TitleCaseString(md.HandlerName)} & {Utils.TitleCaseString(md.DogName)}";
                                    }
                                }
                                dogCnt++;
                            }
                            if (reserves.Length > 0)
                            {
                                cell = new PdfPCell(new Phrase(new Chunk("Reserves:" + reserves, italic8)))
                                {
                                    BorderWidth = 0,
                                    Colspan = 2
                                };
                                callingListTbl.AddCell(cell);
                            }
                            doc.Add(callingListTbl);

                            callingListTbl = new PdfPTable(colWidths);
                            var linecnt = writer.GetVerticalPosition(false) - doc.BottomMargin;
                            cell = new PdfPCell
                            {
                                BorderWidth = 0,
                                Colspan = 2,
                                FixedHeight = writer.PageSize.Height - linecnt - 60
                            };
                            callingListTbl.AddCell(cell);
                            doc.Add(callingListTbl);

                        }
                        else
                        {
                            var memberTable = new PdfPTable(new float[] { 300, 300 });
                            var memberCell = new PdfPCell(memberTable)
                            {
                                BorderWidth = 0,
                                Colspan = 2,
                                PaddingBottom = 10
                            };
                            var dogCnt = 0;
                            foreach (var md in team.Members)
                            {
                                if (dogCnt < team.DogCount)
                                {
                                    cell =
                                        new PdfPCell(
                                            new Phrase(new Chunk(Fpp.Core.Utils.TitleCaseString(md.HandlerName), font)))
                                        {
                                            BorderWidth = 0
                                        };
                                    memberTable.AddCell(cell);
開發者ID:woofwoof88,項目名稱:first-place-processing,代碼行數:66,代碼來源:DocumentManager.cs

示例6: Write

 public override void Write(PdfWriter writer, Document doc) {
     ColumnText c = new ColumnText(writer.DirectContent);
     float verticalPosition = writer.GetVerticalPosition(false);
     c.SetSimpleColumn(new Phrase(new Chunk(" ").SetLocalDestination(name)), 1,
             verticalPosition - 5, 6, verticalPosition, 5, Element.ALIGN_LEFT);
     try {
         c.Go();
     }
     catch (DocumentException e) {
         throw new RuntimeWorkerException(e);
     }
 }
開發者ID:newlysoft,項目名稱:itextsharp,代碼行數:12,代碼來源:Anchor.cs

示例7: addUrgencias

        static void addUrgencias(Document doc, PdfWriter writer, ExpensasEdificio expensa, System.Drawing.Image _24, System.Drawing.Image _tijera)
        {
            Image img = iTextSharp.text.Image.GetInstance(_24, System.Drawing.Imaging.ImageFormat.Png);
            img.SetAbsolutePosition(milimetroToPoint(12), doc.PageSize.Height - milimetroToPoint(9.5f) - milimetroToPoint(7));
            img.ScaleToFit(milimetroToPoint(9.5f), milimetroToPoint(9.5f));

            PdfPTable t = new PdfPTable(4);
            t.WidthPercentage = 85;
            float[] widths = new float[] { 8.5f, 35f, 35f, 35f };
            t.SetWidths(widths);

            PdfPCell c = new PdfPCell();
            Paragraph p;

            c.PaddingTop = 10;
            c.PaddingLeft = 0;
            c.Border = 0;
            c.AddElement(img);
            t.WidthPercentage = 100;
            t.AddCell(c);

            int leading = 9;
            c = new PdfPCell();
            c.Border = 0;
            p = new Paragraph(leading, "Urgencias", calibri8B);
            c.AddElement(p);

            int pos = 0;
            foreach (Proveedor prov in expensa.Proveedores)
            {
                p = new Paragraph(leading, prov.cargo + ": " + prov.nombre + " - " + prov.telefono, calibri8N);
                c.AddElement(p);
                pos++;
                if (pos == 3)
                {
                    t.AddCell(c);
                    c = new PdfPCell();
                    c.Border = 0;
                    c.AddElement(new Paragraph(" ", calibri8N));
                    pos = 0;
                }
            }
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            for (int i = 0; i <= (expensa.Proveedores.Count % 3); i++)
                t.AddCell(c);

            doc.Add(t);

            doc.Add(new Paragraph(8, " "));

            Image tijera = iTextSharp.text.Image.GetInstance(_tijera, System.Drawing.Imaging.ImageFormat.Png);
            //tijera.SetAbsolutePosition(milimetroToPoint(12), doc.PageSize.Height - milimetroToPoint(9.5f) - milimetroToPoint(7));
            tijera.ScaleToFit(milimetroToPoint(9f), milimetroToPoint(9f));
            tijera.SetAbsolutePosition(40, writer.GetVerticalPosition(true) - 10);
            writer.DirectContent.AddImage(tijera);

            doc.Add(new Paragraph(5, "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"));
            doc.Add(tijera);
        }
開發者ID:fedec93,項目名稱:Administracion,代碼行數:62,代碼來源:ControladorInformes.cs


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