分享vue好用的pdf 工具实测

news2025/3/15 20:12:20

vue3-pdf-app:

         带大纲,带分页,带缩放,带全屏,带打印,带下载,带旋转

下载依赖:

yarn add vue3-pdf-app
 
or
 
npm install vue3-pdf-app

  配置类:  

 创建文件 pdfConfig.ts
// 工具栏配置项
export const config ={
	// 右侧其他区工具
	sidebar: {
		viewThumbnail: true,//启用缩略图视图
		viewOutline: true,//启用大纲视图
		viewAttachments: true,//启用附件视图
	},
	secondaryToolbar: {
		secondaryPresentationMode: true,//启用演示模式
		secondaryOpenFile: true, //启用打开文件功能
		secondaryPrint: true,//启用打印功能
		secondaryDownload: true,//启用下载功能
		secondaryViewBookmark: true,//启用书签视图
		firstPage: false,//启用跳转到第一页
		lastPage: false,//启用跳转到最后一页
		pageRotateCw: true,//启用顺时针旋转页面
		pageRotateCcw: true,//启用逆时针旋转页面
		cursorSelectTool: true,//启用选择工具
		cursorHandTool: true,//启用手形工具
		scrollVertical: true,//启用垂直滚动
		scrollHorizontal: true,//启用水平滚动
		scrollWrapped: true,//启用包裹滚动
		spreadNone: true,//启用无跨页模式
		spreadOdd: false,// 启用奇数页跨页模式
		spreadEven: false,//启用偶数页跨页模式
		documentProperties: true,//启用文档属性查看
	},
	// 配置左侧工具栏
	toolbar: {
		toolbarViewerLeft: {
			findbar: false,//启用查找条
			previous: true,// 启用上一页按钮
			next: true,//启用下一页按钮
			pageNumber: true,// 启用页码显示
		},
		//  配置右侧工具栏
		toolbarViewerRight: {
			presentationMode: true,//启用演示模式
			openFile: false,//启用打开文件功能
			print: true,//启用打印功能
			download: true,// 启用下载功能
			viewBookmark: false,// 启用书签视图
		},
		// 配置中间工具栏
		toolbarViewerMiddle: {
			zoomOut: true,// 启用缩小功能
			zoomIn: true,//启用放大功能。
			scaleSelectContainer: true,//启用缩放选择容器功能
		},
	},
	errorWrapper: true,//启用错误包装,这可能用于显示错误信息或处理错误情况。
}

引入vue3-pdf-app:

<template>
  <VuePdfApp :page-scale="data.pageScale" :theme="data.theme" 
    :pdf="data.src" :fileName="data.fileName" v-bind="$attrs" :config="config"></VuePdfApp>
</template>
 
 
<script setup lang="ts">
import { computed, ref } from 'vue'
import VuePdfApp from 'vue3-pdf-app'
import 'vue3-pdf-app/dist/icons/main.css'
import {config} from "/@/utils/pdfConfig";//引入配置类

 
const data = ref({
  src: string | ArrayBuffer // pdf地址
  width?: string | number // 预览容器宽度
  height?: string | number // 预览容器高度
  pageScale?: number | string // 页面默认缩放规则,可选 'page-actual'|'page-width'|'page-    height'|'page-fit'|'auto'
  theme?: string // 预览主题 可选 dark | light
  fileName?: string // 覆盖pdf文件名
})
 
</script>
 
 

中文配置:

vue3-pdf-app 插件默认语言是 English,同时也可定制本地化语言为中文。

第一步:

在项目中创建一个viewer.properties的文件。

# vue3-pdf-app插件转中文配置代码
# Copyright 2012 Mozilla Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
 
# Main toolbar buttons (tooltips and alt text for images)
previous.title=上一页
previous_label=上一页
next.title=下一页
next_label=下一页
 
# LOCALIZATION NOTE (page.title): The tooltip for the pageNumber input.
page.title=页面
# LOCALIZATION NOTE (of_pages): "{{pagesCount}}" will be replaced by a number
# representing the total number of pages in the document.
of_pages=/ {{pagesCount}}
# LOCALIZATION NOTE (page_of_pages): "{{pageNumber}}" and "{{pagesCount}}"
# will be replaced by a number representing the currently visible page,
# respectively a number representing the total number of pages in the document.
page_of_pages=({{pageNumber}} / {{pagesCount}})
 
