<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: converting txt to pdf and rename the converted file (in the same space) in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33924#M14331</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually i saw the sintax error yesterday and changed, so that is the problem im getting i forgot to mention&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jun 2017 09:38:33 GMT</pubDate>
    <dc:creator>arm</dc:creator>
    <dc:date>2017-06-08T09:38:33Z</dc:date>
    <item>
      <title>converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33919#M14326</link>
      <description>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</description>
      <pubDate>Tue, 06 Jun 2017 17:03:17 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33919#M14326</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-06T17:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33920#M14327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The approach could be as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.- We will create a script that will be named: "convert_pdf.js" and will be located in: "Repository &amp;gt;&amp;nbsp;Data Dictionary &amp;gt;&amp;nbsp;Scripts" with the following content:&lt;/P&gt;&lt;P&gt;Var pdfNode = document.transformDocument ("application / pdf");&lt;/P&gt;&lt;P&gt;Var version = document.createVersion ("pdf version", true); // true = create major version&lt;/P&gt;&lt;P&gt;document.properties.content.write (pdfNode.properties.content, true, false);&lt;/P&gt;&lt;P&gt;Document.name + = ". Pdf"; Document.save ();&lt;/P&gt;&lt;P&gt;PdfNode.remove ();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.- We will create a folder on which we will carry out this test,&amp;nbsp;and we will denominate: "TXT to PDF"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.- On this folder that we just created, we will define a content rule:&lt;BR /&gt;- When: items are created or entered in this folder&lt;BR /&gt;- If all the criteria are met: All elements&lt;BR /&gt;- Perform action: Run script - convert_pdf.js&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.- Every time we upload a document to this folder, the conversion script will be executed to PDF, and a new version of the document will be created&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you can change the code to adapt it to your needs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2017 15:58:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33920#M14327</guid>
      <dc:creator>calvo</dc:creator>
      <dc:date>2017-06-07T15:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33921#M14328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi calvo, thanks for ur feedback.&lt;/P&gt;&lt;P&gt;I have tried this script but is failing, is not working, i cant upload a file an error msn shows. can u fix it plz, i will try also to do it here&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2017 22:39:23 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33921#M14328</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-07T22:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33922#M14329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're right. The problem was&amp;nbsp;syntax error to copy in an inline editor.&lt;/P&gt;&lt;P&gt;The code that I've just test in Alfresco 5.2 is the following&amp;nbsp;(it works):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var pdfNode = document.transformDocument("application/pdf");&lt;BR /&gt;var version = document.createVersion("pdf version", true); // true = create major version&lt;BR /&gt;document.properties.content.write(pdfNode.properties.content, true, false);&lt;BR /&gt;document.name+=".pdf"; &lt;BR /&gt;document.save();&lt;BR /&gt;pdfNode.remove();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, tell me if its ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 08:03:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33922#M14329</guid>
      <dc:creator>calvo</dc:creator>
      <dc:date>2017-06-08T08:03:43Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33923#M14330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Calvo, thanks once again for ur feedback&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im having this prob:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Failing creating content: 05080104 Failed to execute script 'workspace://SpacesStore/7d1f767c-0962-4002-a48c-b2297693305f': 05080103 Archive or folder 'testing.pdf' already exists.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #333333; background-color: #ffffff;"&gt;Regards&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 09:35:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33923#M14330</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-08T09:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33924#M14331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;actually i saw the sintax error yesterday and changed, so that is the problem im getting i forgot to mention&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 09:38:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33924#M14331</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-08T09:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33925#M14332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the message indicates that already exists an archive o folder with name "testing.pdf". If you try to delete this file, the script should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 10:20:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33925#M14332</guid>
      <dc:creator>calvo</dc:creator>
      <dc:date>2017-06-08T10:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33926#M14333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Calvo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually was really giving probs, i dont know y, the file did not exist in the system but the msn getting was that one, i took a while and i´m back workin with it and for my surprise suddenly is working, mayb i have done something somewhere i dnt remember but is really workin, so thanks very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jun 2017 13:55:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33926#M14333</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-08T13:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33927#M14334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Seems to be a copy of my answer to&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/thread/228068"&gt;alfresco - convert docx to pdf and create a new version&lt;/A&gt;&amp;nbsp;glad to see it still helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You could check the existence of a PDF with the same name before the transformation with&amp;nbsp;&lt;/P&gt;&lt;PRE class="language-javascript line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; existingPdf&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;document&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;parent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;childByNamePath&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pdfName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;existingPdf &lt;SPAN class="operator token"&gt;!==&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; existingPdf&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;remove&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;//if pdf is existing, delete it&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="79583" __jive_macro_name="user" _jive_internal="true" data-id="79583" data-objecttype="3" data-type="person" href="https://community.alfresco.com/people/calvo" rel="nofollow noopener noreferrer"&gt;&lt;/A&gt;‌ you can use the inline editor with syntax highlighting (under "more") to prevent you from getting errors from copying/writing lines of code. This is only available when opening the complete thread...&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 15:47:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33927#M14334</guid>
      <dc:creator>mehe</dc:creator>
      <dc:date>2017-06-15T15:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33928#M14335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is that i was looking for, im gonna try it then will let u know, thanks very much Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 15:52:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33928#M14335</guid>
      <dc:creator>arm</dc:creator>
      <dc:date>2017-06-15T15:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33929#M14336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;pdfName should be set to the name your pdf will get - I think in your script it's&lt;/P&gt;&lt;P&gt;pdfName=document.name+".pdf";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;See the documentation&amp;nbsp;&lt;A class="link-titled" href="http://docs.alfresco.com/community/references/API-JS-ScriptNode.html" title="http://docs.alfresco.com/community/references/API-JS-ScriptNode.html" rel="nofollow noopener noreferrer"&gt;ScriptNode API | Alfresco Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pdfNode.name="the new name.pdf";&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 15:55:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33929#M14336</guid>
      <dc:creator>mehe</dc:creator>
      <dc:date>2017-06-15T15:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33930#M14337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be honest, I had test this code (your code :-)) in my Alfresco some time ago, and then I didn't&amp;nbsp;remember where I had obtained. Sorry !!!&lt;/P&gt;&lt;P&gt;Anyway, there's not doubt that the author is &lt;A __default_attr="166844" __jive_macro_name="user" _jive_internal="true" data-id="166844" data-objecttype="3" data-type="person" href="https://community.alfresco.com/people/mehe" rel="nofollow noopener noreferrer"&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Thank you so much for your recommendations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 17:01:57 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33930#M14337</guid>
      <dc:creator>calvo</dc:creator>
      <dc:date>2017-06-15T17:01:57Z</dc:date>
    </item>
    <item>
      <title>Re: converting txt to pdf and rename the converted file (in the same space)</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33931#M14338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no offense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; - 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...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jun 2017 17:08:59 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/converting-txt-to-pdf-and-rename-the-converted-file-in-the-same/m-p/33931#M14338</guid>
      <dc:creator>mehe</dc:creator>
      <dc:date>2017-06-15T17:08:59Z</dc:date>
    </item>
  </channel>
</rss>

