How do I paint Swing Components to a PDF file with iText?

后端 未结 3 941
北恋
北恋 2020-12-19 10:34

I would like to print my Swing JComponent via iText to pdf.

JComponent com = new JPanel();
com.add( new JLabel(\"hello\") );

PdfWriter writer = PdfWriter.g         


        
3条回答
  •  北海茫月
    2020-12-19 11:16

    I have figured it out adding addNotify and validate helps.

        com.addNotify( );
        com.validate( );
    

提交回复
热议问题