06-04-2023 03:49 PM
Hi!
I must create a new document (doc) with first version from source document. The source document have several versions. New doc must have only one version with content from source. Content is PDF.
Next Javascrip code create a doc, but as expected binary content copyes as string.
var versionHistory = document.getVersionHistory();
var workFolder = companyhome.childByNamePath("Sites/swsdp/documentLibrary/test"); var doc = workFolder.createFile("new_copy_1.pdf"); doc.addAspect('cm:versionable'); doc.content = versionHistory[versionHistory.length-1].getNode().content; doc.save();
How to copy binary content in Javascript?
Thanks for your help, peace,
Serge
06-04-2023 04:04 PM
sorry, I found method by myself
doc.properties.content.write(history[history.length-1].getNode().properties.content);
06-04-2023 04:04 PM
sorry, I found method by myself
doc.properties.content.write(history[history.length-1].getNode().properties.content);
Explore our Alfresco products with the links below. Use labels to filter content by product module.