Mitkees & Webcenter

Into the charm of Oracle Webcenter and ADF

Webcenter Imaging : Delete a tif page from a multi TIF page

One of the best use of Oracle IPM is to act as a front-end to your Webcenter content . but Unfortunately, it has limited capabilities on a content so  I will show you how to extend its capabilities  using IPM APIs.

We can edit the View ( and view only) of the IPM to add buttons that fire actions in different web applications you have created for the logic you need.

In this post will show you steps how to extend the IPM Viewer Features by adding a button to delete a page from the content of type multi TIF.

  1. create a web application
  2. Add imaging-client.jar to the project class path in order to be able to use IPM APIs
  3. create class that have the Delete tif page logic as follows
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.util.ArrayList;
    import java.util.List;
    public class TiffDeleterClass {
    public TiffDeleterClass() {
    public String countPages(String DocumentID) throws IOException{
    String tempDirectory="D:\\Oracle\\Middleware\\user_projects\\domains\\MGRP_domain\\ucm\\cs\\vault\\~temp\\";
    String pagesCount="0";
    List images = new ArrayList();
    FileSeekableStream ss = new FileSeekableStream(tempDirectory+DocumentID);
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", ss, null);
    int count = dec.getNumPages();
    return ""+count;
    public void deleteTifPage(String DocumentID,int pageNumber) throws IOException {
    String tempDirectory="c:\\ipm\\";
    int pageToBeDeleted = 1;
    List images = new ArrayList();
    FileSeekableStream ss = new FileSeekableStream(tempDirectory+DocumentID+".tif");
    ImageDecoder dec = ImageCodec.createImageDecoder("tiff", ss, null);
    int count = dec.getNumPages();
    // System.out.println(count);
    for (int i = 1; i <= count; i++) {
    if(i== pageToBeDeleted) continue;
    PlanarImage op = new NullOpImage(dec.decodeAsRenderedImage(i-1), null, null, OpImage.OP_IO_BOUND);
    TIFFEncodeParam params = new TIFFEncodeParam();
    OutputStream out = new FileOutputStream(tempDirectory +"deleted\\"+DocumentID +".tif");
    ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", out, params);
    List imageList = new ArrayList();
    for (int i = 1; i < images.size(); i++)
  5. create  a page or servlet that get the request with the page need to be deleted and the contentID and call the needed method in the previous class.
  6. deploy the application and test it using the browser
  7. customize the IPM and add a button and set the action to be the page/servlet and pass the required paramters

Leave a Reply

Please log in using one of these methods to post your comment: 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: