Jump to content

Load PDF from Database, include in report


jholden699

Recommended Posts

 I found a couple of related posts but no answers....

We are using Jasper 4.5 (enterprise actually).  For one of the reports we run, we have the need to include supporting documentation, which will be stored in our Database in the form of varbinary(max) data (SQL 2008).

I can easily whip up a simple Java program to read the data from the DB and write to a file that I can then view as a PDF.

So - how can I include this PDF inline in the report I am generating (which will also be a PDF)?  Is this possible?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

No replies, so I thought I'd just post my workaround. I imagine this is not possible partly because of the fact that Jasper won't know what to do with the PDF if you're not RENDERING as a PDF (although my workaround could be incorporated easily to overcome this!).

 

My workaround: Using the PDF Renderer library (and an example found at http://blog.rubypdf.com/2008/01/30/pdftoimage-convert-pdf-to-image-by-using-pdfrenderer-library/source-code-of-pdf2image/) I actually save the pages of the PDF as PNG image files as a varbinary(max) field to the database. In the Jasper report, I load in this field as a java.awt.Image object. I can then insert an image, cancel out when iReport asks which file, and set the expression for my Image object to be my field loaded. It works - not very elegant, but it works.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...