Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using iText to convert HTML to PDF

Tags:

html

pdf

itext

Does anyone know if it is possible to convert a HTML page (url) to a PDF using iText?

If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just spend some money on one of a number of components which I know can :)

Thanks in advance for your responses!

like image 527
Mark Avatar asked Oct 25 '08 03:10

Mark


People also ask

Can we convert HTML to PDF in Java?

Convert HTML to PDF using URL in Java Get the web page into the InputStream object. Create the Document object and initialize it with InputStream and HtmlLoadOptions objects. Save HTML stream as PDF using Document. save() method.

Is iText PDF free?

You have to pay for it. To answer your question: iText can be used for free in situations where you also distribute your software for free. As soon as you want to use iText in a closed source, proprietary environment, you have to pay for your use of iText.

What is itext7?

iText 7 Core is a straightforward, performant and extensible library that is ready to handle the challenges of today's digital document workflows. Embed iText 7 Core's code libraries in applications to create the type of PDF files you want.

What is iText format?

iText is a Java library originally created by Bruno Lowagie which allows to create PDF, read PDF and manipulate them.


1 Answers

I think this is exactly what you were looking for

http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html

http://code.google.com/p/flying-saucer

Flying Saucer's primary purpose is to render spec-compliant XHTML and CSS 2.1 to the screen as a Swing component. Though it was originally intended for embedding markup into desktop applications (things like the iTunes Music Store), Flying Saucer has been extended work with iText as well. This makes it very easy to render XHTML to PDFs, as well as to images and to the screen. Flying Saucer requires Java 1.4 or higher.

like image 102
opensas Avatar answered Sep 22 '22 12:09

opensas