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


C# PdfContentByte.BeginText方法代碼示例

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


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

示例1: Draw

// ---------------------------------------------------------------------------    
    /**
     * Draws a character representing an arrow at the current position.
     * @see com.itextpdf.text.pdf.draw.VerticalPositionMark#draw(
     *      com.itextpdf.text.pdf.PdfContentByte, float, float, float, float, float)
     */
    // i'm so stupid; originally forgot to override parent method and wondered
    // why the arrows weren't being drawn...
    public override void Draw(
      PdfContentByte canvas, float llx, float lly, float urx, float ury, float y
    ) {
      canvas.BeginText();
      canvas.SetFontAndSize(zapfdingbats, 12);
      if (left) {
        canvas.ShowTextAligned(Element.ALIGN_CENTER,
          ((char) 220).ToString(), llx - 10, y, 0
        );
      }
      else {
        canvas.ShowTextAligned(Element.ALIGN_CENTER,
          ((char) 220).ToString(), urx + 10, y + 8, 180
        );
      }
      canvas.EndText();
    }
開發者ID:,項目名稱:,代碼行數:25,代碼來源:

示例2: OnEndPage

        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);

            if (_isLastPage)
            {
                var relativeWidths = ColumnsHelper.GetRelativeColumnsForProducts(PageSize.A4);

                //RODAPE
                var pdfTableFooter = new BuilderTable().Create(relativeWidths).Standard();
                pdfTableFooter.AddCell(new BuilderCell("", 5).Create("DADOS ADICIONAIS").FixedHeight(15).Bold().HorizontalLeft().VerticalBottom().Colspan(42).NoBorder().BorderBuilder(false, false, false, false).Standard());

                pdfTableFooter.AddCell(new BuilderCell("", 5).Create("INFORMAÇÕES COMPLEMENTARES").FixedHeight(5).Bold().HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, false, true).Standard());
                pdfTableFooter.AddCell(new BuilderCell("", 5).Create("RESERVADO AO FISCO").Bold().HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, false, true).Standard());

                var infAdicional = _nfe.NFe.infNFe.infAdic;
                pdfTableFooter.AddCell(new BuilderCell("", 5).Create(infAdicional.infCpl).FixedHeight(25).HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, false, false).Standard());
                pdfTableFooter.AddCell(new BuilderCell("", 5).Create(" ").HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, false, false).Standard());

                if (_isHomolog)
                {
                    pdfTableFooter.AddCell(new BuilderCell("", 5).Create("SEM VALOR FISCAL").FixedHeight(5).HorizontalLeft().VerticalTop().Colspan(32).NoBorder().BorderBuilder(true, true, true, false).Standard());
                    pdfTableFooter.AddCell(new BuilderCell("", 5).Create(" ").HorizontalLeft().VerticalTop().Colspan(10).NoBorder().BorderBuilder(true, true, true, false).Standard());
                }

                document.Add(pdfTableFooter);
            }

            const float posX = 325f;
            const float posY = 662f;

            var pageN = writer.PageNumber;
            var text = "Folha " + pageN + "/";
            var len = _baseFont.GetWidthPoint(text, 8);

            _pdfContent = writer.DirectContent;
            _pdfContent.SetRGBColorFill(100, 100, 100);
            _pdfContent.BeginText();
            _pdfContent.SetFontAndSize(_baseFont, 8f);
            _pdfContent.SetTextMatrix(posX, posY);
            _pdfContent.ShowText(text);
            _pdfContent.EndText();
            _pdfContent.AddTemplate(_pageNumberTemplate, posX + len, posY);
            _pdfContent.BeginText();
            _pdfContent.SetFontAndSize(_baseFont, 8f);
            _pdfContent.EndText();
        }
開發者ID:spltechnology,項目名稱:spldanfe,代碼行數:47,代碼來源:DanfeHeader.cs

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

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

示例5: FooterPdfInitialize

        private static void FooterPdfInitialize(PdfWriter writer, Document document, PdfTemplate template, PdfContentByte contentByte, BaseFont baseFont, DateTime PrintTime)
        {
            int pageNumber = writer.PageNumber;
            string footerText = string.Format("Strona {0}{1}", pageNumber, " z ");
            float lenght = baseFont.GetWidthPoint(footerText, textSize);
            Rectangle pageSize = document.PageSize;

            contentByte.SetRGBColorFill(100, 100, 100);
            contentByte.BeginText();
            contentByte.SetFontAndSize(baseFont, textSize);
            contentByte.SetTextMatrix(pageSize.GetLeft(left), pageSize.GetBottom(bottom));
            contentByte.ShowText(footerText);
            contentByte.EndText();
            contentByte.AddTemplate(template, pageSize.GetLeft(left) + lenght, pageSize.GetBottom(bottom));

            contentByte.BeginText();
            contentByte.SetFontAndSize(baseFont, textSize);
            contentByte.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, string.Format("Utworzony: {0}", PrintTime.ToString()), pageSize.GetRight(right), pageSize.GetBottom(bottom), 0);
            contentByte.EndText();
        }
