Love the PDFSharp library. Here’s how I went about saving a PDF generated with that library to Azure blob storage:

const bool unicode = false;  
const PdfFontEmbedding embedding = PdfFontEmbedding.Always;  
PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding);  
pdfRenderer.Document = document;  
pdfRenderer.RenderDocument();  
MemoryStream memStream = new MemoryStream();  
pdfRenderer.PdfDocument.Save(memStream,false);

var client = new CloudBlobClient(new Uri("http://*.blob.core.windows.net";, UriKind.Absolute),  
new StorageCredentialsAccountAndKey("*",  
"..."));

var container = client.GetContainerReference("temp");  
memStream.Seek(0, SeekOrigin.Begin);  
string filename = DateTime.Now.ToString().GetHashCode().ToString("x") + ".pdf";  
var pdf = container.GetBlobReference(filename);  
pdf.Properties.ContentType = "application/pdf";  
pdf.UploadFromStream(memStream, new BlobRequestOptions { Timeout = TimeSpan.FromMinutes(10) });  
memStream.Close();


The crux of the code is the line where pass false to the Save method of PdfDocument, which keeps the memory stream open. And, then, before giving that stream to the Azure SDK method, you need to rewind the stream to the beginning. Other than that, all pretty boilerplate.