cancel
Showing results for 
Search instead for 
Did you mean: 

Can the PDF converter be invoked via scripts?

theorbix
Confirmed Champ
Confirmed Champ
Hello,

I need to modify the behaviour of the PDF rendering of MS-Office documents.

When defined in a Rule, the standard "Transform and copy content to a specific space" action does not work well when applied to subspaces (all documents converted in PDF will be saved in the SAME destination space, and I need a different implementation: the PDF versions of documents should be saved in different space names, depending on the value assigned to a given Aspect.

Is it possible to call the PDF transformation methods from a server-side JavaScript script?
7 REPLIES 7

stevereiner
Champ in-the-making
Champ in-the-making
Yes,

         
         var nodeTrans = docNode.transformDocument("application/pdf", parentNodeForTransform);
         if (nodeTrans != null)
         {
             nodeTrans.properties.content.mimetype = "application/pdf";
         }

(Note you have to set the mimetype on the transform result!)
FlexSpaces does this transform in its integratedsemantics/transform/makePDF javascript webscript
http://forge.alfresco.com/projects/flexspaces/

Steve

theorbix
Confirmed Champ
Confirmed Champ
Thanks Steve for the hint!

Now, for the next question: do you know if it is possible to modify the behaviour of the PDF transformation, for instance to automatically add some security settings (disable printing, disable copy, etc.) to the resulting PDF file?

I know that this could also be done by using some external third party libraries for PDF manipulation, but perhaps there is an easier way by changing some settings that influence the transformDocument() method…

opoplawski
Champ in-the-making
Champ in-the-making
Did you every come up with an implementation of this?  I'm looking for a transform that will convert to PDF in the current space what ever it it.  This could then be an inherited rule defined only once.

theorbix
Confirmed Champ
Confirmed Champ
No, I didn't have the time to continue my investigations…

opoplawski
Champ in-the-making
Champ in-the-making
FlexSpaces does this transform in its integratedsemantics/transform/makePDF javascript webscript
http://forge.alfresco.com/projects/flexspaces/

Steve

Now, I think I've downloaded everything there but still can't find the actual makePDF webscript.  Pointers?

Thanks!

stevereiner
Champ in-the-making
Champ in-the-making
Its inside http://forge.alfresco.com/frs/download.php/494/webscripts-only.zip  inside the integratedsemantics.zip

in the in the integratedsemantics/transform dir 
makePDF.post.desc.xml , 
makePDF.post.js,
makePDF.post.xml.ftl

opoplawski
Champ in-the-making
Champ in-the-making
Thanks, didn't expect the double zip.