cancel
Showing results for 
Search instead for 
Did you mean: 

converting txt to pdf and rename the converted file (in the same space)

arm
Confirmed Champ
Confirmed Champ

hi everybody, may u plz help me, im not programmer and im really suffering with scripts, i need to convert a txt file into pdf then rename it or add "copy" to the name, to avoid duplication in the same space, the convertion is not the problem, my problem is to rename the file, i want to run a script that acts in this way: if the pdf file exists then the new one being created from the conversion have to be renamed but i dont know how to do it.

i know, probably is not a big issue but for me is taff, so plz help me......

12 REPLIES 12

mehe
Elite Collaborator
Elite Collaborator

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";

calvo
Star Collaborator
Star Collaborator

Hi Martin,

To be honest, I had test this code (your code :-)) in my Alfresco some time ago, and then I didn't remember where I had obtained. Sorry !!!

Anyway, there's not doubt that the author is .

Thank you so much for your recommendations.

Regards,

mehe
Elite Collaborator
Elite Collaborator

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...