zoom_out.title=缩小
zoom_out_label=缩小
zoom_in.title=放大
zoom_in_label=放大
zoom.title=缩放
presentation_mode.title=切换到演示模式
presentation_mode_label=演示模式
open_file.title=打开文件
open_file_label=打开
print.title=打印
print_label=打印
download.title=下载
download_label=下载
bookmark.title=当前在看的内容(复制或在新窗口中打开)
bookmark_label=当前在看
 
save.title=保存
save_label=保存
bookmark1.title=当前页面(在当前页面查看 URL)
bookmark1_label=当前页面
 
# Secondary toolbar and context menu
tools.title=工具
tools_label=工具
first_page.title=转到第一页
first_page_label=转到第一页
last_page.title=转到最后一页
last_page_label=转到最后一页
page_rotate_cw.title=顺时针旋转
page_rotate_cw_label=顺时针旋转
page_rotate_ccw.title=逆时针旋转
page_rotate_ccw_label=逆时针旋转
 
cursor_text_select_tool.title=启用文本选择工具
cursor_text_select_tool_label=文本选择工具
cursor_hand_tool.title=启用手形工具
cursor_hand_tool_label=手形工具
 
scroll_page.title=使用页面滚动
scroll_page_label=页面滚动
scroll_vertical.title=使用垂直滚动
scroll_vertical_label=垂直滚动
scroll_horizontal.title=使用水平滚动
scroll_horizontal_label=水平滚动
scroll_wrapped.title=使用平铺滚动
scroll_wrapped_label=平铺滚动
 
spread_none.title=不加入衔接页
spread_none_label=单页视图
spread_odd.title=加入衔接页使奇数页作为起始页
spread_odd_label=双页视图
spread_even.title=加入衔接页使偶数页作为起始页
spread_even_label=书籍视图
 
# Document properties dialog box
document_properties.title=文档属性…
document_properties_label=文档属性…
document_properties_file_name=文件名:
document_properties_file_size=文件大小:
# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}"
# will be replaced by the PDF file size in kilobytes, respectively in bytes.
document_properties_kb={{size_kb}} KB ({{size_b}} 字节)
# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}"
# will be replaced by the PDF file size in megabytes, respectively in bytes.
document_properties_mb={{size_mb}} MB ({{size_b}} 字节)
document_properties_title=标题:
document_properties_author=作者:
document_properties_subject=主题:
document_properties_keywords=关键词:
document_properties_creation_date=创建日期:
document_properties_modification_date=修改日期:
# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}"
# will be replaced by the creation/modification date, and time, of the PDF file.
document_properties_date_string={{date}}, {{time}}
document_properties_creator=创建者:
document_properties_producer=PDF 生成器:
document_properties_version=PDF 版本:
document_properties_page_count=页数:
document_properties_page_size=页面大小:
document_properties_page_size_unit_inches=英寸
document_properties_page_size_unit_millimeters=毫米
document_properties_page_size_orientation_portrait=纵向
document_properties_page_size_orientation_landscape=横向
document_properties_page_size_name_a3=A3
document_properties_page_size_name_a4=A4
document_properties_page_size_name_letter=文本
document_properties_page_size_name_legal=法律
# LOCALIZATION NOTE (document_properties_page_size_dimension_string):
# "{{width}}", "{{height}}", {{unit}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement and orientation, of the (current) page.
document_properties_page_size_dimension_string={{width}} × {{height}} {{unit}}({{orientation}})
# LOCALIZATION NOTE (document_properties_page_size_dimension_name_string):
# "{{width}}", "{{height}}", {{unit}}, {{name}}, and {{orientation}} will be replaced by
# the size, respectively their unit of measurement, name, and orientation, of the (current) page.
document_properties_page_size_dimension_name_string={{width}} × {{height}} {{unit}}({{name}},{{orientation}})
# LOCALIZATION NOTE (document_properties_linearized): The linearization status of
# the document; usually called "Fast Web View" in English locales of Adobe software.
document_properties_linearized=快速 Web 视图:
document_properties_linearized_yes=是
document_properties_linearized_no=否
document_properties_close=关闭
 
print_progress_message=正在准备打印文档…
# LOCALIZATION NOTE (print_progress_percent): "{{progress}}" will be replaced by
# a numerical per cent value.
print_progress_percent={{progress}}%
print_progress_close=取消
 
