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


C# PdfContentByte.ShowTextAligned方法代碼示例

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


在下文中一共展示了PdfContentByte.ShowTextAligned方法的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: 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:,項目名稱:,代碼行數:51,代碼來源:

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

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

示例7: WriteText

 // This is the method writing text to the content byte
 private static void WriteText(PdfContentByte cb, string text, int x, int y, int size, bool bold = false, int align = PdfContentByte.ALIGN_LEFT)
 {
     cb.SetFontAndSize(bold ? _baseFontBold : _baseFont, size);
     cb.ShowTextAligned(align, text, x, y, 0);
 }
開發者ID:desmetjens,項目名稱:DuraFact,代碼行數:6,代碼來源:PDFGenerator.cs

示例8: CreatePdfText

	private void CreatePdfText(PdfContentByte content, Configuration.PrintTemplateContentRow row, string text)
	{
		CreatePdfBox(content, row);

		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;

		string fontFamily = "Helvetica";
		int textAlign = PdfContentByte.ALIGN_CENTER;
		float fontSize = 12;
		int textStyle = iTextSharp.text.Font.NORMAL;
		bool textWrap = false;

		int columnAlign = Element.ALIGN_CENTER;

		if (!row.IsTextWrapNull())
		{
			textWrap = row.TextWrap == 1;
		}

		if (!row.IsFontFamilyNull())
		{
			fontFamily = row.FontFamily;
		}

		if (!row.IsFontBoldNull())
		{
			if (row.FontBold == 1)
			{
				if (textWrap)
				{
					textStyle = Font.BOLD;
				}
				else
				{
					fontFamily += "-Bold";
				}
			}
		}

		if (!row.IsFontSizeNull())
		{
			fontSize = Convert.ToSingle(row.FontSize);
		}

		BaseFont baseFont = BaseFont.CreateFont(fontFamily, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

		if (textWrap)
		{
			if (!row.IsTextAlignNull())
			{
				switch (row.TextAlign)
				{
					case "left":
						columnAlign = Element.ALIGN_LEFT;
						break;
					case "right":
						columnAlign = Element.ALIGN_RIGHT;
						break;
				}
			}

			Font font = new Font(baseFont, fontSize, textStyle);
			content.SetRGBColorFill(0, 0, 0);

			float leading = fontSize * 1.2f;

			ColumnText column = new ColumnText(content);
			column.SetSimpleColumn(originX, originY, originX + width, originY + height, leading, columnAlign);
			column.AddText(new Phrase(leading, text, font));
			column.Go();
		}
		else
		{
			originX += width / 2;

			if (!row.IsTextAlignNull())
			{
				switch (row.TextAlign)
				{
					case "left":
						textAlign = PdfContentByte.ALIGN_LEFT;
						originX -= width / 2;
						break;
					case "right":
						textAlign = PdfContentByte.ALIGN_RIGHT;
						originX += width / 2;
						break;
				}
			}

			content.BeginText();
			content.SetFontAndSize(baseFont, fontSize);
			content.SetRGBColorFill(0, 0, 0);
			content.ShowTextAligned(textAlign, text, originX, originY, 0);
			content.EndText();
		}
	}
開發者ID:ClaireBrill,項目名稱:GPV,代碼行數:100,代碼來源:PdfMap.cs

示例9: writeText

 private void writeText(PdfContentByte cb, string Text, int X, int Y, BaseFont font, int Size)
 {
     cb.SetFontAndSize(font, Size);
     cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, Text, X, Y, 0);
 }
開發者ID:krzysiuk12,項目名稱:SpringMvc,代碼行數:5,代碼來源:PdfInvoiceBuilder.cs

