c++ mupdf編譯

mupdf用於將pdf轉化爲圖片

版本:/home/zjm/activemq/mupdf-1.11-source

編譯 make prefix=/usr/local install
prefix後面跟的是目標目錄,正常應爲/usr/local/mupdf

現象:
1、無權限:用sudo
2、glfw未找到,需要自己編譯glfw
編譯步驟:1、在mupdf-1.11-source目錄下cd ./thirdparty/glfw
2、mkdir glfw-build
cd glfw-build
cmake (glfw源碼所在目錄)
make
make install(可能需要sudo)
(編譯時可能會遇到第三方庫缺失,將錯誤自行百度即可)

ps:mupdf-1.11-source/thirdparty目錄下包含的就是編譯mupdf所用到的第三方庫。我只遇到了glfw沒有,若遇到別的沒有,則自己進行編譯。

編譯結果:
/usr/local/mupdf的目錄結構
├── bin
│?? ├── mujstest
│?? ├── mupdf-gl
│?? ├── mupdf-x11
│?? ├── mupdf-x11-curl
│?? ├── muraster
│?? └── mutool
├── include
│?? └── mupdf
│?? ├── fitz
│?? │?? ├── annotation.h
│?? │?? ├── archive.h
│?? │?? ├── band-writer.h
│?? │?? ├── bidi.h
│?? │?? ├── bitmap.h
│?? │?? ├── buffer.h
│?? │?? ├── colorspace.h
│?? │?? ├── compressed-buffer.h
│?? │?? ├── config.h
│?? │?? ├── context.h
│?? │?? ├── crypt.h
│?? │?? ├── device.h
│?? │?? ├── display-list.h
│?? │?? ├── document.h
│?? │?? ├── filter.h
│?? │?? ├── font.h
│?? │?? ├── function.h
│?? │?? ├── geometry.h
│?? │?? ├── getopt.h
│?? │?? ├── glyph-cache.h
│?? │?? ├── glyph.h
│?? │?? ├── hash.h
│?? │?? ├── image.h
│?? │?? ├── link.h
│?? │?? ├── outline.h
│?? │?? ├── output.h
│?? │?? ├── output-pcl.h
│?? │?? ├── output-png.h
│?? │?? ├── output-pnm.h
│?? │?? ├── output-ps.h
│?? │?? ├── output-pwg.h
│?? │?? ├── output-svg.h
│?? │?? ├── output-tga.h
│?? │?? ├── path.h
│?? │?? ├── pixmap.h
│?? │?? ├── pool.h
│?? │?? ├── separation.h
│?? │?? ├── shade.h
│?? │?? ├── store.h
│?? │?? ├── stream.h
│?? │?? ├── string-util.h
│?? │?? ├── structured-text.h
│?? │?? ├── system.h
│?? │?? ├── text.h
│?? │?? ├── track-usage.h
│?? │?? ├── transition.h
│?? │?? ├── tree.h
│?? │?? ├── ucdn.h
│?? │?? ├── util.h
│?? │?? ├── version.h
│?? │?? ├── writer.h
│?? │?? └── xml.h
│?? ├── fitz.h
│?? ├── html.h
│?? ├── memento.h
│?? ├── pdf
│?? │?? ├── annot.h
│?? │?? ├── appearance.h
│?? │?? ├── clean.h
│?? │?? ├── cmap.h
│?? │?? ├── crypt.h
│?? │?? ├── document.h
│?? │?? ├── event.h
│?? │?? ├── field.h
│?? │?? ├── font.h
│?? │?? ├── interpret.h
│?? │?? ├── javascript.h
│?? │?? ├── name-table.h
│?? │?? ├── object.h
│?? │?? ├── output-pdf.h
│?? │?? ├── page.h
│?? │?? ├── parse.h
│?? │?? ├── resource.h
│?? │?? ├── widget.h
│?? │?? └── xref.h
│?? ├── pdf.h
│?? ├── pdf-tools.h
│?? └── svg.h
├── lib
│?? ├── libmupdf.a
│?? └── libmupdfthird.a
└── share
├── doc
│?? └── mupdf
│?? ├── CHANGES
│?? ├── COPYING
│?? ├── naming.txt
│?? ├── overview.txt
│?? ├── progressive.txt
│?? ├── README
│?? ├── refcount.txt
│?? ├── thirdparty.txt
│?? └── types.txt
└── man
└── man1
├── mupdf.1
└── mutool.1
舉例:
mupdf-1.11-source/docs中有個example.c的栗子,用於將pdf中的某一頁轉換成圖片的像素矩陣並輸出。
編譯命令:g++ example.c -o example -I/usr/local/mupdf/include/ -L/usr/local/mupdf/lib/ -lmupdf -lmupdfthird

使用時:
INCLUDEPATH +=/usr/local/mupdf/include/
LIBS += -L/usr/local/mupdf/lib/

LIBS += -lmupdf
LIBS += -lmupdfthird

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章