Skip to content
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

导出PDF功能:过长代码段不会自动换行 && 过长文字无法生成PDF #30

Closed
Arcticn opened this issue Jun 29, 2024 · 15 comments
Labels
bug Something isn't working

Comments

@Arcticn
Copy link
Contributor

Arcticn commented Jun 29, 2024

imzbf您好!
关于第一个过长代码段不会自动换行的问题
图片

关于第二个过长文字无法生成PDF的问题,可供复现的文件如下。Firefox无法生成pdf,chromium系浏览器会生成空PDF
样例.md

第二个问题可能是html2pdf的问题?

@imzbf
Copy link
Owner

imzbf commented Jun 29, 2024

  • .md-editor-code-block设置text-wrap: wrap;能有换行显示的效果,后面会考虑给这个组件单独设置这个样式,不过,目前的方法无法对应行号,可能会选择强制隐藏

  • html2pdf可能不是最完美的方案,等后面调试看看

@Arcticn
Copy link
Contributor Author

Arcticn commented Jun 30, 2024

明白了,感谢~

@imzbf imzbf added the bug Something isn't working label Jul 1, 2024
@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 2, 2024

这个issue里有人提到html2pdf的分支html3pdf,看上去能够解决第二个问题
eKoopmans/html2pdf.js#639

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 9, 2024

#32 更换了html3pdf
既然行号目前不能正确显示,那就暂时删去?

@imzbf
Copy link
Owner

imzbf commented Jul 9, 2024

#32 更换了html3pdf 既然行号目前不能正确显示,那就暂时删去?

是的,目前需要

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 9, 2024

okay

@Arcticn Arcticn closed this as completed Jul 9, 2024
@imzbf
Copy link
Owner

imzbf commented Jul 9, 2024

PR内容已经在1.3.0-0 Beta版本中更新

npm i @vavt/v3-extension@beta

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 9, 2024

有个问题,patch的内容没有被安装。这种patch的内容可以进一步分发吗?

@Arcticn Arcticn reopened this Jul 9, 2024
@imzbf
Copy link
Owner

imzbf commented Jul 9, 2024

它作为patch的意义是啥,因为npm上的版本存在无法修复的问题还是?

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 9, 2024

主要是html3pdf最新合并了一个pagesPerCanvas选项,但是还没有发布到npm包。如果不加上这个的话,每一页pdf都需要渲染,速度会很慢;加上以后,可以在chrome中一次性渲染19页(firefox是9页),效率高很多倍。

原先html2pdf出现空白的原因就是超出了canvas的最大上限,html3pdf采用逐页渲染的方式,但是每页渲染都是原先一次渲染的完整时间,所以会非常慢。这个新的选项,可以在不触及最大上限的前提下,尽可能加速生成

@imzbf
Copy link
Owner

imzbf commented Jul 9, 2024

明白了,我晚点推送一版本不排除这个依赖的版本上到beta

@imzbf
Copy link
Owner

imzbf commented Jul 9, 2024

更新了1.3.0-1 beta版本

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 10, 2024

ok可以了,谢谢作者!
还想请教下您,这样子直接把html3pdf编译到ExportPDF里,还附带上了它所需依赖的文件。这是怎么做到的?

@Arcticn Arcticn closed this as completed Jul 10, 2024
@imzbf
Copy link
Owner

imzbf commented Jul 10, 2024

构建的时候取消external中的配置,发布的时候移除dependencies就可以了,临时版本在本地发布的就没有提交这个代码

@Arcticn
Copy link
Contributor Author

Arcticn commented Jul 10, 2024

学习了,构建成功,感谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants