Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Unable to get watermark on PDF export with 3.7
mongonv
I am using MyEclipse 10.7 with the embedded BIRT 3.7 and have several reports that were originally created with BIRT 2.5x with watermarks on the master pages. After upgrading to the latest BIRT, watermarks on the master pages no longer show in the exported PDF's from the app.
I have tried the master page, grids on the master page, setting the background on grids within the pages created in the report (essentially 3 reports put on 3 pages within the report) and nothing has put the watermarks back on the exported PDF files.
I have tried putting the images in the report folder, WEB-INF/report-engine/images folder and neither worked. I have been doing the image as embedded not a URL. I tried using the same image this is inserted into cells at the top of each page, but it does not show as a background image either.
The image is static, so no dynamic changes needed, just need the watermark to show on each page.
Any help would be greatly appreciated.
Ed
Find more posts tagged with
Comments
Deros
I'm using some dynamic background picture with: <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>var myurl = reportContext.getResource("BIRTSERVER/WEB-INF/somePic.jpg");
reportContext.getDesignHandle().findStyle("BackgroundStyle").backgroundImage = myurl;</pre>
<br />
at "beforeFactory" and it works...
mongonv
Thanks for the reply, that lead me to the correct answer for Java.<br />
<br />
For those that need the Java answer, here is the code that came out the issue:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>RunAndRenderTask task = (RunAndRenderTask) birtReportEngine.createRunAndRenderTask(design);
IReportContext reportContext = task.getReportContext();
// Set the background image
URL imgUrl = reportContext.getResource("myImage.png");
reportContext.getDesignHandle().findStyle("masterPgStyle").setBackgroundImage(imgUrl.toString());</pre>
<br />
The key issue is that you have to cast the "birtReportEngine.createRunAndRenderTask(design);" to a "RunAndRenderTask" in order to get to the proper methods and you only use the file name in the path.<br />
<br />
The report needs to have the image as an embedded image and the style set on the master page background. I could not get it to work correctly without embedding the image. If anyone has a non-embedded solution example, would you please post that.