Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pic-reader
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
龙菲
pic-reader
Commits
cd5b7f87
提交
cd5b7f87
authored
8月 16, 2025
作者:
gzcnkilys_admin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复detail下BookReader被加载两次的问题,有两个footer。
进一步优化pdf文本的选中、可惜不同的pdf,可能展示不同。
上级
04646f87
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
9 行删除
+15
-9
pdf_viewer.css
public/pdfjs-dist/web/pdf_viewer.css
+6
-5
index.vue
src/components/BookReader/index.vue
+9
-3
index.vue
src/views/detail/index.vue
+0
-1
没有找到文件。
public/pdfjs-dist/web/pdf_viewer.css
浏览文件 @
cd5b7f87
...
...
@@ -15,10 +15,11 @@
.textLayer
{
position
:
absolute
;
left
:
0
;
top
:
0
;
right
:
0
;
bottom
:
0
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
right
:
auto
;
bottom
:
auto
;
overflow
:
hidden
;
opacity
:
0.2
;
line-height
:
1.0
;
...
...
@@ -313,7 +314,7 @@
direction
:
ltr
;
width
:
816px
;
height
:
1056px
;
margin
:
1px
auto
-8px
auto
;
/* margin: 1px auto -8px auto; */
position
:
relative
;
overflow
:
visible
;
border
:
9px
solid
transparent
;
...
...
src/components/BookReader/index.vue
浏览文件 @
cd5b7f87
...
...
@@ -687,7 +687,7 @@ const initBook = async () => {
}
// 调试:检查页面状态
setTimeout
(()
=>
debugPageStatus
(),
100
);
//
setTimeout(() => debugPageStatus(), 100);
},
50
);
// 播放声音
...
...
@@ -857,6 +857,7 @@ const renderPdfPage = async (pageIndex) => {
pageContainer
.
innerHTML
=
''
;
// 创建页面div元素
// todo 这里可能能够优化一下
const
pageDiv
=
document
.
createElement
(
'div'
);
pageDiv
.
className
=
'pdf-page-container'
;
pageDiv
.
setAttribute
(
'data-page-number'
,
pageNum
);
...
...
@@ -902,8 +903,9 @@ const renderPdfPage = async (pageIndex) => {
console
.
log
(
`页面
${
pageNum
}
容器尺寸:
${
containerWidth
}
x
${
containerHeight
}
`
);
// 设置页面div的尺寸
pageDiv
.
style
.
width
=
`
${
containerWidth
}
px`
;
pageDiv
.
style
.
height
=
`
${
containerHeight
}
px`
;
// 这里可能能够优化
// pageDiv.style.width = `${containerWidth}px`;
// pageDiv.style.height = `${containerHeight}px`;
// 创建PDF页面视图
const
rawPdfDocument
=
toRaw
(
pdfDocument
.
value
);
...
...
@@ -918,6 +920,10 @@ const renderPdfPage = async (pageIndex) => {
// 创建基于缩放比例的视口
const
scaledViewport
=
pdfPage
.
getViewport
({
scale
:
scale
});
// 源码可以设置宽高,但是对文字层和page层还是不按照这个来。
// scaledViewport.width = containerWidth;
// scaledViewport.height = containerHeight;
console
.
log
(
`PDF原始尺寸:
${
originalViewport
.
width
}
x
${
originalViewport
.
height
}
, 缩放比例:
${
scale
}
, 缩放后尺寸:
${
scaledViewport
.
width
}
x
${
scaledViewport
.
height
}
`
);
// 创建PDFPageView实例
...
...
src/views/detail/index.vue
浏览文件 @
cd5b7f87
...
...
@@ -13,7 +13,6 @@
:bookmarks=
"bookmarks"
:enableTextLayer=
"true"
/>
<BookReader
:src=
"pdfUrl"
/>
</div>
</
template
>
<
script
setup
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论