drewich Posted October 28, 2010 Share Posted October 28, 2010 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 More sharing options...
jmurray Posted October 28, 2010 Share Posted October 28, 2010 There is currently no way to embed PDF content in JasperReports.http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=80158 Link to comment Share on other sites More sharing options...
drewich Posted October 28, 2010 Author Share Posted October 28, 2010 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 More sharing options...
jmurray Posted October 28, 2010 Share Posted October 28, 2010 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> <hyperlinkReferenceExpression><![CDATA[$F{WEEKLY}]]></hyperlinkReferenceExpression> </image>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:select REGION, SITENAME, SERVICE_ID, BANDWIDTH , '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_consumptionYou 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 More sharing options...
drewich Posted October 29, 2010 Author Share Posted October 29, 2010 Nice example! Thank you. Will try something like that :) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now