Since the entire PDF is encoded within that segment, we need to 1) extract and decode that segment, and 2) write the contents out to a file.
In my example, the OBX segment may NOT always be the last segment. So I am using an XPath to provide the node where OBX-5.4 equals the string 'Base64' which always precedes the Base64 encoded PDF.
//get the encoded OBX5 where the type is Base64
var obx5Decoded = qie.base64DecodeToBytes(message.getNode('OBX[@5.4=Base64]-5.5'));
// create new message with PDF as the content
message = qie.createTextMessage(obx5Decoded);
Finally, in my outbound node, I output to a folder with a filename equivalent to MSH-10 of the source message (with PDF as the extension)
D:\Processed\{s:MSH-10}.pdf