# Tooltips and alt text for side panel toolbar buttons
# (the _label strings are alt text for the buttons, the .title strings are
# tooltips)
toggle_sidebar.title=切换侧栏
toggle_sidebar_notification2.title=切换侧栏(文档所含的大纲/附件/图层)
toggle_sidebar_label=切换侧栏
document_outline.title=显示文档大纲(双击展开/折叠所有项)
document_outline_label=文档大纲
attachments.title=显示附件
attachments_label=附件
layers.title=显示图层(双击即可将所有图层重置为默认状态)
layers_label=图层
thumbs.title=显示缩略图
thumbs_label=缩略图
current_outline_item.title=查找当前大纲项目
current_outline_item_label=当前大纲项目
findbar.title=在文档中查找
findbar_label=查找
 
additional_layers=其他图层
# LOCALIZATION NOTE (page_landmark): "{{page}}" will be replaced by the page number.
page_landmark=第 {{page}} 页
# Thumbnails panel item (tooltip and alt text for images)
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
# number.
thumb_page_title=第 {{page}} 页
# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page
# number.
thumb_page_canvas=页面 {{page}} 的缩略图
 
# Find panel button title and messages
find_input.title=查找
find_input.placeholder=在文档中查找…
find_previous.title=查找词语上一次出现的位置
find_previous_label=上一页
find_next.title=查找词语后一次出现的位置
find_next_label=下一页
find_highlight=全部高亮显示
find_match_case_label=区分大小写
find_match_diacritics_label=匹配变音符号
find_entire_word_label=全词匹配
find_reached_top=到达文档开头,从末尾继续
find_reached_bottom=到达文档末尾,从开头继续
# LOCALIZATION NOTE (find_match_count): The supported plural forms are
# [one|two|few|many|other], with [other] as the default value.
# "{{current}}" and "{{total}}" will be replaced by a number representing the
# index of the currently active find result, respectively a number representing
# the total number of matches in the document.
find_match_count={[ plural(total) ]}
find_match_count[one]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[two]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[few]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[many]=第 {{current}} 项,共匹配 {{total}} 项
find_match_count[other]=第 {{current}} 项,共匹配 {{total}} 项
# LOCALIZATION NOTE (find_match_count_limit): The supported plural forms are
# [zero|one|two|few|many|other], with [other] as the default value.
# "{{limit}}" will be replaced by a numerical value.
find_match_count_limit={[ plural(limit) ]}
find_match_count_limit[zero]=超过 {{limit}} 项匹配
find_match_count_limit[one]=超过 {{limit}} 项匹配
find_match_count_limit[two]=超过 {{limit}} 项匹配
find_match_count_limit[few]=超过 {{limit}} 项匹配
find_match_count_limit[many]=超过 {{limit}} 项匹配
find_match_count_limit[other]=超过 {{limit}} 项匹配
find_not_found=找不到指定词语
 
# Error panel labels
error_more_info=更多信息
error_less_info=更少信息
error_close=关闭
# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
# replaced by the PDF.JS version and build ID.
error_version_info=PDF.js v{{version}} (build: {{build}})
# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
# english string describing the error.
error_message=信息:{{message}}
# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack
# trace.
error_stack=堆栈:{{stack}}
# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename
error_file=文件:{{file}}
# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number
error_line=行号:{{line}}
 
# Predefined zoom values
page_scale_width=适合页宽
page_scale_fit=适合页面
page_scale_auto=自动缩放
page_scale_actual=实际大小
# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a
# numerical scale value.
page_scale_percent={{scale}}%
 
# Loading indicator messages
loading=正在加载…
 
# Loading indicator messages
loading_error=加载 PDF 时发生错误。
invalid_file_error=无效或损坏的 PDF 文件。
missing_file_error=缺少 PDF 文件。
unexpected_response_error=意外的服务器响应。
 
rendering_error=渲染页面时发生错误。
 
# LOCALIZATION NOTE (annotation_date_string): "{{date}}" and "{{time}}" will be
# replaced by the modification date, and time, of the annotation.
annotation_date_string={{date}},{{time}}
 
# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip.
# "{{type}}" will be replaced with an annotation type from a list defined in
# the PDF spec (32000-1:2008 Table 169 – Annotation types).
# Some common types are e.g.: "Check", "Text", "Comment", "Note"
text_annotation_type.alt=[{{type}} 注释]
password_label=输入密码以打开此 PDF 文件。
password_invalid=密码无效。请重试。
password_ok=确定
password_cancel=取消
 
printing_not_supported=警告:此浏览器尚未完整支持打印功能。
printing_not_ready=警告:此 PDF 未完成加载,无法打印。
web_fonts_disabled=Web 字体已被禁用:无法使用嵌入的 PDF 字体。
 
# Editor
editor_free_text2.title=文本
editor_free_text2_label=文本
editor_ink2.title=绘图
editor_ink2_label=绘图
 
free_text2_default_content=开始输入…
 