開發者ID:Khaleesy,項目名稱:Csharp,代碼行數:20,代碼來源:PdfFooter.cs

示例6: DrawInfo

 // ---------------------------------------------------------------------------           
 /**
  * Draws some text on every calendar sheet.
  * 
  */
 protected void DrawInfo(PdfContentByte directcontent)
 {
     directcontent.BeginText();
     directcontent.SetFontAndSize(bf, 18);
     float x, y;
     x = (OFFSET_LEFT + WIDTH + OFFSET_LOCATION) / 2;
     y = OFFSET_BOTTOM + HEIGHT + 24;
     directcontent.ShowTextAligned(
       Element.ALIGN_CENTER,
       "FOOBAR FILM FESTIVAL", x, y, 0
     );
     x = OFFSET_LOCATION + WIDTH_LOCATION / 2f - 6;
     y = OFFSET_BOTTOM + HEIGHT_LOCATION;
     directcontent.ShowTextAligned(
       Element.ALIGN_CENTER,
       "The Majestic", x, y, 90
     );
     y = OFFSET_BOTTOM + HEIGHT_LOCATION * 4f;
     directcontent.ShowTextAligned(
       Element.ALIGN_CENTER,
       "Googolplex", x, y, 90
     );
     y = OFFSET_BOTTOM + HEIGHT_LOCATION * 7.5f;
     directcontent.ShowTextAligned(
       Element.ALIGN_CENTER,
       "Cinema Paradiso", x, y, 90
     );
     directcontent.SetFontAndSize(bf, 12);
     x = OFFSET_LOCATION + WIDTH_LOCATION - 6;
     for (int i = 0; i < LOCATIONS; i++)
     {
         y = OFFSET_BOTTOM + ((8.5f - i) * HEIGHT_LOCATION);
         directcontent.ShowTextAligned(
           Element.ALIGN_CENTER,
           locations[i], x, y, 90
         );
     }
     directcontent.SetFontAndSize(bf, 6);
     y = OFFSET_BOTTOM + HEIGHT + 1;
     for (int i = 0; i < TIMESLOTS; i++)
     {
         x = OFFSET_LEFT + (i * WIDTH_TIMESLOT);
         directcontent.ShowTextAligned(
           Element.ALIGN_LEFT,
           TIME[i], x, y, 45
         );
     }
     directcontent.EndText();
 }
開發者ID:kuujinbo,項目名稱:iTextInAction2Ed,代碼行數:54,代碼來源:MovieTextInfo.cs

示例7: OnEndPage

        public override void OnEndPage(PdfWriter writer, Document document)
        {
            base.OnEndPage(writer, document);

            int pageN = writer.PageNumber;

            string text = "From SG Telecom        SIGN..........................   Exe. Name  "+ BusinessAccessLeyer.BAL.StaticVariables.selectuser+"     Given To........................... ";
               // string text = pageN + " - ";
            float len = baseFont.GetWidthPoint(text, 8);

            Rectangle pageSize = document.PageSize;
            pdfContent = writer.DirectContent;
            pdfContent.SetRGBColorFill(100, 100, 100);

            pdfContent.BeginText();
            pdfContent.SetFontAndSize(baseFont, 12);
               // pdfContent.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text, pageSize.GetRight(40), pageSize.GetBottom(30), 0);
            pdfContent.ShowTextAligned(PdfContentByte.ALIGN_LEFT, text, pageSize.GetLeft(40) , pageSize.GetBottom(30), 0);
            pdfContent.EndText();

            BusinessAccessLeyer.BAL.StaticVariables.selectuser = "";

              //  string path = @"D:\Dropboxdata\Dropbox\mayankmvc\Web_Complete_Inv\PresantationAccessLeyer\Images\Address Img.jpg";

              ////  iTextSharp.text.Image instanceImg = iTextSharp.text.Image.GetInstance(path);

              //  //Image logo = Image.GetInstance(path);
              //  // logo.ScaleAbsolute(500, 300);

              //   string imageURL =   path ;  // Server.MapPath(".") + "/image2.jpg";
              //   iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageURL);
              //   //Resize image depend upon your need
              //   jpg.ScaleToFit(240f, 120f);
              //   //Give space before image
              //   jpg.SpacingBefore = 10f;
              //   //Give some space after the image
              //   jpg.SpacingAfter = 1f;
              //   //jpg.Alignment = Element.ALIGN_LEFT;
              //   jpg.Alignment =  Element.ALIGN_CENTER;
              //   document.Add(jpg);

            ////////////////////////////////////
        }
開發者ID:spsinghdocument,項目名稱:MVC3SG,代碼行數:43,代碼來源:PrintHeaderFooter.cs

