Hello, I would like to give the user of the program I have written, the option to open certain pdf files.
This code below opens the pdf file from the \Debug.
System.Diagnostics.Process.Start("help.pdf");
This is not what I want. I added the pdf file to the Resources. How do I call up a pdf from the Resources?
Loading
Kirtan PatelPosted Nov 11, 2009, 8:45 AM
Here is Code you want
if my answer helps you then check "Do you like this answer check box" :)
here pdfdata is File I have Saved in Resources you may have your own file name :)
using System.IO;
using System.Diagnostics;
private void button1_Click(object sender, EventArgs e)
{
//Convert The resource Data into Byte[]
byte[] PDF = Properties.Resources.pdfdata;
MemoryStream ms = new MemoryStream(PDF);
//Create PDF File From Binary of resources folders help.pdf
FileStream f = new FileStream("help.pdf", FileMode.OpenOrCreate);
//Write Bytes into Our Created help.pdf
ms.WriteTo(f);
f.Close();
ms.Close();
// Finally Show the Created PDF from resources
Process.Start("help.pdf");
}
Aye KPosted Mar 29, 2016, 8:45 PM
PhilipPosted Nov 11, 2009, 9:31 AM
All the Best
Philip