You cannot insert the javascript code directly in a ddx. The javascript should be present in an input stream/file.The DDX would look more like this.<DDX xmlns="http://ns.adobe.com/DDX/1.0/"> <PDF result="Untitled 1"> <PDF source="sourcePDF1"/> <JavaScript source="Js1" name="anyUniqueName "/> ...