-
Notifications
You must be signed in to change notification settings - Fork 2
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
gitbook pdf export error #3
Comments
The reason for base64 encoding is the generated SVG image may break the balance of XML tag, and it will cause tags below the SVG image failed to be rendered. I'm trying to generate a separate png file. |
我又提交了一份,暂时没有更新到npm,你试下直接换里面的文件,然后看看是否ok。这个简直天坑,nodejs的生态太惨了 |
I tried, OK & 👍 steps:
Is that right ? BTW, 我是个写 C 的,这玩意太难了。。。。 |
现在能生成PDF,但是浏览器打不开了,我不知道为什么 github 上传不了图片。。。。 F12 看了下,貌似最后生成的图片:
是不是 |
首先我不太清楚为什么要做成pdf,如果是对内使用的话,pdf的可搜索性还是比较差的。而如果你把它当成对外交付文档,格式又不如word正式。 我是写java的,也搞不定这个问题,搞不定是因为nodejs下的确没有什么好代码与文档(而且gitbook应该是死了),一旦深入问题就要翻源码,太耗费时间了。如果导出为pdf,就涉及到比较复杂的排版问题,我个人更推荐用这里的方案 https://program-think.blogspot.com/2015/03/blog-sync.html 如果你仍然希望用我这里的方案,可以试试把修改mermaid输出格式从SVG改为PNG,这样就规避问题了。 |
再试下,我这边已经生成了,但是
更新: |
情况特殊,一言难尽……平衡各方面,选择 gitbook。pdf 确实对外使用,我之前都是用 LaTeX 的。总之,先谢谢了 :) |
@miao1007 你把我的问题关闭了然后归到了这里. 我简单看了一下似乎不是一回事啊, |
这个太折腾了,不支持。我还是没有搞懂你这里的需求,如果要用pandoc,需要一种类似typora的方案,先把gitbook转为ast才可以 |
我原问题的需求就是利用mermaid-cli转png的时候能够指定dpi 对于这个问题你怎么看 @miao1007 |
我翻了下 gitbook 的源代码,貌似在其 lib/utils/images.js 文件的第10行左右: return command.spawn('svgexport', [source, dest]) 只传了两个参数,第三个参数使用默认值,如果要清晰一点的话,就要自己传个参数,比如 所以有个方法就是自己 clone gitbook 的代码,改完后用 |
我终于看明白你的提问了,首先我是没有权力关闭其它项目问题的,我只能关闭本项目里的问题。由于我这边讨论导出涉及到你的精度问题,所以也引进来了你提出的单供大家一起讨论。 回到这个精度的位置,我们从源码可以看出,它是用screenshot实现的,然后参考API文档,可以发现 page.screenshot({ path: output, clip, omitBackground: backgroundColor === 'transparent' }); 在不修改mermaid.cli源码的前提下,基本不可能实现。
|
related link: GitbookIO/gitbook#2154
The text was updated successfully, but these errors were encountered: