Jump to content

Adding PDF content to report


Recommended Posts

Hi! I´ve been searching if this is possible, but haven´t found a clue.

So here is my question. It´s possible to add the content from an existing PDF into my report?

If it is not possible directly from iReport how can I achieve that?

Thanks to all :)

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Thank you for the fast reply jmurray.

Well, as said in that thread it surely would be a good enhancement for a new version.

I was trying to store the PDF content in a stream so I can pass it as a parameter to iReport and print it there... but can´t make it work yet...

Do you think I can accomplish that way? If so... how?

Thank you.

Link to comment
Share on other sites

The only way I've ever been able to include dynamic content is by inserting an image that references a cgi or php script that can generate and return images on the fly.  The following example uses a field called WEEKLY to display a graph of weekly network utilisation:   

   <image hyperlinkType="Reference">
    <reportElement key="image-1" x="395" y="10" width="385" height="160"/>
     <imageExpression class="java.lang.String"><![CDATA[$F{WEEKLY}]]></imageExpression>

To get the graph generated the report's query must provide the URL of the script plus all the parameters required to generate the right graph for each row, like this:

     , 'http://mywebsite.mycompany.com/weathermap/proxy.php?url=http://cricket.mycompany.com/?type=png;target=' || substr(rrdpath,14,length(rrdpath)-17) || ';inst=0;dslist=ifHCInOctets%2CifHCOutOctets;range=604800;rand=763' as WEEKLY
  from bw_consumption

You may be able to do a similar thing with your PDFs.   In the example above the URI reference points to a PHP script that is simply a wrapper that calls a cricket grapher with the appropriate parameters and receives a bitstream back from the cricket grapher.  This bitstream is rerendered as an image that can be displayed in the report.  The attachment shows how this method was used to create weekly, monthly and yearly views of network traffic on the fly for any number of sites.


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...