# Editor Parameters
editor_free_text_color=颜色
editor_free_text_size=字号
editor_ink_color=颜色
editor_ink_thickness=粗细
editor_ink_opacity=不透明度
 
# Editor aria
editor_free_text2_aria_label=文本编辑器
editor_ink2_aria_label=绘图编辑器
editor_ink_canvas_aria_label=用户创建图像
第二步:

在项目里面引用viewer.properties此文件:

vue-print-nb:

vue-print-nb 是一个用于 Vue.js 的轻量级打印插件,它允许你轻松地将页面或特定元素转换为可打印格式,并提供了额外的功能如预览和生成 PDF。下面是使用 vue-print-nb 的步骤:

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2315628.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Markdown Poster – 免费Markdown转图片工具|优雅图文海报制作与社交媒体分享

Markdown Poster是什么 Markdown Poster 是一款高效的 Markdown 转图片工具&#xff0c;利用灵活编辑和实时预览功能帮助用户轻松制作优雅的图文海报。该工具内置丰富的海报模板和多种主题选项&#xff0c;支持导出为图片和 HTML 代码&#xff0c;适用于社交媒体分享、网站集成…

掌握市场先机:9款销售渠道管理工具深度测评

本文主要介绍了以下9款销售渠道管理工具&#xff1a;1.纷享销客&#xff1b; 2.销帮帮&#xff1b; 3.小满CRM&#xff1b; 4.有赞&#xff1b; 5.Oracle NetSuite&#xff1b; 6.Salesforce Sales Cloud&#xff1b; 7.Cin7&#xff1b; 8.Pipedrive&#xff1b; 9.BigCommerc…

OpenCV图像加权函数:addWeighted

1 addWeighted函数 在OpenCV 里&#xff0c;addWeighted 函数的作用是对两个图像进行加权求和&#xff0c;常用于图像融合、图像过渡等场景。函数如下&#xff1a; cv2.addWeighted(src1, alpha, src2, beta, gamma[, dst[, dtype]])2 参数解释 src1&#xff1a;第一个输入图…

docker桌面版启动redis,解决无法连接

docker run -d --name redis -p 6379:6379 -v E:\2\redis\redis.conf:/usr/local/etc/redis/redis.conf redis redis-server /usr/local/etc/redis/redis.conf 在本地创建一个目录&#xff0c;里面有个redis.conf文件&#xff0c;内容如下&#xff0c;启动时绑定这个配置文件目…

Scratch 3.0安装包,支持Win7/10/11、Mac电脑手机平板、少儿便编程的启蒙软件。

Scratch是一款由麻省理工学院&#xff08;MIT&#xff09; 设计开发的少儿编程工具。其特点是&#xff1a;使用者可以不认识英文单词&#xff0c;也可以不使用键盘&#xff0c;就可以进行编程。构成程序的命令和参数通过积木形状的模块来实现。用鼠标拖动指令模块到脚本区就可以…

Navicat for Snowflake 震撼首发,激活数据仓库管理全新动能

近日&#xff0c;Navicat 家族迎来了一位全新成员 — Navicat for Snowflake。Snowflake 是一款基于云架构的现代数据仓库解决方案&#xff0c;以其弹性扩展、高性能和易用性著称。这次首发的Navicat for Snowflake 专为简化 Snowflake 数据库管理任务而精心打造。它凭借其直观…

深度学习基础:线性代数本质2——线性组合、张成的空间与基

目录 一、线性组合 1. 用一个有趣的角度看向量坐标 2. 如果我们选择不同的基向量会怎样&#xff1f; 3. 线性组合 4. 张成的空间 ① 二维向量的张成的空间 ② 三维向量的张成的空间​编辑 5.线性相关 6.线性无关 7. 基的定义 一、线性组合 1. 用一个有趣的角度看向量坐…

第五天 Labview数据记录(5.4 EXCEL文件读写)

5.4 EXCEL文件读写 Excel 文件读写在数据处理、自动化办公、数据分析等领域具有重要的意义。以下是 Excel 文件读写的主要应用场景和意义&#xff1a;1. 数据管理和整理&#xff1b;2. 自动化办公&#xff1b;3. 数据分析和可视化&#xff1b;4. 系统集成&#xff1b;5. 报表生…

注意力机制,层归一化,RBA。KAN-ODE,小波KAN

目录 attention is all you need 翻译 多头注意力 8.6 Multi-head Self Attention 模型 模型架构 encoder安定 decode 注意力机制 位置编码 自注意力机制的优势 实验结果 结论 代码 Transformer 架构 代码实现思路 总结 编码器、解码器和位置编码的摆放顺序&…

