PDA

View Full Version : OpenStream in C#


jwozniak
June 10th, 2008, 05:09 AM
Hi,

I'm using Foxit Reader ActiveX in my c# (vs2005) application. After loading the pdf file into the byte array (I had to do the loading myself, because the file content is encrypted) I thought I would just create a c# MemoryStream and pass it to the Foxit OpenStream method. Unfortunately it seems that OpenStream method expects me to pass some IStream interface and I have no clue how to convert my byte[] array (or MemoryStream) to IStream.

I will be grateful for any tips.

Best regards,
Jacek

jwozniak
June 10th, 2008, 07:18 AM
Hi again,

OK, I solved my problem using OpenCustomFile. In case someone faces the same problem, here is the solution (c# pseudocode):

public class MyControl
{
// array of bytes containing the document
private byte[] documentArray = null;

public void Load(string path)
{
// 1. load the document to this.documentArray
// 2. use OpenCustomFile
this.axFoxitReaderSDK1.OpenCustomFile("")
}

// the two following methods are registered as event handlers in foxit control
private void axFoxitReaderSDK1_CustomFileGetSize(object sender, AxSDK_AXLib._DFoxitReaderSDKEvents_CustomFileGetSi zeEvent e)
{
e.size = this.documentArray.Length;
}

private void axFoxitReaderSDK1_CustomFileGetBlock(object sender, AxSDK_AXLib._DFoxitReaderSDKEvents_CustomFileGetBl ockEvent e)
{
Marshal.Copy(this.documentArray, e.pos, (IntPtr)e.pBuf, e.size);
}
}

Best regards,
Jacek

sricode
July 18th, 2008, 06:56 AM
Hi i am new to foxit reader and i need to develop a window application ( C#) .NET in which i can display pdf files using foxit.
Can u please send me a SAMPLE C# CODE displaying an image and if possible how to customize it

thanks in advance

sricode
July 21st, 2008, 07:22 AM
i figured it out...

download latest sdk version and u get a foxit reader sdk control on ur toolbar from the com components(.net)

and u can also refer too
http://www.foxitsoftware.com/foxitreader/FoxitActiveX20_guide.pdf

dennis82
July 25th, 2008, 08:47 AM
Hi,

I have seen that openstream and a few related commands. But.....what is it used for? It has something to do with loading a pdf in memory but then what? Can someone explain what is the practical use of these functions?

Thanks in advance for the explanation!


D.R. Reijgwart