0
votes

I used a wysiwyg editor (CKEditor) in my web application to provide a basic word processor for the user. I tried to save the output of that CKEditor to pdf document. I can now generate pdf document but the problem is the output of from CKEditor is in HTML code and it is getting published in pdf as it is. I want to publish that pdf document as seen in CKEditor, but I dont want those HTML tags in the pdf. Is there any libraries in Java to render or convert that html code to the plain text by eliminating those html tags but retaining their effect i.e. if HTML code has This is Bold then pdf should be saved as This is Bold not like <b> This is Bold</b>

2
What do you mean by? > if HTML code has This is Bold then pdf should be saved as This is Bold not like This is Boldshyam
oh no .. the editor on this page converted that html code . . Sorry ! Actually that last "This is Bold" in in bold tagAmit
Ah ok. Try installing something like CutePDF and opening up the html file in a browser and printing using the CutePDF printershyam
I am developing a web application. Generating PDF from the users input in CKEditor is one of the function of the web application.Amit
My bad !! Din't read through the question fullyshyam

2 Answers

1
votes

You can use a library to convert the HTML from ckeditor to PDF. There are quite a few options that will convert HTML to PDF. This flying-saucer project is one a good one: https://code.google.com/p/flying-saucer/.

0
votes

iText is a pretty popular library for converting HTML to PDF. However be mindful of the licensing associated with the version of iText you use if you do choose to use their library.