Business Intelligence – Oracle

Oracle BI EE – Adding Watermarks to Delivered PDF Documents – Using PDF Merger API of BI Publisher

Posted by Venkatakrishnan J on February 4, 2008

In the previous blog entry we have seen how to go about delivering documents to a local file system using the Delivery Manager API of BI Publisher. Along the same lines, lets look at another very interesting feature which is the PDF WaterMarking feature. Many a time you might want to watermark your documents (especially PDFs) when you send out to multiple users via iBots. Watermarking is not available out of the box for BI EE. This is where BI Publisher can come to our rescue ( i always wonder how both BI EE and BI Publisher complement each other some times). In order to do watermarking, we need to use the PDF Merge API of BI Publisher and then call it from ibots. Lets look at the list of steps below. In the example below, i shall be adding an Oracle Logo as the watermark to a delivered BI EE PDF document.

1.   The first thing that you need is the following sample java code which combines your PDF output with a local image. This has to be included as part of the scheduler’s run method since the remote procedure call will only call this run method.

package bieesoap;

import oracle.apps.xdo.common.pdf.util.PDFDocMerger;




public class PDFMerge implements SchedulerJavaExtension{
public PDFMerge() {

public void run(SchedulerJobInfo jobInfo) throws SchedulerJobException {
FileInputStream[] inputStreams = new FileInputStream[1];
inputStreams[0] = new FileInputStream(jobInfo.getResultSetFile());
FileOutputStream outputStream = new FileOutputStream(“D:\\BIPAPI\\Output4.pdf”);

PDFDocMerger docMerger = new PDFDocMerger(inputStreams,outputStream);
FileInputStream imagePath = new FileInputStream(“D:\\BIPAPI\\oraclelogo_small.gif”);
float[] rct = {300f, 500f, -1f, -1f};
docMerger.setImageWatermark(imagePath, rct);
docMerger = null;

catch(Exception ex)
throw new SchedulerJobException(1, 1, ex.getMessage());


public void cancel() {


As you see above, what this does is, it calls the PDFDocMerger class. This class accepts 2 inputs, a stream of pdf inputs and a pdf output. It also accepts the setImageWatermark property which will set the watermark to the pointed image.

2.   Compile this class and bundle this as a jar along with the dependent jars (schedulerrpccalls.jar, versioninfo.jar and xdocore.jar). For more details on how to do this refer my blog entry here and here

3.   Now go to delivers and create an ibot. This ibot should contain a report exported in the PDF format. This PDF of the report will be watermarked with Oracle Logo.



4.   Once this is done, now go to your Advanced tab and call the class that we created above.


5.   Now save this ibot. As soon as this is done, you would notice that a new file called output4.pdf under D:\\BIPAPI would have been created and this would contain both the report and the watermark image.


Just add delivery manager API code to the above class and now you would be in a position to send the watermarked PDF to other users.This feature can be extended to a lot of other features like combining multiple reports into a single PDF etc.

One Response to “Oracle BI EE – Adding Watermarks to Delivered PDF Documents – Using PDF Merger API of BI Publisher”

  1. Bryan Wise said


    Good post on integrating BIP scheduler and Delivers. Another feature of BIP that will be useful in this process is to digitally sign the pdfs. This lets the user know that no modifications to the PDF have been made since it was generated.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: