Re: alfresco - convert docx to pdf and create a new version
I think the main problem is that you use the content property. Using the properties.content.write method should work
var pdfNode=document.transformDocument("application/pdf"); var version=document.createVersion("new version pdf",true);//true=create major version document.properties.content.write(pdfNode.properties.content,true,false); document.name+=".pdf"; document.save(); pdfNode.remove();
1: create the pdf Version of the file
2: we create a new major version (you could also create a minor using false) and automatically add the versioned aspect if needed.
3: copies the content from pdf to new version, applymimetype=true, guessencoding=false