The following example demonstrates how to create a simple PDF form using iText.
- Download the latest version of iText (v 1.4.7).
- The following piece of code can be used to generate a simple pdf with some text on it
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class TestiText {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("c:\\test.pdf"));
document.open();
document.add(new Paragraph("iText Works :)"));
} catch (DocumentException de) {
de.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
document.close();
}
}TestiText.java Paragraph is one of the page elements in iText a listing of the page elements can be found here.
hello,
ReplyDeletemerging two pdfs throws java.io.IOException: PDF header signature not found exception.
what is the reason?
regards,
Rakesh Parmar
same here:
ReplyDeletegot this exception:
.IOException: PDF header signature not found
any tipp? thanks
Hi,
ReplyDeleteWill u tell me how to open the generated Pdf as i didnt save anywhere ...
and I just added a String into the document . Is this enough to generate the PDF????
regards,
Jai
This site is good and I found very interesting stuff here. Great job, thanks
ReplyDeleteKeep us posted with new updates. its was really valuable. thanks a lot.
ReplyDeleteYou make so many great article here and I read your article a couple of times.
ReplyDeleteI’m impressed with this article, I must say this is one of the best blog!!
ReplyDeleteThank you for this great read!! I definitely enjoy every little bit of it,
ReplyDeleteHello there! Big thumbs up for the excellent info have got here on this post.
ReplyDelete