示例10: setCheckBoxes

 static void setCheckBoxes(PdfContentByte cb, CheckBox[] chBoxes)
 {
     cb.BeginText ();
     if (chBoxes [0].Checked)
     {
         cb.ShowTextAligned (0, "x", 156, 494, 0);
     };
     if (chBoxes [1].Checked)
     {
         cb.ShowTextAligned (0, "x", 262, 494, 0);
     };
     if (chBoxes [2].Checked)
     {
         cb.ShowTextAligned (0, "x", 368, 494, 0);
     };
     if (chBoxes [3].Checked)
     {
         cb.ShowTextAligned (0, "x", 474, 494, 0);
     };
     if (chBoxes [4].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 478, 0);
     };
     if (chBoxes [5].Checked)
     {
         cb.ShowTextAligned (0, "x", 517, 478, 0);
     };
     if (chBoxes [6].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 464, 0);
     };
     if (chBoxes [7].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 450, 0);
     };
     if (chBoxes [8].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 435, 0);
     };
     if (chBoxes [9].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 421, 0);
     };
     if (chBoxes [10].Checked)
     {
         cb.ShowTextAligned (0, "x", 456, 406, 0);
     };
     if (chBoxes [11].Checked)
     {
         cb.ShowTextAligned (0, "x", 467, 392, 0);
     };
     if (chBoxes [12].Checked)
     {
         cb.ShowTextAligned (0, "x", 467, 377, 0);
     };
     if (chBoxes [13].Checked)
     {
         cb.ShowTextAligned (0, "x", 142, 363, 0);
     };
     if (chBoxes [14].Checked)
     {
         cb.ShowTextAligned (0, "x", 207, 363, 0);
     };
     if (chBoxes [15].Checked)
     {
         cb.ShowTextAligned (0, "x", 286, 363, 0);
     };
     if (chBoxes [16].Checked)
     {
         cb.ShowTextAligned (0, "x", 365, 363, 0);
     };
     if (chBoxes [17].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 267, 0);
     };
     if (chBoxes [18].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 253, 0);
     };
     if (chBoxes [19].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 239, 0);
     };
     if (chBoxes [20].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 224, 0);
     };
     if (chBoxes [21].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 209, 0);
     };
     if (chBoxes [22].Checked)
     {
         cb.ShowTextAligned (0, "x", 42, 196, 0);
     };
     if (chBoxes [23].Checked)
     {
         cb.ShowTextAligned (0, "x", 168, 267, 0);
     };
     if (chBoxes [24].Checked)
//.........這裏部分代碼省略.........
開發者ID:Apophes,項目名稱:Lieferschein,代碼行數:101,代碼來源:PDFManager.cs

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

示例12: DrawDateInfo

// ---------------------------------------------------------------------------            
    /**
     * Draws some text on every calendar sheet.
     * 
     */
    protected void DrawDateInfo(string day, int d, PdfContentByte directcontent) {
      directcontent.BeginText();
      directcontent.SetFontAndSize(bf, 18);
      float x, y;
      x = OFFSET_LOCATION;
      y = OFFSET_BOTTOM + HEIGHT + 24;
      directcontent.ShowTextAligned(
        Element.ALIGN_LEFT,
        "Day " + d, x, y, 0
      );
      x = OFFSET_LEFT + WIDTH;
      directcontent.ShowTextAligned(
        Element.ALIGN_RIGHT,
        day, x, y, 0
      );
      directcontent.EndText();
    }
開發者ID:,項目名稱:,代碼行數:22,代碼來源:

