Skip to content

PDF text layer misalignment #9600

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
cathino opened this issue Nov 7, 2023 · 6 comments
Closed
3 tasks done

PDF text layer misalignment #9600

cathino opened this issue Nov 7, 2023 · 6 comments
Assignees
Milestone

Comments

@cathino
Copy link

cathino commented Nov 7, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

使用默认深色主题,打开pdf文件,有两个问题:
第一个问题,有的文件会出现错位,具体元素是 textLayer
图片

第二个问题,该文件背景应该是白色的,看起来应该是反相了,对于图片来说是毁灭性的,例如:
图片

而原图应该是:
图片

Expected result

  • 不错位
  • 不自动转换颜色

Version environment

- Version: 2.10.13
- Operating System: linux
- Browser (if used):

Log file

I 2023/11/07 22:03:17 working.go:121: 
      ___                                   ___           ___           ___
     /  /\        ___           ___        /__/\         /  /\         /__/\
    /  /:/_      /  /\         /__/|       \  \:\       /  /::\        \  \:\
   /  /:/ /\    /  /:/        |  |:|        \  \:\     /  /:/\:\        \  \:\
  /  /:/ /::\  /__/::\        |  |:|    ___  \  \:\   /  /:/~/::\   _____\__\:\
 /__/:/ /:/\:\ \__\/\:\__   __|__|:|   /__/\  \__\:\ /__/:/ /:/\:\ /__/::::::::\
 \  \:\/:/~/:/    \  \:\/\ /__/::::\   \  \:\ /  /:/ \  \:\/:/__\/ \  \:\~~\~~\/
  \  \::/ /:/      \__\::/    ~\~~\:\   \  \:\  /:/   \  \::/       \  \:\  ~~~
   \__\/ /:/       /__/:/       \  \:\   \  \:\/:/     \  \:\        \  \:\
     /__/:/        \__\/         \__\/    \  \::/       \  \:\        \  \:\
     \__\/                                 \__\/         \__\/         \__\/
I 2023/11/07 22:03:17 runtime.go:74: kernel is booting:
    * ver [2.10.13]
    * arch [amd64]
    * os [debian]
    * pid [297534]
    * runtime mode [prod]
    * working directory [/tmp/.mount_siyuankqzyf2/resources]
    * read only [false]
    * container [std]
    * database [ver=20220501]
    * workspace directory [/xxx/xxx/SiYuan]
I 2023/11/07 22:03:17 runtime.go:128: use network proxy [system]
I 2023/11/07 22:03:17 serve.go:119: kernel [pid=297534] http server [127.0.0.1:33465] is booting
I 2023/11/07 22:03:17 sync.go:140: sync before boot
I 2023/11/07 22:03:18 repository.go:1139: boot get sync cloud files elapsed [0.19s]
I 2023/11/07 22:03:18 blocktree.go:463: read block tree [6.1 MB] to [/xxx/xxx/SiYuan/temp/blocktree], elapsed [0.03s]
I 2023/11/07 22:03:18 conf.go:723: database size [100 MB], tree/block count [582/18939]
I 2023/11/07 22:03:18 working.go:159: kernel booted
I 2023/11/07 22:03:18 box.go:79: auto stat [trees=582, blocks=18939, dataSize=19 MB, assetsSize=7.6 MB]
I 2023/11/07 22:03:18 disk.go:33: disk usage [total=97 GB, used=75 GB, free=17 GB]
I 2023/11/07 22:03:18 index.go:133: rebuilt database for notebook [20210808180117-czj9bvb] in [0.02s], tree [count=64, size=1.2 MB]
I 2023/11/07 22:03:18 pandoc.go:155: initialized built-in pandoc [ver=, bin=/xxx/xxx/SiYuan/temp/pandoc/bin/pandoc]
I 2023/11/07 22:03:18 conf.go:940: pandoc initialized, set pandoc bin to [/xxx/xxx/SiYuan/temp/pandoc/bin/pandoc]
I 2023/11/07 22:03:18 serve.go:132: reverse proxy server [127.0.0.1:6806] is booting

More information

No response

@cathino
Copy link
Author

cathino commented Nov 8, 2023

打开pdf文件时,默认背景用白色,提供一个反相按钮,让用户自己决定是否要反相比较好

@Vanessa219
Copy link
Member

可参照如下进行设置。错位问题是所有 pdf 都会,还是经过了某些操作后才会?
image

@cathino
Copy link
Author

cathino commented Nov 8, 2023

只是打开文件,没有别的操作,默认主题也是同样的问题

这个文件是正常的
图片

这个文件是错位的,浅色看不出来,深色能看出来:
图片

图片

建议pdf文件默认使用明亮模式打开

@Vanessa219
Copy link
Member

这个特殊的文件可以发我一下么,谢谢。

PDF 的明亮和暗黑默认是根据当前主题的模式来的。

@cathino
Copy link
Author

cathino commented Nov 11, 2023

UOBDs_SpeakingFinal-20231107180449-tjsoudi.pdf
@Vanessa219

PDF 的明亮和暗黑默认是根据当前主题的模式来的。理论上没问题,但是不应该对图片进行反相,图片会相当难看,还得手动改用明亮模式。另外,对于背景透明的png图片来说,不管是否反相都不会完美。所以我还是建议pdf不默认跟随app的明亮模式或暗黑模式,应该显式地在pdf内容上方的操作按钮栏显式明显的按钮,让使用暗黑主题的用户自己决定,或者在设置里面添加个选项。而不是直接修改图片本身的色相。

Vanessa219 added a commit that referenced this issue Nov 12, 2023
@Vanessa219
Copy link
Member

可以重现,下个版本修复。

主题的话只要调整后,下一次都会使用上一次的调整。目前 PDF 深色主题还没有更好的处理办法,如果有的话按照现在的逻辑会比较好一点。等有空可以看看 pdf.js 对深色主题的支持。

@Vanessa219 Vanessa219 self-assigned this Nov 12, 2023
@Vanessa219 Vanessa219 added this to the 2.10.15 milestone Nov 12, 2023
@Vanessa219 Vanessa219 changed the title pdf 预览错位 pdf text layer misalignment Nov 12, 2023
@88250 88250 changed the title pdf text layer misalignment PDF text layer misalignment Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants