AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 28136
Accepted
Julio
Julio
Asked: 2011-02-26 23:30:05 +0800 CST2011-02-26 23:30:05 +0800 CST 2011-02-26 23:30:05 +0800 CST

如何打开和转换 CHM 文档?

  • 772

我有一些.chm格式的文件。我想知道在 Ubuntu 中是否有一种文件格式可以更容易导航、支持并且文件大小相等?

如果有的话,我想开始转换所有这些书籍,并可能在我所有的 Ubuntu PC 和我的 Android 手机上更轻松地使用它们。

chm
  • 8 8 个回答
  • 6213 Views

8 个回答

  • Voted
  1. Best Answer
    dv3500ea
    2011-02-26T23:58:53+08:002011-02-26T23:58:53+08:00

    您可以使用命令行程序chm2pdf(在此处安装 chm2pdf)将它们转换为 PDF。安装后,您可以从终端运行命令,如下所示:

    chm2pdf --book in.chm out.pdf
    

    如果您不知道,有几个可用的 chm 阅读器 - 只需chm在软件中心搜索即可。

    您还可以使用命令行工具7-Zip(在此处安装 p7zip-full)将 chm 文件提取为 html:

    7z x file.chm
    
    • 13
  2. Sabacon
    2011-02-28T06:44:50+08:002011-02-28T06:44:50+08:00

    如果您不想使用 PDF,那么我建议您使用 Epub,这是一种相当不错的开放式电子书格式,您可以在 Ubuntu 上为它安装一个名为 Calibre 的好阅读器,Calibre 有一个有用的转换工具,可以导入 chm 文件,然后将它们转换为包括 epub 在内的其他格式。epub 也可以在大多数智能手机和平板电脑上轻松阅读。

    Calibre 可以从软件中心安装。

    • 3
  3. Asmerito
    2011-02-27T01:05:16+08:002011-02-27T01:05:16+08:00

    如果您更喜欢 KDE,还有 KChmViewer。

    • 2
  4. elmicha
    2011-05-08T14:23:20+08:002011-05-08T14:23:20+08:00

    Android 上也有xchm和一些chm 阅读器。

    • 2
  5. Gabriel Staples
    2018-04-03T12:34:41+08:002018-04-03T12:34:41+08:00

    dv3500ea 有一个很棒的chm2pdf 答案,但我更喜欢将它们作为 html 文件阅读。

    简而言之:

    sudo apt-get install libchm-bin
    extract_chmLib myFile.chm outdir
    

    来源:http ://www.ubuntugeek.com/how-to-convert-chm-files-to-html-or-pdf-files.html

    然后打开./outdir/index.html查看转换后的html文件!耶!好多了。现在我可以像浏览 .chm 文件一样浏览它,但我也可以使用我的 Chrome 浏览器在页面中搜索文本、轻松打印等。

    让我们创建一个名为chm2html

    这是我写的一个不错的脚本。

    1. 将以下脚本复制并粘贴到文件中chm2html.py
    2. 使其可执行:chmod +x chm2html.py
    3. ~/bin如果您还没有目录,请创建一个目录:mkdir ~/bin
    4. ~/bin在您的目录中创建指向 chm2html.py 的符号链接:ln -s ~/path/to/chm2html.py ~/bin/chm2html
    5. 退出 Ubuntu,然后重新登录,或重新加载路径source ~/.bashrc
    6. 用它!chm2html myFile.chm. 这会自动转换 .chm 文件并将 .html 文件放入一个名为 的新文件夹./myFile中,然后它会创建一个名为 的符号链接./myFile_index.html,它指向./myFile/index.html.

    chm2html.py文件:从我的eRCaGuy_dotfiles 存储库在 GitHub 上获取此文件的最新版本:

    #!/usr/bin/python3
    
    """
    chm2html.py
    - convert .chm files to .html, using the command shown here, with a few extra features (folder names, shortcuts, etc):
    http://www.ubuntugeek.com/how-to-convert-chm-files-to-html-or-pdf-files.html
    - (this is my first ever python shell script to be used as a bash replacement)
    
    Gabriel Staples
    www.ElectricRCAircraftGuy.com 
    Written: 2 Apr. 2018 
    Updated: 2 Apr. 2018 
    
    References:
    - http://www.ubuntugeek.com/how-to-convert-chm-files-to-html-or-pdf-files.html
      - format: `extract_chmLib book.chm outdir`
    - http://www.linuxjournal.com/content/python-scripts-replacement-bash-utility-scripts
    - http://www.pythonforbeginners.com/system/python-sys-argv
    
    USAGE/Python command format: `./chm2html.py fileName.chm`
     - make a symbolic link to this target in ~/bin: `ln -s ~/GS/dev/shell_scripts-Linux/chm2html/chm2html.py ~/bin/chm2html`
       - Now you can call `chm2html file.chm`
     - This will automatically convert the fileName.chm file to .html files by creating a fileName directory where you are,
    then it will also create a symbolic link right there to ./fileName/index.html, with the symbolic link name being
    fileName_index.html
    
    """
    
    
    import sys, os
    
    if __name__ == "__main__":
        # print("argument = " + sys.argv[1]); # print 1st argument; DEBUGGING
        # print(len(sys.argv)) # DEBUGGING
    
        # get file name from input parameter
        if (len(sys.argv) <= 1):
            print("Error: missing .chm file input parameter. \n"
                  "Usage: `./chm2html.py fileName.chm`. \n"
                  "Type `./chm2html -h` for help. `Exiting.")
            sys.exit()
    
        if (sys.argv[1]=="-h" or sys.argv[1]=="h" or sys.argv[1]=="help" or sys.argv[1]=="-help"):
            print("Usage: `./chm2html.py fileName.chm`. This will automatically convert the fileName.chm file to\n"
                  ".html files by creating a directory named \"fileName\" right where you are, then it will also create a\n"
                  "symbolic link in your current folder to ./fileName/index.html, with the symbolic link name being fileName_index.html")
            sys.exit()
    
        file = sys.argv[1] # Full input parameter (fileName.chm)
        name = file[:-4] # Just the fileName part, withOUT the extension
        extension = file[-4:]
        if (extension != ".chm"):
            print("Error: Input parameter must be a .chm file. Exiting.")
            sys.exit()
    
        # print(name) # DEBUGGING
        # Convert the .chm file to .html
        command = "extract_chmLib " + file + " " + name
        print("Command: " + command)
        os.system(command)
    
        # Make a symbolic link to ./name/index.html now
        pwd = os.getcwd()
        target = pwd + "/" + name + "/index.html"
        # print(target) # DEBUGGING
        # see if target exists 
        if (os.path.isfile(target) == False):
            print("Error: \"" + target + "\" does not exist. Exiting.")
            sys.exit()
        # make link
        ln_command = "ln -s " + target + " " + name + "_index.html"
        print("Command: " + ln_command)
        os.system(ln_command)
    
        print("Operation completed successfully.")
    
    • 1
  6. P.R.
    2020-08-22T05:13:57+08:002020-08-22T05:13:57+08:00

    这是一个老问题,但直接的答案是使用archmage可以将 chm 内容托管为 localhost 上的网站。

    例如运行

    archmage -p 5000 file.chm

    并在您的网络浏览器中打开 http://localhost:5000 以打开文件中的chm文档。

    手册页作为参考:

    http://manpages.ubuntu.com/manpages/trusty/man1/archmage.1.html

    • 1
  7. Abdennour TOUMI
    2014-07-03T02:48:14+08:002014-07-03T02:48:14+08:00

    酒足矣。

    然后:使用此软件打开它

    在此处输入图像描述

    • 0
  8. Levon
    2021-01-27T10:41:06+08:002021-01-27T10:41:06+08:00

    口径会做这一切

    1. 安装口径

    2. 使用按钮将 chm 文件导入CalibreAdd books

    3. 使用Convert books按钮将其转换为 epub 或 pdf。

    • 0

相关问题

  • chmsee 没有打开 php 手册

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    我需要什么命令来解压缩/提取 .tar.gz 文件?

    • 8 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Marko Smith

    如何使用命令行将用户添加为新的 sudoer?

    • 7 个回答
  • Marko Smith

    更改文件夹权限和所有权

    • 9 个回答
  • Martin Hope
    EmmyS 我需要什么命令来解压缩/提取 .tar.gz 文件? 2011-02-09 14:50:41 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve