文档中的关键字搜索
# 文档中的关键字搜索
注意
本文中展示的代码均为关键代码,复制粘贴到您的项目中,按照实际的情况,例如文档路径,用户名等做适当修改即可使用。
用户在线查看PDF文件时,难免会遇到搜索文章中文字的需求,PageOffice打开PDF文件,提供了全文关键字搜索功能。
# 后端代码
本示例无后端关键代码。
# 前端代码
- 在OnPageOfficeCtrlInit事件中添加搜索功能的相关按钮;
OnPageOfficeCtrlInit() {
pageofficectrl.AddCustomToolButton("搜索", "SearchText()", 0);
pageofficectrl.AddCustomToolButton("搜索下一个", "SearchTextNext()", 0);
pageofficectrl.AddCustomToolButton("搜索上一个", "SearchTextPrev()", 0);
},
// Make sure to add code blocks to your code group
- 实现各个按钮所调用的js函数;
function SearchText() {
pageofficectrl.SearchText();
}
function SearchTextNext() {
pageofficectrl.SearchTextNext();
}
function SearchTextPrev() {
pageofficectrl.SearchTextPrev();
}
// Make sure to add code blocks to your code group
上次更新: 2023/05/18, 16:16:54