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. Pycharm关闭后Python.exe还是在后台运行

    pycharm运行程序关闭后会弹出一个对话框: 一定要选择第一个,不然python.exe一直会在后台运行.

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

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

  3. SDUT OJ 数据结构实验之链表二:逆序建立链表

    数据结构实验之链表二:逆序建立链表 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descr ...

  4. fiddler使用——配置抓取https,出现提示“禁用解密”“单击配置”

    自己在设置fiddler抓https的时候,浏览器总是提示:此证书不受信任:中午没午睡下午一直昏沉沉的,弄了好久,终于想起来是证书的问题:度娘有个不错的答案,这里分享一下!给以后有相同问题的朋友,也同 ...

  5. 把查询的结果组织为一串字符(eg:板板鞋,兵乓球,篮球,足球)

    --把查询的结果组织为一串字符(板板鞋,兵乓球,篮球,足球) drop table a create table a( name varchar(20)) insert into a select ' ...

  6. flask总结02

    一:flask的响应: flask默认支持2种响应方式: 数据响应: 默认响应html文本,也可以返回 JSON格式 页面响应: 重定向 url_for 响应的时候,flask也支持自定义http响应 ...

  7. Android 滚动视图(ScollView)

    1.介绍 2.使用技巧 3.xml文件代码 <?xml version="1.0" encoding="utf-8"?> <LinearLay ...

  8. win10 oracle11g安装问题:INS-13001环境不满足最低要求

    打开database文件夹,找到stage,然后cvu,找到cvu_prereq.xml文件,用记事本打开,增添下面内容: <OPERATING_SYSTEM RELEASE="6.2 ...

  9. 江西理工大学南昌校区排名赛 D: 单身狗的物理游戏

    题目描述 萌樱花是一只单身狗. 萌樱花今天决定做一道理综物理题: 如图,两固定的绝缘斜面倾角均为θ,上沿相连.两细金属棒ab(仅标出a端)和cd(仅标出c端)长度均为L,质量分别为2m和m:用两根不可 ...

  10. [转] log4j-over-slf4j与slf4j-log4j12共存stack overflow异常分析

    [From] http://www.tuicool.com/articles/INveIf 注:下文中的“桥接”.“转调”.“绑定”等词基本都是同一个概念. log4j-over-slf4j和slf4 ...