Click here to Skip to main content
15,877,857 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai
all
i want to Open PDF,DOC and XLS in browser.
can any help me
thanks in advance.
Posted
Updated 15-Apr-18 20:53pm
v2

 
Share this answer
 
Comments
Ragi Gopi 17-Dec-11 2:18am    
sorry.....its not the answer for me


i know the code for down loading ....
now i want to just display the files
Ragi Gopi 20-Dec-11 5:27am    
how to open files from tree-view (pdf,docx,xls) in the browser
Check these

How To Write Binary Files to the Browser Using ASP.NET and Visual C# .NET[^]
Displaying Binary Data in the Data Web Controls (C#)[^]
EDIT
Use this line to view the document.
C#
Response.AddHeader("content-disposition", "inline;filename=filename.pdf");
 
Share this answer
 
v2
Comments
Ragi Gopi 17-Dec-11 4:28am    
its showing some thing like

T��a ����h�D|�"lU�) L0����vAq�Vv& ���P�!�b���٨L�!$��KA`��s)��`��+�pP��,�H(D``������`#��hGP�H��5��%uh&eq6�qq([s%���-�@����x"?!��7�o�����������B�t�M�p��td��߯�_����E.:_���O��d�giJ�)�� ZO|�0�������_� c5��Ke�!U��0y�'�Y���#�:#��a`��DG�����"97������[��L�u�?Mg㟔��E�B�x���o)��u_��`��E���(o8��:=?�%��z�_�<���-����:X<����{ǣ�`�̖����aʂ�Sү������~���<�}�Cxr�����>���#g��oo��Ct?Ο��]��~���Ͱ^S�v�_�-���S%��ʖ���bJ]�녫���Ν~��������a�bA����w�Wӥ~�#ͪ��A7����賌[��v��P���?��#�d�e �X��W���~DY.�ZƸv���`��e�Bb��j�#�H$��d��u��a�m}$�X�da�kT�~/,W?�J��#�2F�V���/�A /���#��u ��TGM���3�%"*c�+�^�>���_0��j#�% ^��s��}ׄ �QX����@�ʤv���X���z(@����w
thatraja 17-Dec-11 4:37am    
Did you try the links in my answer?
Ragi Gopi 20-Dec-11 5:27am    
how to open files from tree-view (pdf,docx,xls) in the browser
Ragi Gopi 17-Dec-11 4:39am    
ya i tried the first link....

second one is not clear for me..
Ragi Gopi 17-Dec-11 6:02am    
string path = Server.MapPath("files/" + resultsList.SelectedItem.Text);
System.Net.WebClient client = new System.Net.WebClient();
Byte[] buffer = client.DownloadData(path);

if (buffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", buffer.Length.ToString());
Response.BinaryWrite(buffer);
}



this code opens the page in browser itself


but i need it in a pannel

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900