Screenshot with UI to memory buffer

take a look at AFunctionalUIScreenshotTest

in Engine\Source\Developer\FunctionalTesting\Classes
RequestScreenshot() pretty much does what you need from the looks of it.