PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Using PDFsharp & MigraDoc on Windows Azure
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2122
Page 1 of 1

Author:  cg_underdog [ Tue Aug 28, 2012 2:13 am ]
Post subject:  Using PDFsharp & MigraDoc on Windows Azure

Hello,

I'm trying to use PDFsharp and MigraDoc on the Windows Azure platform. Has anyone been able to successfully do this? I've been investigating how to use it with Blob Storage, but have been unsuccessful so far. I have code that works on my local machine just off my c drive.

string filename = "MixMigraDocAndPdfSharpCG.pdf";
Document doc = new Document();
...
PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
renderer.Document = doc;
renderer.RenderDocument();
renderer.PdfDocument.Save(filename);

However with Azure I have to work through the methods specified here http://www.windowsazure.com/en-us/devel ... b-storage/ and cannot save files locally, but instead want to save them directly to the cloud. Is there a way to do this?

Thanks.

Author:  Thomas Hoevel [ Tue Aug 28, 2012 8:17 am ]
Post subject:  Re: Using PDFsharp & MigraDoc on Windows Azure

Hi!

I'm not familiar with Azure, but PDFsharp allows you to save the PDF in a stream (instead of a file). And you can get a byte[] from that stream.

There should be solutions to save streams and byte[] to Azure blobs.

The Clock sample is for PDFsharp, not MigraDoc, but it shows how to use MemoryStream (and the MigraDoc PdfDocumentRenderer exposes a PDFsharp PDFdocument object):
http://www.pdfsharp.net/wiki/Clock-sample.ashx

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/