Avatar

Level 1

If you obtain reader extensions you will be able to attach documents to the pdf form via javascript.  The only problem is that if you're expecting the attachment to be carried from one user to the next in the workflow; it will not work without some serious work arounds.

[CODE]

var timeStamp = util.printd("yyyymmddHHmmss, new Date());

xfa.event.importDataObject({cName: "" + timeStamp});

[/CODE]

Our project had to get an adobe consultant to engineer this.  The solution wound up being create a FileAttachment element in the schema.  So the contents of the files attached would be read in and then stored in the with the rest of the form data.  When the form was submitted there was a subprocess that would then construct the pdf document and add it to the list of file attachments we had.  Here is some sample code for reading the file contents...

[CODE]

var oFile = oParent.getDataObjectContents(oDataObjects[i].name);

var vEncodedStream = Net.streamEncode(oFile, "base64");

var sBase64 = util.stringFromStream(vEncodedStream);

[/CODE]