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. Linux里的用户管理

    在linux中系统中,它并不认识帐号名称.它认识的是我们的帐号ID,帐号ID保存在/etc/passwd文件中.我们在登录linux主机时,在输入完帐号和密码时,linux会先查找/etc/passw ...

  2. php代码书写习惯优化小结

    (1)使用 static 静态方法比普通方法快4倍(2)echo输出快于print(3)连接字符使用 , 代替 .(4)循环之前先取出最大值,而不是在循环里面取值    正确的方法      $max ...

  3. 使用window.name 进行数据跨域传递

    其中要点, Stpe1,浏览器在Iframe中加载一个异域的页面,这个页面返回 <script>window.name="任何数据"</script>,这时 ...

  4. TX1 文字界面启动与root用户自动登录设置

    设置默认文字启动界面 更改/boot/extlinux/extlinux.conf文件,在最后一行的末尾添加 text. 设置自动登录 在/etc/init/tty1.conf文件末尾添加: exec ...

  5. mysql 面试题

    1.一张表,里面有ID自增主键,当insert了17条记录之后,删除了第15,16,17条记录,再把Mysql重启,再insert一条记录,这条记录的ID是18还是15 ?   2.Mysql的技术特 ...

  6. 使用IDEA完成maven整合SSH框架时抛出Hibernate : Mapping (RESOURCE) not found

    切入主题,看看今天的错误是如何发生的: 首先这是我的项目路径,java 是 Sources Root , resources 是 Resources Root ,放了所需要的配置文件,其中 Hiber ...

  7. 将多个单元格内容连接到一个单元格中(EXCEL)

    连接符号:& 如下图,我们要将表格中每名员工的姓名.入职时间以及年龄放入到同一个单元格中,形成以“-”连接的形式. 这时我们要用到Excel中的连接符“&”,也就是在按下Shift+数 ...

  8. Joi图标

    刚开始浏览API的时候,旁边这个图片还真没明白是啥意思.现在才明白过来:),检测工具嘛,哈哈.

  9. CodeForces - 1110C-Meaningless Operation(打表找规律)

    Can the greatest common divisor and bitwise operations have anything in common? It is time to answer ...

  10. 设置input placeholder的样式

    ::-webkit-input-placeholder {/*Chrome/Safari*/ font-family: 'Avenir', Helvetica, Arial, sans-serif; ...