<?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 Create a new document based on the content of a version of another document in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/create-a-new-document-based-on-the-content-of-a-version-of/m-p/487773#M39928</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What I want to do is read the versions of a given document, and for each version create a new document with the content of that version. I am using a rule that starts a javascript.&lt;/P&gt;&lt;P&gt;The new file is created and content copied, but when I click on the newly created document I get a 'Can not load PDF content'.&lt;/P&gt;&lt;P&gt;Mime type seems ok. Downloading the document and opening it also gives an error that content is unreadable. What is wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var originalContent = documentVersion.node.content; // get content of the version&lt;BR /&gt;&lt;BR /&gt;if (originalContent)&lt;BR /&gt;{&lt;BR /&gt;copiedNode.content = originalContent; // copiedNode is a new file created earlier&lt;BR /&gt;copiedNode.save();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 06 Mar 2025 08:13:52 GMT</pubDate>
    <dc:creator>PVanhoof</dc:creator>
    <dc:date>2025-03-06T08:13:52Z</dc:date>
    <item>
      <title>Create a new document based on the content of a version of another document</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-a-new-document-based-on-the-content-of-a-version-of/m-p/487773#M39928</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;What I want to do is read the versions of a given document, and for each version create a new document with the content of that version. I am using a rule that starts a javascript.&lt;/P&gt;&lt;P&gt;The new file is created and content copied, but when I click on the newly created document I get a 'Can not load PDF content'.&lt;/P&gt;&lt;P&gt;Mime type seems ok. Downloading the document and opening it also gives an error that content is unreadable. What is wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var originalContent = documentVersion.node.content; // get content of the version&lt;BR /&gt;&lt;BR /&gt;if (originalContent)&lt;BR /&gt;{&lt;BR /&gt;copiedNode.content = originalContent; // copiedNode is a new file created earlier&lt;BR /&gt;copiedNode.save();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 08:13:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-a-new-document-based-on-the-content-of-a-version-of/m-p/487773#M39928</guid>
      <dc:creator>PVanhoof</dc:creator>
      <dc:date>2025-03-06T08:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Create a new document based on the content of a version of another document</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/create-a-new-document-based-on-the-content-of-a-version-of/m-p/487775#M39930</link>
      <description>&lt;P&gt;The solution is&lt;/P&gt;&lt;P&gt;copiedNode.properties.content.write(documentVersion.getNode().properties.content);&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 10:13:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/create-a-new-document-based-on-the-content-of-a-version-of/m-p/487775#M39930</guid>
      <dc:creator>PVanhoof</dc:creator>
      <dc:date>2025-03-06T10:13:02Z</dc:date>
    </item>
  </channel>
</rss>

