Based on your comments above the code should look like this:
using System;
using System.IO;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Configuration;
namespace TestViewer2_0
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
[DllImport("ole32.dll")]
static extern int CreateStreamOnHGlobal(IntPtr hGlobal, bool fDeleteOnRelease, out IStream ppstm);
private void button1_Click(object sender, EventArgs e)
{
byte[] content = File.ReadAllBytes(@"ScrumInANutshell.pdf");
int documentLength = content.Length;
GCHandle handle = GCHandle.Alloc(content, GCHandleType.Pinned);
IntPtr contentsIntPtr = handle.AddrOfPinnedObject();
dynamicPDFViewerControl1.OpenBuffer(contentsIntPtr, documentLength, "");
}
}
}
But this code doesn't invoke CreateStreamOnHGlobal function and it doesn't use any code from using System.Configuration;
Could you please provide some comments based on your solution. It seems like there is a misunderstanding here because this code doesn't work.
This issue with dynamicPDFViewerControl1.OpenBuffer function blocks one of the critical features of our application. Please help.