Khalid Amin
Khalid Amin

Reputation: 902

How to use an existing PDF letterhead in JasperReports

I have PDF letterhead with a header and a footer. I have to print my reports on this "electronic letterhead". How can I do this? Do I need to use any third party libraries? Is there a more appropriate approach (instead of modifying existing PDF) to achieve this?

Upvotes: 3

Views: 1091

Answers (1)

Dave Jarvis
Dave Jarvis

Reputation: 31211

If all you have is the PDF, do this:

  1. Convert the PDF to an image.
  2. Split the header and footer into two images.
  3. Place the images on the Background Band.

There are a few ways to convert the image, and some details:

  • Use a high-resolution (600 dpi) version of the image.
  • Use ImageMagick to automate the process.
  • Split the image in half, then trim both halves.
  • Use PNG format (not JPEG) for highest quality results.

This way you do not have to modify the PDF. The PDF remains the master and the images get included by JasperReports.

Upvotes: 2

Related Questions