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: Kagul Grogami
Country: Montenegro
Language: English (Spanish)
Genre: Art
Published (Last): 14 May 2013
Pages: 58
PDF File Size: 1.61 Mb
ePub File Size: 3.66 Mb
ISBN: 678-3-11817-594-4
Downloads: 96398
Price: Free* [*Free Regsitration Required]
Uploader: Shaktilmaran

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”. Basically, it seems that it will only be written into the PDF after I close the pane. The book is about Jeditodpane. Aug 2, 1: I want to point out that the solution above uses com. Search everywhere only in this topic.

iText – Creating PDF using JEditorPane

How to save a JEditorPane as a pdf? 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?

Frakcool 7, 5 25 Post as a jeditoorpane Name. Aug 1, 9: Characters are added at absolute positions. Did I do my codes wrongly?

Как сохранить JEditorPane как PDF?

I prefer 2 Second issue: Jul 31, 2: Jul 24, 6: Sign up or log in Sign up using Google. Or you write your text on different sheets of paper of which you know the width and the height ltext advance.


iyext I fail to see why your code snippet should generate a PDF with content. You’ll have to post the question to the mailing list. There is a character kind: This way, he understands the concept of pages the same way you get the concept of pages when using Word in page view.

While you are writing, you know the width, but not the length.

I’m not that familiar with Swing. Grazie and excuse me for my language. If there is no answer: I’m looking for a solution based on an external library, i tried expermenting with iText and PDFBox, to no avail so far. Can you show how it would be done using iText? Compare it with paper. ihext

Based on your code snippet, I can tell what the myPane object is. But it’s not an iText problem, is it? Currently whatever cannot fit the page is being cut off, and I only have 1 page in the PDF.

Jul 17, 9: Meanwhile, can you point me to some part where I can learn how to print the info from JEditorpane into multiple page in the PDF? Jul 17, otext The concept of lines is inexistent in PDF. I have found the reason that it’s blank, though I have yet to find a way to overcome it.


But that’s obvious, isn’t it?

PdfGraphics2D implements the Graphics interface. When I tried to open the PDF created, the message that is returned is: Powered by JForum 2. I have used, a file.

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

Thanks a lot for your help! It’s purely a Swing problem: Not an iText related one. Not necessarily in the order you might expect.

So, without further explanation, here’s the code that achieves the results above: Just create a PdfGraphics2D instance and let the editor pane paint itself to this instance.

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:.