AnsweredAssumed Answered

copy pdf content

Question asked by francix on Mar 24, 2010
Latest reply on Mar 25, 2010 by francix
Hello, I'm newbie in Alfresco and I'm trying to code a simple script to make a content versioned into an alternate space.

I use the code of the examples

And it works fine, but with pdf files mi versioned nodes are blank pages. I think I'm doing something wrong in the copy content process, but I don't know what could it be.

I'm using Alfresco community 3.2 and this is my script:

if (document.isDocument){

   var targetNode = space.childByNamePath("targetNode");
   if (targetNode == null && space.hasPermission("CreateChildren")){
      targetNode = space.createFolder("targetNode");
   if (targetNode != null && targetNode.hasPermission("CreateChildren")){
      var docObsoleto = targetNode.childByNamePath(;

      if (docObsoleto == null){
         docObsoleto = document.copy(targetNode);
      if (docObsoleto != null){
         if (docObsoleto.isVersioned)         {
            var workingCopy = docObsoleto.checkout();
            workingCopy.content = document.content;
            docObsoleto = workingCopy.checkin('Old version');

Thaks in advance