电脑内存不足怎么办?

常规解决方法盘点 关闭后台程序&#xff1a;按下【Ctrl Shift Esc】组合键打开任务管理器&#xff0c;在 “进程” 选项卡里&#xff0c;把当前不用的程序统统 “结束任务” &#xff0c;像那些自动更新的软件、常驻后台的播放器&#xff0c;关了能释放不少内存。比如音乐软…

【RISCV LAB】0x01-安装实验仿真辅助工具

安装实验辅助工具 实验环境搭建安装 Verilator编译依赖下载源码编译安装测试安装 安装 RISC-V 交叉编译工具链编译依赖下载源码编译安装编译并安装添加环境变量并测试 安装 GTKWave其他模拟器推荐RARSemulsiV FAQ 实验环境搭建 Verilator 是一款开源的支持 Verilog 和 SystemV…

Trae插件革命:用VSPlugin Helper实现VSCode市场插件全自动安装

之前有读者留言说trae都没有c的插件用&#xff0c;确实是这样&#xff0c;trae的插件源用的是open vsx&#xff0c;而c/c插件是vscode官方插件市场的&#xff0c;如果想直接在trae中安装c/c插件是不行的&#xff0c;只能先从vscode官方插件市场把vsix后缀文件先下载下来&#x…

使用PHP进行自动化测试:工具与策略的全面分析

使用PHP进行自动化测试&#xff1a;工具与策略的全面分析 引言 随着软件开发的复杂性不断增加&#xff0c;自动化测试已成为确保软件质量的关键环节。PHP作为一种广泛使用的服务器端脚本语言&#xff0c;拥有丰富的生态系统和工具支持&#xff0c;使其成为自动化测试的理想选…

字符串函数和结构题内存对齐

图下为函数使用&#xff1a; #include <ctype.h>int main() {int ret isdigit(Q);printf("%d\n", ret);return 0; }int main() {printf("%c\n", toupper(a));printf("%c\n", tolower(A));return 0; }

Odoo18 Http鉴权+调用后端接口

最近在调研Odoo18&#xff0c;包括它的前后端原理、源码等。发现官方的开发文档并不十分实用&#xff0c;比如标题这种简单的实用需求&#xff0c;竟然浪费了一点时间&#xff0c;特此记录。 官方文档&#xff1a;External API — Odoo 18.0 documentation 前提&#xff1a;首…

【sql靶场】第11、12关-post提交注入

目录 【sql靶场】第11、12关-post提交注入 POST 一、URL 二、核心组成部分 三、数据编码规范 四、应用场景与请求方法 第十一关 方法一 步骤一 步骤二 步骤三 步骤四 步骤五 步骤六 步骤七 方法二 步骤一 步骤二 步骤三 步骤四 步骤五 步骤六 步骤七 第…

框架、云原生、微服务的基本概念

架构 互联网应用的架构设计随着业务需求的增长和技术的发展经历了从单一架构到垂直架构&#xff0c;再到分布式架构的演变。以下是这三种架构的定义、特点以及具体的例子&#xff1a; 1. 单一架构&#xff08;Monolithic Architecture&#xff09; 定义 单一架构是一种将所有…

Discuz建站教程之论坛头部logo跳转链接怎么修改?

在修改头部logo跳转链接前&#xff0c;我们需要知道对应代码在哪个文件目录&#xff0c;进入宝塔或是服务器&#xff0c;找到文件&#xff1a;\template\default\common\header.htm&#xff0c;编辑器打开&#xff0c;搜索以下代码&#xff0c;大概在135行 <a href"{i…

AI重构SEO关键词布局

内容概要 在搜索引擎优化&#xff08;SEO&#xff09;领域&#xff0c;AI技术的深度应用正在颠覆传统关键词布局逻辑。通过机器学习算法与语义分析模型&#xff0c;智能系统能够实时解析海量搜索数据&#xff0c;构建动态词库并精准捕捉用户意图。相较于依赖人工经验的关键词筛…

OpnenHarmony 开源鸿蒙北向开发——1.开发环境搭建(DevEco Studio 5.03)

我这边是基于window下对OpenHarmony开源鸿蒙进行北向开发。 一、安装DevEco Studio 1、下载 下载中心 | 华为开发者联盟-HarmonyOS开发者官网&#xff0c;共建鸿蒙生态 2、安装 下载完成之后进行解压 双击进行安装 按照我的步骤进行 选择安装目录&#xff0c;全部配置完成后…