« Return to Thread: Absolute Postion of Bolded Text?

Re: Absolute Postion of Bolded Text?

by Belmiris :: Rate this Message:

Reply to Author | View in Thread

Okay, I'm very confused now with the positioning of column text. I figured out that the BOTTOM of the page is zero so to draw downwards but I cannot seem to reliably place the text. If I subtract the text height

txtHeight = bf.GetAscentPoint("XXX", lbl.Font.Size) - bf.GetDescentPoint("XXX", lbl.Font.Size);

from the 'top' of the LETTER sized document (842) it draws off the top of the page. Even worse, if I change to bottom coordinate 'ury' of an ALIGN_TOP column text, it moves the text position. Here is my sample code for drawing the column text

                        txtHeight = bf.GetAscentPoint("XXX", lbl.Font.Size) -
                                        bf.GetDescentPoint("XXX", lbl.Font.Size);

                        float top = 780;
                        float bot = top + txtHeight * 2;
                        Phrase phrase3 = new Phrase(top.ToString(), font);
                        ct.SetSimpleColumn(phrase3, 10, top, 100, bot, 1, Element.ALIGN_TOP);
                        ct.Go();



I kind of got it working with ColumnText. But I will look into datatables. I am trying to copy labels from a C# form into a pdf.

ct = new ColumnText(cb);
Font font2 = new Font(bf, lbl.Font.Size, (int)lbl.Font.Style);
Phrase phrase2 = new Phrase("1", font);
ct.SetSimpleColumn(phrase2, 10, h, 100, 10, 1, Element.ALIGN_TOP);
ct.Go();

Shawn Davies wrote:
Try this:

iTextSharp.text.Font fBoldFont =
FontFactory.GetFont(FontFactory.HELVETICA, 8,
iTextSharp.text.Font.BOLD);
datatable.AddCell(new Paragraph(colName.ToUpper(), fBoldFont));



Shawn.Davies@Macrovision.com


-----Original Message-----
From: Belmiris [mailto:rickcimbalo@yahoo.com]
Sent: Sunday, June 14, 2009 8:44 AM
To: itextsharp-questions@lists.sourceforge.net
Subject: [itextsharp-questions] Absolute Postion of Bolded Text?


Hello. I'm pretty new to iText and just went thru the tutorial but could
not
find a way to set text with a bolded font absolutely in a document
(ShowTextAligned() only allows the basefont). Is there a way to do this?
(shortly I will need styles like italic as well)

Thanks for any help.
--
View this message in context:
http://www.nabble.com/Absolute-Postion-of-Bolded-Text--tp24021778p240217
78.html
Sent from the itextsharp-questions mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

 « Return to Thread: Absolute Postion of Bolded Text?