Underlining a string using iText

前端 未结 1 1774
滥情空心
滥情空心 2021-01-21 14:48

So I am writing to a pdf through java using iText. I want to have a blank signature and date spaces underlined. Everything I read said to do it like so:

    Ch         


        
相关标签:
1条回答
  • 2021-01-21 14:58

    You are concatenating String with Chunk objects. Add the underlines as Chunk's

        Chunk sigUnderline = new Chunk("                                            ");
        sigUnderline.setUnderline(0.1f, -2f);
        Chunk dateUnderline = new Chunk("                       ");
        dateUnderline.setUnderline(0.1f, -2f);
    
        Paragraph para = new Paragraph("Authorized Signature: ");
        para.add(sigUnderline);
        para.add(new Chunk(" Date: "));
        para.add(dateUnderline);
    
        document.add(para);
    
    0 讨论(0)
提交回复
热议问题