how to print statements from jtextextarea to pdf file?

how to print text from JTextArea to PDF file? I have tried some methods but that does not work properly. Please help me out, I’m new to Java.

textArea.addActionListener(new ActionListener() {

    public void actionPerformed (ActionEvent arg0) {
        try {

        } catch() {

        }