ColumnText.ShowTextAligned() cuts off text after linebreak

前端 未结 2 1690
孤街浪徒
孤街浪徒 2021-01-29 03:55

I have the following code to print a text onto a PDF document using iTextSharp:

canvas = stamper.GetOverContent(i)
watermarkFont = iTextSharp.text.pdf.BaseFont.C         


        
2条回答
  •  感情败类
    2021-01-29 04:12

    ColumnText.ShowTextAligned has been implemented as a short cut for the use case of adding a single line at a given position with given alignment. Confer the source code documentation:

    /** Shows a line of text. Only the first line is written.
     * @param canvas where the text is to be written to
     * @param alignment the alignment
     * @param phrase the Phrase with the text
     * @param x the x reference position
     * @param y the y reference position
     * @param rotation the rotation to be applied in degrees counterclockwise
     */    
    public static void ShowTextAligned(PdfContentByte canvas, int alignment, Phrase phrase, float x, float y, float rotation)
    

    For more generic use cases please instantiate a ColumnText, set the content to draw and the outlines to draw in, and call Go().

提交回复
热议问题