Adding text to Webtop delivered documents

I always thought that it would be pretty cool to use Webtop as a viewing tool directly – something that access a Docbase directly.  If you have umpteen million users – then caching is a good idea – but in a corporate environment where a few thousand users – well why not.

So I use Webtop as the delivery platform and the virtual link component.  I’m sure you could do this better – but this works fine.  The idea is that a user access a document using a virtual link – a straight HTTP link.  The document must be PDF – and when it comes out of the repository – its stamped with a small watermark.  This gives a better level of integrity – if you print it off for example then you’d know where it came from.  With everything being in Webtop it gives you a good opportunity to add in any Documenutm properties/values that may be appropriate for content.

You need iText – without doubt brilliant.

Add that as an external JAR to your Webtop Eclipse project.  I put the iText jar into the tomcat lib.

Create a custom package area in webtrop/custom/src/com/document/web/virtuallink – place this file in it.  http://www.dhrobertson.com/projects/vlink/VirtualLink404Handler.java  That should recompile and replace the class file in the webtop app.  You could also do this by subclassing the whole thing – but it seemed easier to do it this way. 

All that happens is when the document eventually gets extracted from the repository – an iText function is called to create a new file – this is the one thats viewed.  Its all done in a local folder so everything gets deleted by Documentum – which is handy

Thats it – the watermark I’ve applied is a bit crap – but you can buy the iText book – details here http://itextpdf.com/book/index.php and do your own thing… If you want.

You can also extend the view action – so that you can do same sort of thing with a view of a document.  Its a bit more involved – but extending webtop view action. 

Again I did this with full debug on Webtop – that works very well I have to say and using iText means that it works on ‘nix and Windows platforms…

Advertisements