示例8: RenderCanvasSheet

        public void RenderCanvasSheet(Stream stream, IEnumerable<CanvasItemModel> items, UserModel currentUser,UserModel requestedBy, PurchaseRequest Pr, string[] Vendors)
        {
            Document document = new Document(PageSize.LETTER);

            try {
                PdfWriter writer = PdfWriter.GetInstance(document, stream);
                document.Open();

                // Create a page in the document and add it to the bottom layer
                document.NewPage();
                //Pass Document to this
                CurrentDoc = document;

                page = writer.DirectContentUnder;
                page.BeginText();
                int top = (int)document.GetTop(0);
                SetFontSizeTo(16);
                PrintText("CANVASS SHEET", 20, 10);
                SetFontSizeTo(10);

                //Header
                PrintText("Company Name: " + requestedBy.CompanyName, 20, 30); // Company Name
                PrintText("Department: " + requestedBy.DepartmentName, 20, 45); // Company Address
                PrintText("Purpose: " + Pr.Purpose, 20, 60); // Purpose
                PrintTextRight("Date: {0}".WithTokens(DateTime.Now.ToShortDateString()), 70, 30); // Date Created
                PrintTextRight("PR No: {0}".WithTokens(Pr.PRNo), 70, 45); // PR Number

                SetFontSizeTo(8);

                // START HERE ----------------------------
                Paragraph Grid = new Paragraph("\n");
                Grid.Alignment = 1;
                Grid.SpacingAfter = 10f;
                document.Add(Grid);

                Paragraph Grid2 = new Paragraph();
                Grid2.Alignment = 1;
                Grid2.SpacingBefore = 35f;
                //Start Table -----------------------------------
                PdfPTable rightTable = new PdfPTable(7);
                int[] widths = { 1, 7, 2, 2, 2, 2, 2 };
                rightTable.SetWidths(widths);
                rightTable.TotalWidth = 570f;
                rightTable.LockedWidth = true;
                Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);

                PdfPCell rightAlignedCell = new PdfPCell();
                rightAlignedCell.HorizontalAlignment = Element.ALIGN_CENTER;

                //Headers
                rightAlignedCell.Phrase = new Phrase("Item No.", tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase("Item Description", tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase("Quantity", tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase("UOM", tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase(Vendors[0], tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase(Vendors[1], tableFont); rightTable.AddCell(rightAlignedCell);
                rightAlignedCell.Phrase = new Phrase(Vendors[2], tableFont); rightTable.AddCell(rightAlignedCell);

                rightAlignedCell.HorizontalAlignment = Element.ALIGN_RIGHT;

                foreach (var item in items) {
                    string priceVendor1 = item.PriceVendor1 == 0 ? "NONE" : item.PriceVendor1.ToString();
                    string priceVendor2 = item.PriceVendor2 == 0 ? "NONE" : item.PriceVendor2.ToString();
                    string priceVendor3 = item.PriceVendor3 == 0 ? "NONE" : item.PriceVendor3.ToString();
                    rightTable.AddCell(new Phrase(item.ItemNumber.ToString(), tableFont));
                    rightTable.AddCell(new Phrase(item.ItemDescription, tableFont));
                    rightAlignedCell.Phrase = new Phrase(item.Quantity.ToString(), tableFont); rightTable.AddCell(rightAlignedCell);
                    rightTable.AddCell(new Phrase(item.UOM, tableFont));
                    rightAlignedCell.Phrase = new Phrase(priceVendor1, tableFont); rightTable.AddCell(rightAlignedCell);
                    rightAlignedCell.Phrase = new Phrase(priceVendor2, tableFont); rightTable.AddCell(rightAlignedCell);
                    rightAlignedCell.Phrase = new Phrase(priceVendor3, tableFont); rightTable.AddCell(rightAlignedCell);
                }
                Grid2.Add(rightTable);
                document.Add(Grid2);

                // Footer
                SetFontSizeTo(10);
                PrintTextBottom("Requested By:", 20, 105);
                PrintTextBottom("{0} {1}".WithTokens(requestedBy.FirstName, requestedBy.LastName), 20, 35);

                PrintTextBottom("Prepared By:", 265, 105);
                PrintTextBottom("{0} {1}".WithTokens(currentUser.FirstName, currentUser.LastName), 265, 35);

                PrintTextBottom("Approved By:", 450, 105);
                PrintTextBottom("{0}".WithTokens("______________________"), 450, 35);

                page.EndText();

                writer.Flush();
            }
            finally {
                document.Close();
            }
        }
開發者ID:haroldocampo,項目名稱:PRSSSI,代碼行數:94,代碼來源:PdfManager.cs

示例9: RenderRfq

        public void RenderRfq(Stream stream, VendorModel vendor, IEnumerable<ItemModel> items, UserModel user, int RfqNumber, PurchaseRequest Pr, DateTime DateRequested)
        {
            Document document = new Document(PageSize.LETTER);

            try {
                PdfWriter writer = PdfWriter.GetInstance(document, stream);
                document.Open();

                // Create a page in the document and add it to the bottom layer
                document.NewPage();
                //Pass Document to this
                CurrentDoc = document;

                page = writer.DirectContentUnder;
                page.BeginText();
                int top = (int)document.GetTop(0);
                SetFontSizeTo(16);
                PrintText("REQUEST FOR QUOTATION (THIS IS NOT AN ORDER)", 20, 10);
                SetFontSizeTo(10);

                //Header
                PrintText("Company Name: {0}".WithTokens(Pr.User.Company.Name), 20, 30); // Company Name
                PrintText("Address: 8th Floor Gedisco Tower, 534 Asuncion St., Binondo, Manila", 20, 45); // Company Address
                PrintText("Purchasing Department", 20, 60);
                PrintText("Issued By: {0} {1}".WithTokens(user.FirstName, user.LastName), 20, 75); // Requested By
                PrintTextRight("RFQ NO: {0}".WithTokens(RfqNumber), 70, 30); // RFQ Number
                PrintTextRight("Date: {0}".WithTokens(DateTime.Now.ToShortDateString()), 70, 45); // Date Created
                PrintTextRight("PR No: {0}".WithTokens(Pr.PRNo), 70, 60); // PR Number

                //Body
                SetFontSizeTo(14);
                PrintText("BID/OFFER/QUOTE MUST BE RECEIVED BY:", 20, 105); // Requested By
                PrintTextRight("Date: {0}".WithTokens(DateRequested.ToShortDateString()), 95, 105); // Date Required
                SetFontSizeTo(10);
                PrintText("Attention: {0} {1}".WithTokens(user.FirstName, user.LastName), 40, 125); // Vendor Contact Person
                PrintText("Tel No: {0}".WithTokens("+63 2 244 9296"), 40, 140); // Vendor Tel No
                PrintText("Email Address: {0}".WithTokens(user.Email), 40, 155); // Vendor Email
                PrintText("Fax No: {0}".WithTokens("+63 2 241 7826"), 240, 125); // Vendor Fax No
                SetFontSizeTo(8);
                PrintText("Unless otherwise requested, quote on each item separately. Unit Prices shall be shown. If unable to furnish", 20, 175); // Vendor Email
                PrintText("items as specified, submit sample and/or descriptive specifications of substitute offered.", 20, 185); // Vendor Email

                //Items
                SetFontSizeTo(8);
                PrintText("_______________________________________________________________________________________________________________________", 20, 210);
                PrintText("Item No.", 20, 205);
                PrintText("Item Description", 70, 205);
                PrintText("Quantity", 370, 205);
                PrintText("Unit Price", 420, 205);
                PrintText("Discount", 470, 205);
                PrintText("Total", 520, 205);

                //// Items..
                //int staryY = 225;
                //int itemCount = 1;
                //foreach (var item in items) {
                //    PrintItem(itemCount.ToString(), item.Description, item.Quantity.ToString(), ref staryY);
                //    itemCount++;
                //}
                //PrintText("********** NOTHING FOLLOWS **********", 75, staryY + 15);

                // START HERE ----------------------------
                Paragraph Grid = new Paragraph("\n\n\n\n\n\n\n\n\n");
                Grid.Alignment = 1;
                Grid.SpacingAfter = 35f;
                document.Add(Grid);

                Paragraph Grid2 = new Paragraph();
                Grid2.Alignment = 1;
                Grid2.SpacingBefore = 35f;
                //Start Table -----------------------------------
                PdfPTable rightTable = new PdfPTable(7);
                int[] widths = { 1, 1, 1, 7, 2, 2, 2 };
                rightTable.SetWidths(widths);
                rightTable.TotalWidth = 570f;
                rightTable.LockedWidth = true;
                Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);

                rightTable.HorizontalAlignment = Element.ALIGN_CENTER;

                rightTable.AddCell(new Phrase("Item No.", tableFont));
                rightTable.AddCell(new Phrase("Item Description", tableFont));
                rightTable.AddCell(new Phrase("Quantity", tableFont));
                rightTable.AddCell(new Phrase("Unit Price", tableFont));
                rightTable.AddCell(new Phrase("Discount", tableFont));
                rightTable.AddCell(new Phrase("Total Amount", tableFont));

                rightTable.HorizontalAlignment = Element.ALIGN_LEFT;

                int itemCount = 1;
                foreach (var item in items) {
                    rightTable.AddCell(new Phrase(item.ItemNumber.ToString(), tableFont));
                    rightTable.AddCell(new Phrase(item.Description, tableFont));
                    rightTable.AddCell(new Phrase(item.Quantity.ToString(), tableFont));
                    rightTable.AddCell(new Phrase("", tableFont));
                    rightTable.AddCell(new Phrase("", tableFont));
                    rightTable.AddCell(new Phrase("", tableFont));
                    itemCount++;
                }
                //Nothing Follows
//.........這裏部分代碼省略.........
開發者ID:haroldocampo,項目名稱:PRSSSI,代碼行數:101,代碼來源:PdfManager.cs

示例10: RenderPurchaseOrder

        public void RenderPurchaseOrder(Stream stream, int PoNumber, IEnumerable<PoItemModel> PoItems, int RequestNumber, string VendorName, string VendorCode, string VendorAddress, DateTime DateCreated, DateTime DeliveryDate, UserModel RequestUser, UserModel CurrentUser)
        {
            Document document = new Document(PageSize.LETTER);

            try {
                PdfWriter writer = PdfWriter.GetInstance(document, stream);
                document.Open();

                // Create a page in the document and add it to the bottom layer
                document.NewPage();
                //Pass Document to this
                CurrentDoc = document;

                string logoLocation = sonicLogo;
                float logoPosition = 50;

                string CurrentCompany = RequestUser.CompanyName;
                //Image
                if (RequestUser.CompanyId == (int)CompanyIds.SonicSteel) {
                    logoLocation = sonicLogo;
                    logoPosition = 70;
                }
                else if (RequestUser.CompanyId == (int)CompanyIds.SteelTech) {
                    logoLocation = steeltechLogo;
                }
                else if (RequestUser.CompanyId == (int)CompanyIds.Somico) {
                    logoLocation = somicoLogo;
                }
                Image logo = Image.GetInstance(Directory.GetCurrentDirectory() + logoLocation);
                logo.SetAbsolutePosition(20, (int)CurrentDoc.GetTop(logoPosition));

                // START HERE ----------------------------
                Paragraph Grid = new Paragraph("\n\n\n\n\n\n\n\n\n");
                Grid.Alignment = 1;
                Grid.SpacingAfter = 35f;
                document.Add(Grid);

                Paragraph Grid2 = new Paragraph();
                Grid2.Alignment = 1;
                Grid2.SpacingBefore = 35f;
                //Start Table -----------------------------------
                PdfPTable rightTable = new PdfPTable(7);
                int[] widths = { 1, 1, 1, 7, 2, 2, 2 };
                rightTable.SetWidths(widths);
                rightTable.TotalWidth = 570f;
                rightTable.LockedWidth = true;
                Font tableFont = new Font(Font.FontFamily.HELVETICA, 8);

                rightTable.HorizontalAlignment = Element.ALIGN_CENTER;

                rightTable.AddCell(new Phrase("Item No.", tableFont));
                rightTable.AddCell(new Phrase("Quantity", tableFont));
                rightTable.AddCell(new Phrase("UOM", tableFont));
                rightTable.AddCell(new Phrase("Item Description", tableFont));
                rightTable.AddCell(new Phrase("Unit Price", tableFont));
                rightTable.AddCell(new Phrase("Discount", tableFont));
                rightTable.AddCell(new Phrase("Total Amount", tableFont));

                rightTable.HorizontalAlignment = Element.ALIGN_LEFT;

                int itemCount = 1;
                foreach (var poItem in PoItems) {
                    rightTable.AddCell(new Phrase(itemCount.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.Quantity.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.UOM, tableFont)); rightTable.AddCell(new Phrase(poItem.Description, tableFont)); rightTable.AddCell(new Phrase(poItem.Price.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.Discount.ToString(), tableFont)); rightTable.AddCell(new Phrase(poItem.TotalPrice.ToString(), tableFont));
                    itemCount++;
                }
                //Nothing Follows
                rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("******** NOTHING FOLLOWS ********", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase(""));

                //Grand Total
                rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("", tableFont)); rightTable.AddCell(new Phrase("")); rightTable.AddCell(new Phrase("Grand Total:", new Font(Font.FontFamily.HELVETICA, 12))); rightTable.AddCell(new Phrase(PoItems.Sum(x => x.TotalPrice).ToString(), new Font(Font.FontFamily.HELVETICA, 12)));

                Grid2.Add(rightTable);
                document.Add(Grid2);
                // End of table -----------------------------------
                page = writer.DirectContentUnder;

                page.AddImage(logo);
                page.Stroke();

                // For "Purchase Order" Text
                PrintRectangle(20, 120, 570, 50);
                //For two tables
                PrintRectangle(20, 230, 350, 100);
                PrintRectangle(370, 230, 220, 100);
                //For Footer
                PrintRectangleBottom(20, 20, 570, 50);

                page.BeginText();

                SetFontSizeTo(24);

                PrintText("PURCHASE ORDER", 180, 105);

                SetPOCompanyHeader(RequestUser);

                SetFontSizeTo(10);
                // Header
                PrintText("To:", 25, 140); // Vendor Name

                SetFontSizeTo(8);
//.........這裏部分代碼省略.........
開發者ID:haroldocampo,項目名稱:PRSSSI,代碼行數:101,代碼來源:PdfManager.cs

示例11: DrawBoxForCover

        /// <summary>
        /// Draws the box on the cover page that contains the date
        /// </summary>
        /// <param name="cb"></param>
        /// <param name="doc"></param>
        /// <param name="project"></param>
        private void DrawBoxForCover(PdfContentByte cb, Document doc)
        {
            // set the colors
            cb.SetColorStroke(_baseColor);
            cb.SetColorFill(_baseColor);

            // calculate the top left corner of the box
            var x = doc.LeftMargin;
            var y = doc.BottomMargin + 678;

            var height = 60;

            // move the cursor to starting position
            cb.MoveTo(x, y);

            // draw the top line
            cb.LineTo(x + _pageWidth, y);

            // draw the right line
            cb.LineTo(x + _pageWidth, y - height);

            // draw the bottom line
            cb.LineTo(x, y - height);

            // draw the left line
            cb.LineTo(x, y);

            cb.ClosePathFillStroke();
            cb.Stroke();

            // add the text inside the box
            cb.BeginText();
            cb.SetFontAndSize(_dateBaseFont, 26f);
            cb.SetColorStroke(BaseColor.WHITE);
            cb.SetColorFill(BaseColor.WHITE);
            cb.SetTextMatrix(x + 10, y - 40);
            cb.ShowText(string.Format("{0:MMMM dd, yyyy}", DateTime.Now));
            cb.EndText();
        }
開發者ID:ucdavis,項目名稱:Dogbert,代碼行數:45,代碼來源:PdfService.cs

示例12: AddItemData

        private static void AddItemData(Factuur factuur, Document document,
										int lastwriteposition, PdfContentByte content, ref int topMargin)
        {
            // Loop thru the rows in the rows table
            // Start by writing out the line headers
            // Line headers
            const int aantalMargin = 360, ehprijsMargin = 450, totaalMargin = 540;

            WriteText(content, "Omschrijving", 40, topMargin, 12, true);
            WriteText(content, "Aantal", aantalMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);
            WriteText(content, "Prijs/EH", ehprijsMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);
            WriteText(content, "Bedrag", totaalMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);

            topMargin -= 20;
            foreach (var item in factuur.Items)
            {
                var opmerkingBottom = topMargin;
                foreach (var s in item.Omschrijving.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
                {
                    WriteText(content, s, 40, opmerkingBottom, 10);
                    opmerkingBottom -= 16;
                }

                WriteText(content, item.Aantal.ToString(), aantalMargin, topMargin, 10, false, PdfContentByte.ALIGN_RIGHT);
                WriteText(content, string.Format("{0:C}", Math.Round(item.EenheidsPrijs, 2)), ehprijsMargin, topMargin, 10, false,
                          PdfContentByte.ALIGN_RIGHT);
                WriteText(content, string.Format("{0:C}", item.TotaalPrijs), totaalMargin, topMargin, 10, false,
                          PdfContentByte.ALIGN_RIGHT);

                // This is the line spacing, if you change the font size, you might want to change this as well.
                topMargin = opmerkingBottom;

                // Implement a page break function, checking if the write position has reached the lastwriteposition
                if (topMargin > lastwriteposition) continue;
                // We need to end the writing before we change the page
                content.EndText();
                // Make the page break
                document.NewPage();
                // Start the writing again
                content.BeginText();
                topMargin = 780;
                WriteText(content, "Omschrijving", 40, topMargin, 12, true);
                WriteText(content, "Aantal", aantalMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);
                WriteText(content, "Prijs/EH", ehprijsMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);
                WriteText(content, "Bedrag", totaalMargin, topMargin, 12, true, PdfContentByte.ALIGN_RIGHT);
                // Assign the new write location on page two!
                // Here you might want to implement a new header function for the new page
                topMargin -= 20;
            }
        }
開發者ID:desmetjens,項目名稱:DuraFact,代碼行數:50,代碼來源:PDFGenerator.cs

示例13: setText

        static void setText(PdfContentByte cb,EditText[] edTxt)
        {
            cb.BeginText ();
            cb.ShowTextAligned (0,edTxt[0].Text, 42, 477, 0);
            cb.ShowTextAligned (0, edTxt[1].Text, 42, 463, 0);
            cb.ShowTextAligned (0, edTxt[2].Text, 42, 448, 0);
            cb.ShowTextAligned (0, edTxt[3].Text, 42, 434, 0);
            cb.ShowTextAligned (0, edTxt[4].Text, 42, 419, 0);
            cb.ShowTextAligned (0, edTxt[5].Text, 42, 405, 0);
            cb.ShowTextAligned (0, edTxt[6].Text, 42, 390, 0);
            cb.ShowTextAligned (0, edTxt[7].Text, 42, 376, 0);
            cb.ShowTextAligned (0, edTxt[8].Text, 42, 323, 0);
            cb.ShowTextAligned (0, edTxt[9].Text, 42, 309, 0);
            cb.ShowTextAligned (0, edTxt[10].Text, 42, 295, 0);
            cb.ShowTextAligned (0, edTxt[11].Text, 115, 323, 0);
            cb.ShowTextAligned (0, edTxt[12].Text, 115, 309, 0);
            cb.ShowTextAligned (0, edTxt[13].Text, 115, 295, 0);
            cb.ShowTextAligned (0, edTxt[14].Text, 217, 323, 0);
            cb.ShowTextAligned (0, edTxt[15].Text, 217, 309, 0);
            cb.ShowTextAligned (0, edTxt[16].Text, 217, 295, 0);
            cb.ShowTextAligned (0, edTxt[17].Text, 242, 323, 0);
            cb.ShowTextAligned (0, edTxt[18].Text, 242, 309, 0);
            cb.ShowTextAligned (0, edTxt[19].Text, 242, 295, 0);
            cb.ShowTextAligned (0, edTxt[20].Text, 265, 323, 0);
            cb.ShowTextAligned (0, edTxt[21].Text, 265, 309, 0);
            cb.ShowTextAligned (0, edTxt[22].Text, 265, 295, 0);
            cb.ShowTextAligned (0, edTxt[23].Text, 137, 267, 0);
            cb.ShowTextAligned (0, edTxt[24].Text, 137, 253, 0);
            cb.ShowTextAligned (0, edTxt[25].Text, 137, 238, 0);
            cb.ShowTextAligned (0, edTxt[26].Text, 137, 223, 0);
            cb.ShowTextAligned (0, edTxt[27].Text, 137, 209, 0);
            cb.ShowTextAligned (0, edTxt[28].Text, 137, 195, 0);
            cb.ShowTextAligned (0, edTxt[29].Text, 262, 267, 0);
            cb.ShowTextAligned (0, edTxt[30].Text, 262, 253, 0);
            cb.ShowTextAligned (0, edTxt[31].Text, 262, 238, 0);
            cb.ShowTextAligned (0, edTxt[32].Text, 262, 223, 0);
            cb.ShowTextAligned (0, edTxt[33].Text, 262, 209, 0);
            cb.ShowTextAligned (0, edTxt[34].Text, 262, 195, 0);
            cb.ShowTextAligned (0, edTxt[35].Text, 293, 323, 0);
            cb.ShowTextAligned (0, edTxt[36].Text, 293, 309, 0);
            cb.ShowTextAligned (0, edTxt[37].Text, 293, 295, 0);
            cb.ShowTextAligned (0, edTxt[38].Text, 293, 281, 0);
            cb.ShowTextAligned (0, edTxt[39].Text, 293, 267, 0);
            cb.ShowTextAligned (0, edTxt[40].Text, 293, 253, 0);
            cb.ShowTextAligned (0, edTxt[41].Text, 293, 238, 0);
            cb.ShowTextAligned (0, edTxt[42].Text, 293, 223, 0);
            cb.ShowTextAligned (0, edTxt[43].Text, 293, 209, 0);
            cb.ShowTextAligned (0, edTxt[44].Text, 293, 195, 0);
            cb.ShowTextAligned (0, edTxt[45].Text, 499, 323, 0);
            cb.ShowTextAligned (0, edTxt[46].Text, 499, 309, 0);
            cb.ShowTextAligned (0, edTxt[47].Text, 499, 295, 0);
            cb.ShowTextAligned (0, edTxt[48].Text, 499, 281, 0);
            cb.ShowTextAligned (0, edTxt[49].Text, 499, 267, 0);
            cb.ShowTextAligned (0, edTxt[50].Text, 499, 253, 0);
            cb.ShowTextAligned (0, edTxt[51].Text, 499, 238, 0);
            cb.ShowTextAligned (0, edTxt[52].Text, 499, 223, 0);
            cb.ShowTextAligned (0, edTxt[53].Text, 499, 209, 0);
            cb.ShowTextAligned (0, edTxt[54].Text, 499, 195, 0);
            cb.ShowTextAligned (0, edTxt[55].Text, 550, 323, 0);
            cb.ShowTextAligned (0, edTxt[56].Text, 550, 309, 0);
            cb.ShowTextAligned (0, edTxt[57].Text, 550, 295, 0);
            cb.ShowTextAligned (0, edTxt[58].Text, 550, 281, 0);
            cb.ShowTextAligned (0, edTxt[59].Text, 550, 267, 0);
            cb.ShowTextAligned (0, edTxt[60].Text, 550, 253, 0);
            cb.ShowTextAligned (0, edTxt[61].Text, 550, 238, 0);
            cb.ShowTextAligned (0, edTxt[62].Text, 550, 223, 0);
            cb.ShowTextAligned (0, edTxt[63].Text, 550, 209, 0);
            cb.ShowTextAligned (0, edTxt[64].Text, 550, 195, 0);

            cb.EndText ();
        }
開發者ID:Apophes,項目名稱:Lieferschein,代碼行數:71,代碼來源:PDFManager.cs

示例14: SetNewPageSizeAndMargins

 protected internal void SetNewPageSizeAndMargins() {
     pageSize = nextPageSize;
     if (marginMirroring && (PageNumber & 1) == 0) {
         marginRight = nextMarginLeft;
         marginLeft = nextMarginRight;
     }
     else {
         marginLeft = nextMarginLeft;
         marginRight = nextMarginRight;
     }
     if (marginMirroringTopBottom && (PageNumber & 1) == 0) {
         marginTop = nextMarginBottom;
         marginBottom = nextMarginTop;
     }
     else {
         marginTop = nextMarginTop;
         marginBottom = nextMarginBottom;
     }
     text = new PdfContentByte(writer);
     text.Reset();
     text.BeginText();
     textEmptySize = text.Size;
     // we move to the left/top position of the page
     text.MoveText(Left, Top);
 }
開發者ID:,項目名稱:,代碼行數:25,代碼來源:

示例15: PlaceBarcode


//.........這裏部分代碼省略.........
 *   <TD><P><CODE>null</CODE></TD>
 *   <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
 *   </TR>
 * <TR>
 *   <TD><P><CODE>null</CODE></TD>
 *   <TD><P><CODE>textColor</CODE></TD>
 *   <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
 *   </TR>
 * <TR>
 *   <TD><P><CODE>barColor</CODE></TD>
 *   <TD><P><CODE>textColor</CODE></TD>
 *   <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
 *   </TR>
 * </TABLE>
 * @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
 * @param barColor the color of the bars. It can be <CODE>null</CODE>
 * @param textColor the color of the text. It can be <CODE>null</CODE>
 * @return the dimensions the barcode occupies
 */
 public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) {
     string fullCode;
     if (codeType == CODE128_RAW) {
         int idx = code.IndexOf('\uffff');
         if (idx < 0)
             fullCode = "";
         else
             fullCode = code.Substring(idx + 1);
     }
     else if (codeType == CODE128_UCC)
         fullCode = GetHumanReadableUCCEAN(code);
     else
         fullCode = RemoveFNC1(code);
     float fontX = 0;
     if (font != null) {
         fontX = font.GetWidthPoint(fullCode = altText != null ? altText : fullCode, size);
     }
     string bCode;
     if (codeType == CODE128_RAW) {
         int idx = code.IndexOf('\uffff');
         if (idx >= 0)
             bCode = code.Substring(0, idx);
         else
             bCode = code;
     }
     else {
         bCode = GetRawText(code, codeType == CODE128_UCC);
     }
     int len = bCode.Length;
     float fullWidth = (len + 2) * 11 * x + 2 * x;
     float barStartX = 0;
     float textStartX = 0;
     switch (textAlignment) {
         case Element.ALIGN_LEFT:
             break;
         case Element.ALIGN_RIGHT:
             if (fontX > fullWidth)
                 barStartX = fontX - fullWidth;
             else
                 textStartX = fullWidth - fontX;
             break;
         default:
             if (fontX > fullWidth)
                 barStartX = (fontX - fullWidth) / 2;
             else
                 textStartX = (fullWidth - fontX) / 2;
             break;
     }
     float barStartY = 0;
     float textStartY = 0;
     if (font != null) {
         if (baseline <= 0)
             textStartY = barHeight - baseline;
         else {
             textStartY = -font.GetFontDescriptor(BaseFont.DESCENT, size);
             barStartY = textStartY + baseline;
         }
     }
     byte[] bars = GetBarsCode128Raw(bCode);
     bool print = true;
     if (barColor != null)
         cb.SetColorFill(barColor);
     for (int k = 0; k < bars.Length; ++k) {
         float w = bars[k] * x;
         if (print)
             cb.Rectangle(barStartX, barStartY, w - inkSpreading, barHeight);
         print = !print;
         barStartX += w;
     }
     cb.Fill();
     if (font != null) {
         if (textColor != null)
             cb.SetColorFill(textColor);
         cb.BeginText();
         cb.SetFontAndSize(font, size);
         cb.SetTextMatrix(textStartX, textStartY);
         cb.ShowText(fullCode);
         cb.EndText();
     }
     return this.BarcodeSize;
 }    
開發者ID:NelsonSantos,項目名稱:fyiReporting-Android,代碼行數:101,代碼來源:Barcode128.cs


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