cancel
Showing results for 
Search instead for 
Did you mean: 

PDFbox

jcobb
Champ in-the-making
Champ in-the-making
Can't find much on PDFbox on the wiki or in the forums. I see PDFbox is capable of some useful stuff - merging pdf's and encrypting them.

I'd like to be able to access this from webscripts, and/or from workflows, ie via javascript.

The sort of things I have in mind - running a 'publish' action that converts a .doc to pdf, creates a front sheet pdf from metadata (using the forge project for xsl-fo) merges the two and then encrypts the pdf to protect against copying / printing.

Are pdfbox functions exposed via the javascript api? If not, what would be the easiest way to do this? (given I'm happy with scripting, but am not into compiling alfresco…)

thanks
James
3 REPLIES 3

schambon
Champ in-the-making
Champ in-the-making
Hi,

So far as I'm aware the pdfbox api is not exposed to javascript. However you can pretty easily write an extension that does it. The instructions are here: http://wiki.alfresco.com/wiki/3.0_JavaScript_API#Adding_Custom_Script_APIs

Basically you need to write a Java encapsulation of the API you need from PDFBox, compile that (you'll need alfresco-repository.jar in the compile classpath) and hook that up into Alfresco's Spring configuration.

Hope that helps,
Sylvain.

jcobb
Champ in-the-making
Champ in-the-making
Thanks Sylvain,

Mmmm, maybe I'll have to get my hands dirty and start compiling some java…

I've read about 'java backed webscripts' - which I think is also going to mean compiling jars - any thoughts as to which route is going to be easiest for me?

James

schambon
Champ in-the-making
Champ in-the-making
Hi,

It'll definitely be easier for you to extend the Javascript API rather than write java-backed webscripts. The main difference is that if you extend the API, then you can go on writing all your scripts in JavaScript, so that's more future-proof in my opinion.