Save an array as pdf to disk
Hi,
I have a function which retruns a pdf as a byte[]
private static CreatePDF()
{
byte[] pdf;
//Do some work & create pdf
return pdf;
}
If I call this function this way:
byte[] MyPdf = CreatePDF()
How can I save MyPdf to disk as a pdf file (c:\path\Filename.pdf) ?
I'm using .NET 2
Thanks
Re: Save an array as pdf to disk
Look at the StreamWriter class in msdn.
P.S. why use .Net 2.0 ?
Re: Save an array as pdf to disk
As far as I know there are no native .Net methods that can save to PDF. You can use PdfSharp or other PDF libraries to achieve this.
Re: Save an array as pdf to disk
Sorry...if you DO have a method that actually returns the PDF as an Array you can use
File.WriteAllBytes("yourfile.ext", yourBytes) and pass your array variable.