Dependency error in jasper-reports from itext

A much simpler solution may be to upgrade to a newer version of jasperreports. Version 6.1.0 has this dependency on iText: <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7.js2</version> <scope>compile</scope> </dependency> No more “floating” dependency on iText, and it’s a version that’s custom made for jasperreports! See http://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/6.1.0 for the complete pom.xml.

Add Header and Footer for PDF using iTextsharp

As already answered by @Bruno you need to use pageEvents. Please check out the sample code below: private void CreatePDF() { string fileName = string.Empty; DateTime fileCreationDatetime = DateTime.Now; fileName = string.Format(“{0}.pdf”, fileCreationDatetime.ToString(@”yyyyMMdd”) + “_” + fileCreationDatetime.ToString(@”HHmmss”)); string pdfPath = Server.MapPath(@”~\PDFs\”) + fileName; using (FileStream msReport = new FileStream(pdfPath, FileMode.Create)) { //step 1 using (Document … Read more

Using iText to convert HTML to PDF

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 … Read more

Compare these products for PDF generation with Java given requirements inside: iText, Apache PDFBox or FOP? [closed]

iText; nowadays iText is a commercial library, the latest version is not for free anymore (a fork of an older version remains under MIT license: OpenPDF) FOP; I worked a lot with FOP. It’s fairly resource intensive (Java > XML > XSLT > PDF) and complex PDFs become a nightmare ( may result in XSLTs … Read more

iText landscape orientation and positioning?

You’re using PageSize.A4_LANDSCAPE, a variable that was introduced by a contributor and that should have never been added to the main release. Please use PageSize.A4.rotate() instead. It’s not clear what you want to achieve with the lines: document.left(100f); document.top(150f); Those are getters, not setters. It looks as if you’re assuming that PDF is similar to … Read more

Hiding table border in iTextSharp

Although I upvoted the answer by Martijn, I want to add a clarification. Only cells have borders in iText; tables don’t have a border. Martijn’s suggestion to set the border of the default cell to NO_BORDER is correct: table.DefaultCell.Border = Rectangle.NO_BORDER; But it won’t work for the code snippet provided in the question. The properties … Read more

How can I insert an image with iTextSharp in an existing PDF?

If you want to change the contents of an existing PDF file and add extra content such as watermarks, pagenumbers, extra headers, PdfStamper is the object you need. I have successfully used the following code to insert an image into an existing pdf file to a given absolute position: using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; … Read more