PDF to JTextPane: you need a PDF viewer: php?id=22 2. The concept of lines is inexistent in PDF. This page provides Java code examples for The examples are extracted from open source Java projects. disregard.. i found some ideas from the internet. i just added this new line after creating the JScrollPane. ferredSize(new.

Author: Magar Mauzil
Country: Uruguay
Language: English (Spanish)
Genre: Science
Published (Last): 12 September 2007
Pages: 329
PDF File Size: 17.34 Mb
ePub File Size: 16.85 Mb
ISBN: 685-6-50425-163-3
Downloads: 78242
Price: Free* [*Free Regsitration Required]
Uploader: Tarr

I assumed it would be possible. Imagethe former to convert the JComponent to images and the latter to print them in the PDF, this trick was found and based on this peeskillet’s answer. I can’t jedditorpane you. PDF as a format is not designed to be easily editable. How to save a JEditorPane as a pdf?

problems with rendering HTML using JEditorPane

I’m looking for a solution based on an external library, i tried expermenting with iText and PDFBox, to no avail so far. I have found the reason that it’s ktext, though I have yet to find a way to overcome it. Can you help me? Concerning the first issue. Hi Bruno, thanks for replying.

It did just what you needed. Did I do my codes wrongly? When clicked, the button opens a new Document, takes the area and converts it to an image, then adds that image to the PDF and later does the same with the button, so you get a similar output in a PDF like this one:.


Can you show how it would be done using iText? Powered by JForum 2. Currently whatever cannot fit the page is being cut off, and I only have 1 page in the PDF.

Stack Overflow works best with JavaScript enabled. Hi, I resolved all the questions, but there are others 3 problems. I’ve tried doing it the below way, but cannot create the PDF successfully.

Just create a PdfGraphics2D instance and let the editor pane paint itself to this instance. I have found an example in your book: Jul 17, 9: I remember writing such an example in answer to a question on the official iText mailing list.

So, without further explanation, here’s the code that achieves the results above: Aug 2, 1: Based on your code snippet, I can tell what the myPane object is.

Grazie and excuse me for my language. Jul 24, 7: I have displayed the pane so as to check the content, making it something like a browser. Jul 31, 2: Jul 24, 5: Aug 2, There are 2 possibilities: What is the problem? I don’t understand how to jeditoepane more pages and no only itest page. By jedihorpane “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie policyand that your continued use of the website is subject to these policies.

Most editors save the contents in another format. PDF from JTextPane good morning, I have resolved all problem, but i don’t understand the answer for my first problem, can you explain again? Post Your Answer Discard By clicking “Post Your Answer”, you acknowledge that you have read our updated terms of serviceprivacy policy and cookie jedittorpaneand that your continued use of the website is subject to these policies. Jul 30, 2: I’m not a Swing expert, but I think it’s possible to keep track of the cursor position in a JTextPane.


I need to make the contrary, that is from pdf to textPane, how I can make it? When finished writing, you take your scissors and cut the roll into pages. Sign itexr using Email and Password.

Not an iText related one.

java – How to save a JEditorPane as a pdf? – Stack Overflow

Frakcool 7, 5 25 If there is no answer: RTF, I convert the content of the file in a string, and I need to replace a particular substring with an other, but “going in a new line”. But that’s obvious, isn’t it? OK, I understand the example, but how I make to understand if the text in a pane is more of one page, e then I create an other object of Graphics2D? So there’s no Swing object that allows you to have a text editor with a fixed height.