Csharp:user WebControl Read Adobe PDF Files In Your Web Browser
2013-10-10 17:25
381 查看
namespace GeovinDu.PdfViewer { [DefaultProperty("FilePath")] [ToolboxData("<{0}:ShowPdf runat=server></{0}:ShowPdf>")] public class ShowPdf : WebControl { #region "Declarations" //Geovin Du 塗聚文 20131010 private string mFilePath; #endregion #region "Properties" [Category("Source File")] [Browsable(true)] [Description("Set path to source file.")] [Editor(typeof(System.Web.UI.Design.UrlEditor), typeof(System.Drawing.Design.UITypeEditor))] public string FilePath { get { return mFilePath; } set { if (value == string.Empty) { mFilePath = string.Empty; } else { int tilde = -1; tilde = value.IndexOf('~'); if (tilde != -1) { mFilePath = value.Substring((tilde + 2)).Trim(); } else { mFilePath = value; } } } } // end FilePath property #endregion #region "Rendering" /// <summary> /// Geovin Du 塗聚文 20131010 /// </summary> /// <param name="writer"></param> protected override void RenderContents(HtmlTextWriter writer) { try { StringBuilder sb = new StringBuilder(); sb.Append("<iframe src=" + FilePath.ToString() + " "); sb.Append("width=" + Width.ToString() + " height=" + Height.ToString() + " "); sb.Append("<View PDF: <a href=" + FilePath.ToString() + "</a></p> "); sb.Append("</iframe>"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write(sb.ToString()); writer.RenderEndTag(); } catch { // with no properties set, this will render "Display PDF Control" in a // a box on the page writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.Write("Display PDF Control"); writer.RenderEndTag(); } // end try-catch } // end RenderContents #endregion } // end class } // end namespace Geovin Du 塗聚文 20131010
相关文章推荐
- Csharp:user WebControl Read Adobe PDF Files In Your Web Browser
- Csharp:user WebControl Read Adobe PDF Files In Your Web Browser
- How to create a read-only user in TFS source control
- Connection for controluser as defined in your configuration failed phpmyadmin xampp
- How to set bmp for your UserControl in the toolbox
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
- JODK2 NO [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer
- Csharp: winform PDF view control use Adobe Reader X
- 项目报错:java web error:Choose unique values for the 'webAppRootKey' context-param in your web.xml files
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files 解决办法
- Have your GDX app run in the web browser
- how to auto refresh your web page in browser?
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
- How to create a read-only user in TFS source control
- java web error:Choose unique values for the 'webAppRootKey' context-param in your web.xml files
- phpMyAdmin 表底部出现 Connection for controluser as defined in your configuration failed.
- 多个项目部署到一个tomcat下面报错:Choose unique values for the 'webAppRootKey' context-param in your web.xml files
- How to create a read-only user in TFS source control
- Connection for controluser as defined in your configuration failed.