카테고리 없음

Image to PDF (Linux)

Data Engineer 2009. 9. 6. 21:17

글최초 작성: 20090115

작성자: 최원효(wono77)

 

[pdf 라이브러리] poppler

 

pdf 리눅스 c 기반 오픈소스 poppler이란 것이 있다.

(라이센스 LPGL:소스를 자유롭게 쓰며, 소스로 변형해도 소스를 공개할 필요없음)

pdf의 구분은 정확히 이분법으로 나눠지지는 않지만,

pdf는 만들 때 워드나 문서를 가지고 텍스트를 담고 있는 pdf로 생성하는 "텍스트pdf"

이미지를 가지고 생성하는 "이미지pdf" 이렇게 2가지로 분류된다.

 

문서로 만들더라도 텍스트 정보가 포함되지 않으면 이미지pdf가 된다.

 

이런 pdf에서 텍스트를 추출하거나 이미지를 추출해내는 툴은 여러가지가 있는데,

poppler에 대해 알아보자.

 

1. 정의

 

위키페이아에서는 아래와 같이 정의하고 있다.

url: http://en.wikipedia.org/wiki/Poppler_(software)

 

Poppler is a free software library for viewing PDF documents; it is maintained by freedesktop.org. Poppler is based on Xpdf-3.0 codebase and was created for two stated reasons: to allow easier reuse of the rendering engine to reduce redundant work, and to go beyond the goals of Xpdf and integrate more closely and reuse more functionality provided by the operating system (whereas Xpdf is very much self contained).

Poppler is used by several PDF viewers and it can even be used as a backend to Xpdf. Many other applications also use poppler, such as KOffice.

The name comes from the Popplers on the animated television series Futurama in the episode "The Problem with Popplers".

 

2. 공식 사이트

 

정식 release site 는 아래와 같다.

2009년 1월 15일 현재 poppler-0.10.3.tar.gz  버젼까지 나와있다.

http://poppler.freedesktop.org/

 

3. 자세한 설치방법

 

위 두 사이트만으로는 아직 뭔가 설명이 부족하다. 구글링을 해보면,

poppler-0.10.1 의 configuration과 자세한 설치 방법 설명이 있다.

(http://www.linuxfromscratch.org/blfs/view/svn/general/poppler.html)

 

Poppler Dependencies

Required

pkg-config-0.23 (http://www.linuxfromscratch.org/blfs/view/svn/general/pkgconfig.html)

and Fontconfig-2.6.0 (http://www.linuxfromscratch.org/blfs/view/svn/general/fontconfig.html)

 

Installation of Poppler

Caution

Poppler will overwrite command-line utilities and man pages previously installed by the Xpdf package. If you prefer to keep the Xpdf versions of these files, pass the --disable-utils parameter to the configure command below.

 

The configure command below includes three parameters which disable various rendering back-ends. Ensure you remove any of the parameters for which you have the corresponding dependency installed. Install Poppler by running the following commands:

./configure --prefix=/usr \
            --sysconfdir=/etc \
            --enable-zlib \
            --disable-cairo-output \
            --disable-poppler-glib \
            --disable-gtk-test &&
make

This package does not come with a test suite.

Now, as the root user:

make install &&
install -v -m755 -d      /usr/share/doc/poppler-0.10.1 &&
install -v -m644 README* /usr/share/doc/poppler-0.10.1
사용법:
`README' -> `/usr/share/doc/poppler-0.10.1/README'
`README-XPDF' -> `/usr/share/doc/poppler-0.10.1/README-XPDF'
To generate a plain text file, run pdftotext:
  pdftotext file.pdf
There are four additional utilities (which are fully described in
their man pages):
  pdfinfo -- dumps a PDF file's Info dictionary (plus some other
             useful information)
  pdffonts -- lists the fonts used in a PDF file along with various
              information for each font
  pdftoppm -- converts a PDF file to a series of PPM/PGM/PBM-format
              bitmaps
  pdfimages -- extracts the images from a PDF file
Usage: pdfimages [options] <PDF-file> <image-root>
 

If you downloaded the additional encoding data package, install it by issuing the following command after unpacking the tarball and changing into the newly-created package source directory (as the root user):

make prefix=/usr install

Command Explanations

--enable-zlib: This parameter forces the build to link with the system-installed libz library to enable compressed PDF functionality.

--disable-cairo-output: This parameter disables building the cairo graphics backend. Remove this parameter if you have cairo installed.

--disable-poppler-glib and --disable-gtk-test: These parameters disable building the GLib wrapper and GTK+ test program. Remove these parameters if you have GTK+-2 installed. Note that if you plan on building Evince-0.8.3, you must build the GLib wrapper.

--disable-static: Prevent static libraries being built and installed.

Configuring Poppler

Config Files

/etc/xpdfrc

 

많은 도움이 되었다. 하지만, 눈으로만 봐서는 모른다.

직접 설치하고 실행해봐야만 자기 지식이 되는법.

직접 설치하고 실행해본후 추가적인 정리를 하도록 하겠다.

 

by wono77.