Save PDF to WebFile without FolderItem?

The web example for PDFs shows saving the document to a FolderItem, then previewing it before offering a button to download it. I was hoping to skip the preview and FolderItem but can’t get it to work, The PDF document only saves to a FolderItem, not a WebFile. I tried

WebFile.Data = PDFDocument.ToSting

but the compiler did not like that.

You need to make your string a memoryBlock to change WebFile.Data.