Having one attachment(lets say a fillable pdf template) in the attachment tab; I would like to make a copy of it; push some data to the copy and display data populated pdf.
I tried to use doc.createDataObject, doc.getDataObjectContents and doc.setDataObjectContents funtions. But it was no success. The thing is, the file attachment is created but the contents, as a stream, are not set to pdf correctly. But when i tried to create a text file with the same fuction everything is ok.
How can I achieve copying an existing attahment?
This is a folder level script I use in concert with some other utility functions; one of which sets 'cDoc' to the current document. You'll probably want to change 'cDoc' to 'this'
var myData = getXML("myData")
sets myData to an XFA object equal to the attached XML.
setXML("myData")
converts the XML data to a string, saves it back, and creates a function 'setmyData' which sets 'myData' to the xml data. (Thus allowing you to delete the XML attachment without losing the data).
Now is this the method you are using, but doesn't work; or might this work for you?