This sample shows how to use Diagram.makeImageData with the returnType: "blob" option and the necessary callback option. It also shows how to download a file that the page has generated.