示例13: PrintTerms

        private MemoryStream PrintTerms(IEnumerable<GlossaryItem> terms)
        {
            float ppi = 72.0F;
            float PageWidth = 8.5F;
            float PageHeight = 11.0F;
            float TopBottomMargin = 0.625F;
            float LeftRightMargin = 0.75F;
            float GutterWidth = 0.25F;
            float HeaderFooterHeight = 0.125F;
            float Column1Left = LeftRightMargin;
            float Column1Right = ((PageWidth - (LeftRightMargin * 2) - GutterWidth) / 2) + LeftRightMargin;
            float Column2Left = Column1Right + GutterWidth;
            float Column2Right = PageWidth - LeftRightMargin;

            bool HasMultipleDefinitions = (terms.Count() > 1);

            string version = DataAccess.GetKeyValue("glossaryversion").Value;

            Document doc = new Document(new Rectangle(0, 0, PageWidth * ppi, PageHeight * ppi));

            MemoryStream m = new MemoryStream();

            PdfWriter writer = PdfWriter.GetInstance(doc, m);
            writer.CloseStream = false;

            try {
                doc.AddTitle("The Glossary of Systematic Christian Theology");
                doc.AddSubject("A collection of technical terms and associated definitions as taught from the pulpit by Dr. Ron Killingsworth in classes at Rephidim Church.");
                doc.AddCreator("My program using iText#");
                doc.AddAuthor("Dr. Ron Killingsworth");
                doc.AddCreationDate();

                writer.SetEncryption(PdfWriter.STRENGTH128BITS, null, "xaris", PdfWriter.AllowCopy | PdfWriter.AllowPrinting | PdfWriter.AllowScreenReaders | PdfWriter.AllowDegradedPrinting);

                doc.Open();

                BaseFont bfArialBlack = BaseFont.CreateFont("C:\\windows\\fonts\\ariblk.ttf", BaseFont.WINANSI, false);
                BaseFont bfGaramond = BaseFont.CreateFont("C:\\windows\\fonts\\gara.ttf", BaseFont.WINANSI, false);
                Font fntTerm = new Font(bfArialBlack, 10, Font.BOLD, new BaseColor(57, 81, 145));
                Font fntDefinition = new Font(bfGaramond, 9, Font.NORMAL, new BaseColor(0, 0, 0));

                ///////////////////////////////////////////

                if (HasMultipleDefinitions) {
                    PdfContentByte cbCover = new PdfContentByte(writer);
                    cbCover = writer.DirectContent;

                    cbCover.BeginText();

                    cbCover.SetFontAndSize(bfGaramond, 42);
                    cbCover.SetRGBColorFill(57, 81, 145);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Glossary of", (PageWidth / 2) * ppi, ((PageHeight / 2) + Convert.ToSingle(1.5)) * ppi, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Systematic Christian Theology", (PageWidth / 2) * ppi, ((PageHeight / 2) + 1) * ppi, 0);

                    cbCover.SetFontAndSize(bfGaramond, 16);
                    cbCover.SetRGBColorFill(0, 0, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "A collection of technical terms and associated definitions", (PageWidth / 2) * ppi, ((PageHeight / 2) + Convert.ToSingle(0.6)) * ppi, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "as taught by Dr. Ron Killingsworth, Rephidim Church, Wichita Falls, Texas", (PageWidth / 2) * ppi, ((PageHeight / 2) + Convert.ToSingle(0.4)) * ppi, 0);

                    cbCover.SetFontAndSize(bfGaramond, 12);
                    cbCover.SetRGBColorFill(0, 0, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Published by:", (PageWidth / 2) * ppi, ((PageHeight / 2) - Convert.ToSingle(0.6)) * ppi, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "Rephidim Doctrinal Bible Studies, Inc.", (PageWidth / 2) * ppi, ((PageHeight / 2) - Convert.ToSingle(0.8)) * ppi, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "4430 Allendale Rd., Wichita Falls, Texas 76310", (PageWidth / 2) * ppi, ((PageHeight / 2) - Convert.ToSingle(1.0)) * ppi, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "(940) 691-1166     rephidim.org     [email protected]", (PageWidth / 2) * ppi, ((PageHeight / 2) - Convert.ToSingle(1.2)) * ppi, 0);

                    cbCover.SetFontAndSize(bfGaramond, 10);
                    cbCover.SetRGBColorFill(0, 0, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_LEFT, "Version: " + version + " / " + terms.Count() + " terms", (LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);

                    cbCover.SetFontAndSize(bfGaramond, 10);
                    cbCover.SetRGBColorFill(0, 0, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_RIGHT, "© 1971-" + DateTime.Today.Year.ToString() + " Dr. Ron Killingsworth, Rephidim Doctrinal Bible Studies, Inc.", (PageWidth - LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);

                    cbCover.EndText();

                    doc.NewPage();

                    ///////////////////////////////////////////

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

                    cbBlank.BeginText();

                    cbCover.SetFontAndSize(bfGaramond, 10);
                    cbCover.SetRGBColorFill(0, 0, 0);
                    cbCover.ShowTextAligned(PdfContentByte.ALIGN_LEFT, " ", (LeftRightMargin) * ppi, (TopBottomMargin) * ppi, 0);

                    cbBlank.EndText();

                    doc.NewPage();

                    ///////////////////////////////////////////

                }

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

//.........這裏部分代碼省略.........
開發者ID:jslaybaugh,項目名稱:rephidim-web,代碼行數:101,代碼來源:GlossaryController.cs

示例14: RenderTextElement

 private void RenderTextElement(TextElement el, PdfContentByte dc)
 {
     var color = new BaseColor(el.FontColor);
     var font = el.FontBold ? fontBold : this.font;
     dc.SetColorFill(color);
     dc.SetFontAndSize(font, el.FontSize);
     dc.BeginText();
     dc.ShowTextAligned(PdfContentByte.ALIGN_LEFT, el.Text, TranslateLeft(el), TranslateTop(el), 0);
     dc.EndText();
     //var ct = new ColumnText(dc);
     //var p = new Phrase(new Chunk(el.Text, new iTextSharp.text.Font(font, el.FontSize)));
     //ct.SetSimpleColumn(p,
     //    TranslateLeft(el),
     //    TranslateTop(el) - el.Height,
     //    TranslateLeft(el) + el.Width,
     //    TranslateTop(el),
     //    0,
     //    iTextSharp.text.Element.ALIGN_LEFT | iTextSharp.text.Element.ALIGN_TOP);
     //ct.Go();
 }
開發者ID:koraytaylan,項目名稱:ReportSharp,代碼行數:20,代碼來源:PdfRenderer.cs

示例15: CreateLayerInLegend

  private bool CreateLayerInLegend(PdfContentByte content, Configuration.MapTabRow mapTab, List<CommonLayer> layerList, LegendProperties properties, CommonLayer layer, float indent)
  {
    if (!layerList.Contains(layer))
    {
      return false;
    }

    float layerHeight = GetLayerHeightInLegend(layerList, properties, layer);

    if (properties.CurrentY < properties.Height && properties.CurrentY - layerHeight < 0)
    {
      if (properties.CurrentColumn == properties.NumColumns)
      {
        return true;
      }

      properties.CurrentX += properties.ColumnWidth + properties.ColumnSpacing;
      properties.CurrentY = properties.Height;
      properties.CurrentColumn += 1;
    }

    int numClasses = GetNumClasses(layer);

    Configuration.LayerRow configLayer = mapTab.GetMapTabLayerRows().Where(o => String.Compare(o.LayerRow.LayerName, layer.Name, true) == 0).Select(o => o.LayerRow).FirstOrDefault();
    string layerName = configLayer != null && !configLayer.IsDisplayNameNull() ? configLayer.DisplayName : layer.Name;

    // write the layer name

    if (layer.Type == CommonLayerType.Group || numClasses > 1)
    {
      properties.CurrentY -= properties.FontSize;
      string name = layerName;

      try
      {
        while (content.GetEffectiveStringWidth(name, false) > properties.ColumnWidth - indent)
        {
          name = name.Substring(0, name.Length - 1);
        }
      }
      catch { }

      content.BeginText();
      content.SetFontAndSize(properties.BaseFont, properties.FontSize);
      content.SetRGBColorFill(0, 0, 0);
      content.ShowTextAligned(PdfContentByte.ALIGN_LEFT, name, properties.OriginX + properties.CurrentX + indent, properties.OriginY + properties.CurrentY + (properties.SwatchHeight - properties.FontSize) / 2, 0);
      content.EndText();
    }

    if (layer.Type == CommonLayerType.Group)
    {
      properties.CurrentY -= properties.LayerSpacing;

      foreach (CommonLayer childLayer in layer.Children)
      {
        CreateLayerInLegend(content, mapTab, layerList, properties, childLayer, indent + 1.5f * properties.FontSize);
      }
    }
    else
    {
      properties.CurrentY -= properties.ClassSpacing;

      foreach (CommonLegendGroup legendGroup in layer.Legend.Groups)
      {
        foreach (CommonLegendClass legendClass in legendGroup.Classes)
        {
          if (!legendClass.ImageIsTransparent)
          {
            properties.CurrentY -= properties.SwatchHeight;

            MemoryStream stream = new MemoryStream(legendClass.Image);
            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(stream);
            float w = properties.SwatchHeight * bitmap.Width / bitmap.Height;

            iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(legendClass.Image);
            image.SetAbsolutePosition(properties.OriginX + properties.CurrentX + indent, properties.OriginY + properties.CurrentY - properties.SwatchHeight * 0.1f);
            image.ScaleAbsolute(w, properties.SwatchHeight);
            content.AddImage(image);

            string label = numClasses > 1 ? legendClass.Label : layerName;

            try
            {
              while (content.GetEffectiveStringWidth(label, false) > properties.ColumnWidth - properties.SwatchWidth - properties.ClassSpacing)
              {
                label = label.Substring(0, label.Length - 1);
              }
            }
            catch { }

            content.BeginText();
            content.SetFontAndSize(properties.BaseFont, properties.FontSize);
            content.SetRGBColorFill(0, 0, 0);
            content.ShowTextAligned(PdfContentByte.ALIGN_LEFT, label, properties.OriginX + properties.CurrentX + indent + properties.SwatchWidth + properties.ClassSpacing, properties.OriginY + properties.CurrentY + (properties.SwatchHeight - properties.FontSize) / 2, 0);
            content.EndText();

            properties.CurrentY -= properties.ClassSpacing;
          }
        }
      }
//.........這裏部分代碼省略.........
開發者ID:ClaireBrill,項目名稱:GPV,代碼行數:101,代碼來源:PdfMap.cs


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