This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
恐怕这将是一个多步骤的过程...
这补充了推荐虚拟 PDF 打印机的答案,因为它是更 Linux 的命令行解决方案(所有提到的工具都可以在 Debian 和 Ubuntu 的软件包存储库中找到)。选择你的毒药。 ;)
I'm afraid that will be a multi-step procedure...
This complements the answer recommending a virtual to-PDF printer in that it's the more linuxy command line solution (all of the tools mentioned are available in Debian's and Ubuntu's package repository). Pick your poison. ;)
安装诸如 Primo PDF 之类的软件,它会安装虚拟打印机并输出 PDF 文件。然后,逐章打印本书(如此处所述 - http: //www.helixoft.com/vsdocman-faqs/printing-chm-documentation.html)
Install something like Primo PDF which installs a virtual printer and spits out a PDF file. Afterwards, print out the book chapter by chapter (as described here - http://www.helixoft.com/vsdocman-faqs/printing-chm-documentation.html)
如果您只需要在 Linux 上阅读,请使用 xchm (http://xchm.sourceforge.net/)为查看 .chm 文件提供良好的本机支持。
If you just need to read it on linux, xchm (http://xchm.sourceforge.net/) provides decent native support for viewing .chm files.
问题在于Windows CHM查看器基本上是MSIE(Internet Explorer)。确切的渲染可能取决于版本。 (对于一般文件,您可能需要 MSIE 6)
换句话说,要获得忠实的复制,就是使用一些提取器(我使用 CHMLIB 中的提取器,或者最近使用 Free Pascal/Lazarus)来解压缩 CHM(即只是一个带有附加索引的 html 存档),并为每个页面启动 MSIE,并对其进行检测以写入虚拟 PDF 编写器等。
这样您就有机会真正按照 IE 渲染的方式捕获它。 (并希望它在打印机上的渲染效果与在屏幕上的渲染效果没有不同)。
TOC 在 .hhc 文件中采用 XML 形式,您可以将其中之一转换为 PDF 书签树视图。
如果您以某种方式从 IE 获取“页数”,您甚至可以将索引文件转换为可以添加到 PDF 的内容,因为您可以确定每个主题位于哪一页。但这是针对高级课程的:-)
The problem is that the windows CHM viewer is basically MSIE (Internet Explorer). The exact rendering is probably version dependant. (and for the average file you'd probably want MSIE 6)
In other words to get a faithful reproduction is to use some extracter (I use the one from CHMLIB or, lately, Free Pascal/Lazarus) to decompress the CHM (which is just an html archive with additional indexes), and fire up MSIE for each page, and instrumenting it to write to e.g. a virtual PDF writer.
This way you have some chance to really capture it the way IE renders it. (and hope it doesn't render differently to printer than to screen).
The TOC is in XML form in the .hhc files, and you could transform one of them to the PDF bookmarks treeview.
If you somehow get the number of "pages" back from IE, you could probably even transform the index files to something you could add to the PDF, since you could make out on which page every topic is. But that is for the advanced class :-)
这对我有用:
https://cloudconvert.com/chm-to-pdf
还有一个 REST API:
如果边框没有足够的空白,您可以将其再次打印为 pdf 并将其大小调整为例如 80%。
This worked for me:
https://cloudconvert.com/chm-to-pdf
There is also a REST API:
If there is not enough white space at the borders, you can print it again as pdf and resize it to e.g. 80%.
要将 chm 转换为 pdf,您可以尝试以下步骤。
1) 单击打印
2) 选择打印选定的标题和所有副主题,然后按确定
3) 当仍然显示打印提示时,转到 TEMP 文件夹(通常是 c:\Documents and Settings\USERNAME\Local Settings\Temp ),找到最新文件“~hhSOMETEXT.htm”
4)用Internet Explorer打开.htm文件并打印为PDF
要删除上一个和下一个按钮,您可能需要设置一个样式,例如img{display:none!important;}
To convert chm to pdf, you can try these steps.
1) click Print
2) select print the selected heading and all subtopics then press ok
3) while the print prompt is still shown, go to your TEMP folder (usually c:\Documents and Settings\USERNAME\Local Settings\Temp ), and find the latest file "~hhSOMETEXT.htm"
4) open the .htm file with internet explorer and print to PDF
to remove the prev and next buttons, you may want to set a style such as img{display:none!important;}