Originally posted by sever oon: Hey all, Does anyone know how to convert HTML to PDF using a completely Java, platform-independent solution? Thanks! sev
The easiest way to do this is to download HTMLdoc from www.easysw.com What it provides is a dos command which if excuted from the java runtime produces a PDF for the specified HTML. What you have to do is to pass the html file name ( source) and the PDF file name( target ) ... Its all given in the manual . I did it today all the best
Thanks all... Unfortunately I can't use any DOS stuff--that's not exactly 100% Java (plus, we have to be able to run this software on customers' servers--they're not going to all be running a DOS-based system). Converting to XSL-FO solves the problem but I'm trying to avoid doing that work--if I was redesigning the system I'd have everything in FO and transform it from there to the format required for whatever medium (HTML, PDF, etc). That's not an option in this case because it's so hard to get to FO from HTML right now... Looks like iText gets the prize. Now I only have to see if it costs money... Thanks again all. sev
Test it carefully too; we tried iText, but it didn't render our HTML accurately. We would have needed to make some changes to it in order to get it to reproduce in a WYSIWYG fashion. I know you don't want to re-architect the application, that's why we took the approach we did, but depending upon how much you see the application changing and the potential for it to be exposed via other devices (i.e. pda, etc.) you might want to look at creaing generic xml representations of screens and using Jakara Cacoon to render it in whatever way you need it. It does, by the way have a nice PDF renderer. Good luck!