plz sent...download of this file...i need it urgetnly...i had try but its not working properly
Just follow these steps.
1) Create a Class Library project. I create a Visual C# Class Library project using Visual Studio and select C# as language and give it a name. I give my project name ShMyPdf.
I change the existing class. I change class name to DisplayPdf and it is inherited from WebControl class.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls;
namespace ShMyPdf
{ public class
DisplayPdf : WebControl { private
string _filepath; public
string FilePath { get { return
_filepath; } set { if
(string.IsNullOrEmpty(value)) { _filepath = string.Empty; } else { int tild = -1; //check ~
symbol including in pdf path then remove tild = value.IndexOf('~'); if (tild != -1) { _filepath = value.Substring((tild + 2)).Trim(); } else { _filepath = value; } } } }
protected
override void RenderContents(HtmlTextWriter writer) { try { StringBuilder
sb = new StringBuilder(); sb.Append("<iframe src=" + Convert.ToString(FilePath) + " "); //fix
height and width sb.Append("width=800px height=500px"); sb.Append("<View PDF: <a href=" + Convert.ToString(FilePath) + "</a></p> "); sb.Append("</iframe>"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(Convert.ToString(sb)); writer.RenderEndTag(); } catch { //If
any problem in the PDF at that time display below information writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("PDF Control..."); writer.RenderEndTag(); } } }
}
2) Run the project. It will generate a dll called ShMyPdf.dll.
3) Create a new ASP.NET Web Application using Visual Studio. I give my application DemoPDFViewer. I select C# as language in Visual Studio.
In this application, user can upload a PDF file and view it.
a. Add a reference to ShMyPdf.dll
b. Make a PDF folder on the site and make sure you have write permissions set on this folder.
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Drawing;
public partial class _Default
: System.Web.UI.Page { protected
void Page_Load(object sender, EventArgs e) {
}
public
string Uploadedfilename { get { return Convert.ToString(ViewState["filename"]); } set
{ ViewState["filename"] = value; } }
intellegant girlPosted Jun 10, 2012, 12:15 PM
Actually I have a quetion regarding this topic which is .... what is the displaypdf1 exactly?? I try to do it but all the time it is shown an error
intellegant girlPosted Jun 10, 2012, 12:15 PM
Actually I have a quetion regarding this topic which is .... what is the displaypdf1 exactly?? I try to do it but all the time it is shown an error
Ashish solankiPosted Feb 3, 2011, 6:03 AM
plz sent...download of this file...i need it urgetnly...i had try but its not working properly