Как открыть и конвертировать документы CHM?

У меня есть несколько документов в формате .chm. Я задавался вопросом, есть ли в Ubuntu формат файла, который легче ориентировать, поддерживать и иметь файл одинакового размера?

Если есть, я хотел бы начать конвертировать все эти книги и, вероятно, использовать их с меньшими трудностями на всех моих компьютерах с Ubuntu и Android-телефоне.

9
задан 3 January 2017 в 21:19

7 ответов

Вы можете преобразовать их в PDF с помощью программы командной строки chm2pdf ( установить chm2pdf здесь ). После установки вы можете запустить команду из терминала следующим образом:

chm2pdf --book in.chm out.pdf

Если вы не знали, доступно несколько считывателей chm - просто найдите chm в Центре программного обеспечения.

Вы также можете извлечь файлы chm в html, используя инструмент командной строки 7-Zip ( install p7zip-full здесь ):

7z x file.chm
0
ответ дан 3 January 2017 в 21:19

Если вы не хотите использовать PDF, я бы посоветовал Epub, довольно хороший, открытый формат электронных книг, вы можете установить хороший читатель для него под названием Caliber в Ubuntu, Caliber имеет полезную функцию преобразования, которая может импортировать chm файлы, а затем конвертировать их в другие форматы EPUB включены. epubs также легко читаются на большинстве смартфонов и планшетов.

Калибр можно установить из центра программного обеспечения.

0
ответ дан 3 January 2017 в 21:19

Существует также KChmViewer, если вы предпочитаете KDE.

0
ответ дан 3 January 2017 в 21:19

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! Yaaay! Намного лучше. Теперь я могу переместиться по нему точно так же, как .chm файл, но я могу также использовать свой браузер Chrome, чтобы искать страницы текст, легко распечатать, и т.д.

Давайте сделаем команду названной chm2html

Вот хороший сценарий, который я записал.

  1. Скопируйте и вставьте ниже сценария в файл chm2html.py
  2. Сделайте это исполняемым файлом: chmod +x chm2html.py
  3. Создайте a ~/bin каталог, если у Вас уже нет того: mkdir ~/bin
  4. Сделайте символьную ссылку на chm2html.py в Вашем ~/bin каталог: 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 файл:

#!/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.")
0
ответ дан 3 January 2017 в 21:19

Wine достаточно.

Затем: откройте его, используя этот мягкий

enter image description here

0
ответ дан 3 January 2017 в 21:19

Существует также xchm и несколько читателей chm на Android .

0
ответ дан 3 January 2017 в 21:19

Calibre все сделает

  1. Установите Calibre

  2. импортируйте файл chm в Calibre с помощью Добавьте книги кнопка

  3. используйте кнопку Конвертировать книги, чтобы преобразовать ее в формат epub или pdf.

0
ответ дан 26 January 2021 в 18:41

Другие вопросы по тегам:

Похожие вопросы: