当前位置: > CentOS > CentOS教程 >

CentOS7下使用Kchmviewer查看chm文檔

时间:2015-01-08 23:01来源:未知 作者:admin

1.前因
2.簡介
3.嘗試過程
4.一舉成功


前因:
偶然中知曉了CodeIgniter(CI)框架,便下載了該框架。官網不提供文檔下載,在網路上只找到最新版的CHM格式文檔。而CentOS7無法直接查看CHM文檔。印象中有人說過Linux下有CHM閱讀器,便在網絡搜索了一番,找到了Kchmviewer。


簡介:
Kchmviewer,一款Linux下的CHM閱讀器。官網下載地址

會看到如下說明:

1
2
3
4
5
6
7
8
9
10
If you want to build Kchmviewer from the source, you need to do the following:

Download the latest version from SourceForge;
Check that you have installed the development packages for your platform, notably gcc, g++ and make;
Check that you have installed qt4-devel and chmlib-devel (or libchm-devel) packages. If your platform has separate development files for QtWebkit you must install them too;
If you want to build the KDE version, check that you have installed the appropriate development package (typically kde4-workspace-devel) and cmake;
Unpack the downloaded archive and cd into it;
To build the Qt-only version, run qmake && make
To build the KDE version, run mkdir build; cd build && cmake .. && make
To install the application just copy the binary somewhere.

第1條中的“SourceForge”是個超鏈接,鏈接到http://sourceforge.net/projects/kchmviewer/files/


嘗試過程:
本人首先下載的是源碼包

1
kchmviewer-7.1.tar.gz

解壓安裝時報錯

1
2
3
4
5
6
7
8
9
10
11
12
[root@localhost Downloads]# tar zxf kchmviewer-7.1.tar.gz 
[root@localhost Downloads]# ls
kchmviewer-7.1
kchmviewer-7.1.tar.gz
[root@localhost Downloads]# cd kchmviewer-7.1/
[root@localhost kchmviewer-7.1]# ls
build-release.sh      COPYING           kchmviewer.pro  po            templates
build-win32-mingw.sh  DBUS-bindings     lib             portable.txt  tests
ChangeLog             FAQ               nsis            README
CMakeLists.txt        FindLibchm.cmake  packages        src
[root@localhost kchmviewer-7.1]# ./configure
bash: ./configure: No such file or directory

於是轉而下載rpm包

1
kchmviewer-7.1-1.x86_64.rpm

但提示庫文件依賴

1
2
3
4
5
6
7
8
[root@localhost Downloads]# ls
kchmviewer-7.1
kchmviewer-7.1-1.x86_64.rpm
kchmviewer-7.1.tar.gz
[root@localhost Downloads]# rpm -ivh kchmviewer-7.1-1.x86_64.rpm 
error: Failed dependencies:
    libQtWebKit.so.4()(64bit) is needed by kchmviewer-7.1-1.x86_64
    libchm.so.0()(64bit) is needed by kchmviewer-7.1-1.x86_64

於是又試了一個印象中的命令

1
yum install kchmviewer-7.1-1.x86_64.rpm


一舉成功:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[root@localhost Downloads]# yum install kchmviewer-7.1-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining kchmviewer-7.1-1.x86_64.rpm: kchmviewer-7.1-1.x86_64
Marking kchmviewer-7.1-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package kchmviewer.x86_64 0:7.1-1 will be installed
--> Processing Dependency: libQtWebKit.so.4()(64bit) for package: kchmviewer-7.1-1.x86_64
Loading mirror speeds from cached hostfile
 * epel: ftp.sjtu.edu.cn
 * nux-dextop: li.nux.ro
 * remi: mirrors.hustunique.com
 * remi-php55: mirrors.hustunique.com
--> Processing Dependency: libchm.so.0()(64bit) for package: kchmviewer-7.1-1.x86_64
--> Running transaction check
---> Package chmlib.x86_64 0:0.40-9.el7 will be installed
---> Package qtwebkit.x86_64 0:2.3.3-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch       Version           Repository                    Size
================================================================================
Installing:
 kchmviewer     x86_64     7.1-1             /kchmviewer-7.1-1.x86_64     608 k
Installing for dependencies:
 chmlib         x86_64     0.40-9.el7        epel                          46 k
 qtwebkit       x86_64     2.3.3-3.el7       epel                         9.9 M

Transaction Summary
================================================================================
Install  1 Package (+2 Dependent packages)

Total size: 11 M
Total download size: 9.9 M
Installed size: 35 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): chmlib-0.40-9.el7.x86_64.rpm                        |  46 kB   00:00     
(2/2): qtwebkit-2.3.3-3.el7.x86_64.rpm                     | 9.9 MB   00:05     
--------------------------------------------------------------------------------
Total                                              1.7 MB/s | 9.9 MB  00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : chmlib-0.40-9.el7.x86_64                                     1/3 
  Installing : qtwebkit-2.3.3-3.el7.x86_64                                  2/3 
  Installing : kchmviewer-7.1-1.x86_64                                      3/3 
  Verifying  : qtwebkit-2.3.3-3.el7.x86_64                                  1/3 
  Verifying  : kchmviewer-7.1-1.x86_64                                      2/3 
  Verifying  : chmlib-0.40-9.el7.x86_64                                     3/3 

Installed:
  kchmviewer.x86_64 0:7.1-1                                                     

Dependency Installed:
  chmlib.x86_64 0:0.40-9.el7            qtwebkit.x86_64 0:2.3.3-3.el7           

Complete!
[root@localhost Downloads]#

之後直接在命令行中輸入kchmviewer

1
[root@localhost ~]# kchmviewer

或在圖形界面中
Applications->Office->KchmViewer打開
KchmViewer

註:此操作需要安在Yum源,具體可參考本博CentOS7安裝及使用簡記中“yum源”部分

不過有亂碼,編碼改爲UTF-8也不行,這個暫時還沒能解決,先留着。

(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容