1、新建类库PdfViewer,在类库中建立一个ShowPdf的类,代码如下:

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 PdfViewer
{
[DefaultProperty("FilePath")]
[ToolboxData("<{0}:ShowPdf runat=server></{0}:ShowPdf>")]
public class ShowPdf : WebControl
{
#region "Declarations"
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"
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

2、在WEB项目中添加引用类库PdfViewer,以下是页面代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="PdfTestSite._Default" %>
<%@ Register Assembly="PdfViewer" Namespace="PdfViewer" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>PDF文档在线编辑测试</title>
</head>
<body bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" style="font-family: Calibri" bgcolor="#cccccc">
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" BackColor="LightSlateGray" BorderStyle="Outset" BorderWidth="2px"
Font-Bold="True" Font-Names="Calibri" Font-Size="X-Large" ForeColor="White" Height="80px"
Style="z-index: 100; left: 0px; position: absolute; top: 0px" Width="100%">
<br />
PDF在线编辑<br />
</asp:Panel>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/ABC.pdf" Style="z-index: 101;
left: 24px; position: absolute; top: 96px">在新窗口打开PDF文档</asp:HyperLink>
<cc1:ShowPdf ID="ShowPdf1" runat="server" BorderStyle="Inset" BorderWidth="2px" FilePath="ABC.pdf"
Height="352px" Style="z-index: 103; left: 24px; position: absolute; top: 128px"
Width="856px" />
</div>
</form>
</body>
</html>

PDF在线编辑器的实现相关推荐

  1. 网页导出pdf不完整_试用:福昕PDF在线编辑器

    我能将PDF转Word吗? 我想永久删除PDF文档中的隐私信息,怎么处理? 我的PDF文档居然有几个错别字,我想快速修改,有好方法吗? 我想删除PDF中的某几个页,可以吗? 当然都是可以的! 现在福昕 ...

  2. java使用在线编辑器生成PDF

    java代码如下: /*** 使用在线编辑器生成PDF* @param htmlCode 编辑器内容* @param pdfPath PDF文件保存路径*/public static void htm ...

  3. Latex在线编辑器帮助文档

    Latex在线编辑器帮助文档 区域分布 选择区域 文本区域 下载区域 AI区域 识别结果 公式检测 公式识别 Attention Latex在线编辑器 区域分布 选择区域 用于帮助用户记住各种Late ...

  4. 超好用的PDF在线编辑方法

    说起PDF文档,不少小伙伴们对他的印象应该是:工作上被动接收到这类文档比较多,而主动去创造修改PDF文档的经历比较少,但是还是有因为突然需要修改其中的内容,而手慢脚乱.所以,为了在关键时刻不掉链子,乖 ...

  5. NTKO Word在线编辑器

    在做OA或者工作流程的网站中,常常能够看到一些在线Word编辑进行文档处理的功能,这里我开发了一个在线Word编辑插件并且以此为例. 1.NTKO Word在线编辑器介绍: NTKO的官方网站:htt ...

  6. 哪里可以找到免费的 PDF 阅读编辑器?7 个免费 PDF 阅读编辑器分享

    如果您曾经需要编辑 PDF,您可能会发现很难找到免费的 PDF 编辑器.幸运的是,您可以使用在线资源来编辑该文档,而无需为软件付费. 在本文中,我将介绍七种不同的 PDF 编辑器,它们至少可以让您免费 ...

  7. 文件夹取消了小米云服务器,小米云服务上线文档在线编辑器:随时保存历史版本...

    IT 之家 11 月 27 日消息   小米官方宣布,互联网时代下,丢失重要文档,就像 80 年代丢了钱包一样痛.为了解决丢失文档的噩梦.小米云服务上线新功能--文档在线编辑器. IT 之家获悉,用户 ...

  8. ASP.net:添加.net(2.0C#)FCKeditor在线编辑器步骤

    1.下载本版本的编辑器压缩包.源码下载地址 2.解压缩打开文件夹拥有如下文件: 3.在VS中添加"选择项"加载在此文件夹的Bin下FredCK.FCKeditorV2.dll. 4 ...

  9. php 图片在线编辑功能,summernote在线编辑器提交的内容PHP处理其中图片函数

    <summernote在线编辑器提交的内容PHP处理其中图片函数>要点: 本文介绍了summernote在线编辑器提交的内容PHP处理其中图片函数,希望对您有用.如果有疑问,可以联系我们. ...

最新文章

  1. 《Adobe InDesign CS5中文版经典教程》—第1课1.9节查找InDesign帮助资源
  2. php正则重复匹配,php – 用于匹配任何长度的所有重复子串的正则表达式
  3. 川崎焊接机器人编程实例_机器人现场编程-川崎机器人示教-综合命令.pptx
  4. 构造函数必须没有代码
  5. 北京黑龙江商会成立纪实(2)
  6. Android含文档server结束(client UI接口异步请求的一部分)三
  7. OWASP Hakcing Lab在线漏洞环境
  8. python编程音乐播放器_python 开发在线音乐播放器-简易版
  9. 安装VMware15.5+安装win10虚拟机操作系统(非常详细)
  10. css3图片淡出淡入怎么做,css3图像淡入淡出(css3 image fadein)
  11. java如何导出excel_JAVA如何导出EXCEL表格
  12. A cycle was detected in the build path of project 'core'. The cycle consists of projects {core, sms}
  13. 如何零成本实现微信公众号自助查券返利机器人(一)
  14. TCP 和 UDP 可以使用相同端口吗?
  15. MLCS algorithm
  16. Java塈百日而求新,念三番未发,其一
  17. python geany是什么_Geany中怎么配置python?
  18. linux5 vnc,centos 5.5 配置vnc,开启linux远程桌面教程(完整正确版)
  19. 设置环境变量永久生效和临时生效 export PS1
  20. Django开发实战2-5 模型- 基础条件查询

热门文章

  1. 一文看尽微信AI团队打造扫一扫植物识别利器
  2. 《Precise and realistic grasping and manipulation in Virtual Reality without force feedback》论文解读
  3. C#用firefox3.6下载yunfile的文件
  4. 两个字符串中最长公共单词 C语言
  5. 如何用电脑制作Excel表格
  6. xshell6、Xshell7最新版使用
  7. YUV与RGB互转各种公式 (YUV与RGB的转换公式有很多种,请注意区别)
  8. 第二阶段(day07)bootstrap
  9. 一款基本靠谱,略微出圈的2021十大科技预测
  10. 5g宣传方案_活动创意策划方案要向“5G时代”看齐