Re:write the Document to pdf file directly?

Discussion in 'Java' started by pvii007, Jul 10, 2005.

  1. pvii007

    pvii007 Guest

    Hi, all.

    Recently, I write a program like the notepad. I want to output text to pdf
    file.
    I use JTextComponent.getDocument() method to get the document in the
    JEditorPane.

    And then I use Document.getText(0,Document.getLength()) to get the text in
    the document.

    Use itext to write the String value to the pdf file.

    But if the Document in the JTextComponent has the style such as Bold
    font,Strikethrough and so on,

    how to write this Document to pdf file.

    Is there any other third party package which can write
    javax.swing.text.Document Object to pdf file directly?


    Otherwise, I want to convert the Document to the rtf file and then write the
    rtf to pdf.

    There is also a problem.

    JEditorPane has method setEditorKit( EditorKit kit ).

    I setEditorKit javax.swing.text.rtf.RTFEditorKit, set RTFEditorKit instance
    write method and write the Document to the rtf file.

    The rtf file hasn't the style in the Document.Why?
     
    pvii007, Jul 10, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ellie
    Replies:
    1
    Views:
    526
    Andrew Thompson
    Jul 20, 2004
  2. pavan
    Replies:
    3
    Views:
    8,662
    venkat.sadasivam
    Nov 5, 2008
  3. =?iso-8859-1?q?Ricardo_R=EDos?=

    How to print pdf file directly to printer

    =?iso-8859-1?q?Ricardo_R=EDos?=, Aug 15, 2007, in forum: Java
    Replies:
    17
    Views:
    1,032
    Ian Wilson
    Aug 17, 2007
  4. Ricardo Pog
    Replies:
    1
    Views:
    436
    Austin Ziegler
    Mar 26, 2008
Loading...

Share This Page