Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>private PdfContentByte pdfContentByte; private string DescriptionToPrint="Hii!! I will be underlined." private Int32 AlignmentofDescription = 3; private float XofDescription = 110; private float YofDescription = 440; private float RotationofDescription = 0; </code></pre> <p>to write PDF using pdfcontentbyte we generally use the following </p> <p>(begin text &amp; end text)</p> <p>format </p> <pre><code>pdfContentByte.BeginText(); pdfContentByte.ShowTextAligned(PdfContentByte.ALIGN_LEFT, DescriptionToPrint.ToString(), XofDescription, YofDescription, RotationofDescription); pdfContentByte.EndText(); </code></pre> <p>There is an alternative for the above technique also, which is quiet flexible too.</p> <p>This is if you want the same formatting that you have applied to <code>pdfcontentbyte</code> using <code>BaseFont</code></p> <pre><code>//ColumnText.ShowTextAligned(pdfContentByte, Element.ALIGN_LEFT, new Phrase(DescriptionToPrint), XofDescription, YofDescription, RotationofDescription); </code></pre> <p>If you want to underline the text, then inside <code>Phrase</code> place <code>Chunk</code></p> <pre><code> ColumnText.ShowTextAligned(pdfContentByte, Element.ALIGN_LEFT, new Phrase(new Chunk(DescriptionToPrint.ToString(), FontFactory.GetFont(FontFactory.HELVETICA, 8, Font.UNDERLINE))), XofDescription, YofDescription, RotationofDescription); </code></pre> <p>here the line mentioned below is actually the fix.</p> <pre><code>new Phrase(new Chunk(DescriptionToPrint.ToString(), FontFactory.GetFont(FontFactory.HELVETICA, 8, Font.UNDERLINE))) </code></pre> <p>For ColumnText we have to provide the text using <code>new Phrase</code> in which we can access font properties which actually <code>base font</code> was not allowing us to access.</p> <p>Inside <code>Phrase</code> <code>Chunk</code> is providing the required formatting to the text.</p> <p>Their are lots of examples available on net regarding use of <code>chunk</code></p> <p>If you want to pass <strong>float values</strong> like this(20.25) these will be recognized as double by this class use <strong>"20.25f"</strong> then they will be taken as float and will work...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload