pdfName should be set to the name your pdf will get - I think in your script it's
pdfName=document.name+".pdf";
If you don't need the old versions of the text or PDF files, the script could be much simpler. Renaming a file is done just by setting it's name property to a new value.
See the documentation ScriptNode API | Alfresco Documentation
pdfNode.name="the new name.pdf";
no offense :-) - I really was glad that the answer helped someone. It's a community and using and combining solutions is the right thing to do. I just thought you didn't know about the "code box" with syntax highlighting which I discovered just a few weeks ago (also by the help of the community) because it's "hidden" under the "more" menu-option...
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.