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的更多相关文章

  1. “Stamping” PDF Files Downloaded from SharePoint 2010

    http://blog.falchionconsulting.com/index.php/2012/03/stamping-pdf-files-downloaded-from-sharepoint-2 ...

  2. Working with PDF files in C# using PdfBox and IKVM

    I have found two primary libraries for programmatically manipulating PDF files;  PdfBox and iText. T ...

  3. How to create PDF files in a Python/Django application using ReportLab

    https://assist-software.net/blog/how-create-pdf-files-python-django-application-using-reportlab CONT ...

  4. 使用adobe pdf去除PDF文档中的批量雷同文本

    一.问题的提出 MgoSoft tiff to pdf软件没有提供中国地区的非VISA用户的购买渠道,中国通常都是银联标识走天下,卡不是VISA买不了这样的软件, 那么, MgoSoft tiff t ...

  5. [转]Display PDF within web browser using MVC3

    本文转自:http://www.codeproject.com/Tips/697733/Display-PDF-within-web-browser-using-MVC Introduction I ...

  6. C# based on PdfSharp to split pdf files and get MemoryStream C#基于PdfSharp拆分pdf,并生成MemoryStream

    install-package PdfSharp -v 1.51.5185-beta using System; using PdfSharp.Pdf; using System.IO; using ...

  7. microsoft office 2007 在已经安装pdf maker的情况下另存为没有adobe pdf选项

    通常,此类情况是pdf maker 插件被禁用导致,点击office 2007左上角菜单栏,选项,加载项,在管理处选择禁用项目, 找到acrobat pdf maker office com addi ...

  8. PHP class which generates PDF files from UTF-8 encoded HTML

    http://www.mpdf1.com/mpdf/index.php

  9. 推荐一个自动抽取pdf高亮笔记的web应用

    很多人可能像我一样,喜欢用电脑或平板阅读pdf格式的论文或电子书,阅读过程中难免会使用highlight(高亮)工具标记出重要的文字和段落.有没有办法将所有高亮的部分抽取出来,形成一篇单独的笔记呢?下 ...

随机推荐

  1. 《 V I M 教 程 》 —— 版本 1.7

    =============================================================================== = 欢 迎 阅 读 < V I M ...

  2. python参数传递:对象的引用

    大家都知道在python中,一切皆对象,变量也不再具有类型,变量仅仅是对象的一个引用,我们通常用变量来测类型,通常测得就是被这个变量引用得对象的类型. python采用的是传递对象的引用,为了方便说明 ...

  3. c#优秀文章

    文件传输示例]C# WinForm WebSocket (非浏览器):http://bbs.cskin.net/thread-4431-1-1.html NanUI for Winform发布,让Wi ...

  4. 苹果内购和 Apple Pay

    作者:CC老师_MissCC链接:http://www.jianshu.com/p/e3bc47e81785來源:简书 苹果内购 1.什么是内购? 如果你购买的商品,是在本app中使用和消耗的,就一定 ...

  5. su切换用户报错cannot set user id: Resource temporarily unavailable

    su: cannot set user id: 资源暂时不可用   登录root su - tomcat 报错: cannot set user id: Resource temporarily un ...

  6. spring配置文件中导入约束的详细步骤

    这里先以<beans>元素为例: 首先在eclipse中引入相关约束: 点击OK后,这个约束就被引入到eclipse中了,这一步的意义在于:就算你处于脱机情况下(不能联网),也能给你提示. ...

  7. Kibana6.x.x源码分析--启动时无反应分析

    今天执行启动命令后,不报错,但是也没有反应,一时不知道是什么原因造成的,后来经过分析发现,无意间删除了根目录下的一个文件夹plugins,重新创建上这个文件夹后,再次运行就OK了.

  8. 洛谷 P2515 [HAOI2010]软件安装(缩点+树形dp)

    题面 luogu 题解 缩点+树形dp 依赖关系可以看作有向边 因为有环,先缩点 缩点后,有可能图不联通. 我们可以新建一个结点连接每个联通块. 然后就是树形dp了 Code #include< ...

  9. BT网站--Python开发爬虫代替.NET

    BT网站-奥修磁力-Python开发爬虫代替.NET写的爬虫,主要演示访问速度和在一千万左右的HASH记录中索引效率. IBMID 磁力下载- WWW.IBMID.COM  现在用的是Python + ...

  10. QDU_CEF(补)

    C - Arthur and Table Arthur has bought a beautiful big table into his new flat. When he came home, A ...