PDFs 합치기
리눅스는 pdf 합치기 위한 특별한 프로그램이 불필요하다. 다른 프로그램 설치하면서 의존성문제로 나도 모르게 딸려온 팩키지 중에
아래 3개는 이미 설치가 되어 있었다. 간단한 명령어로 처리가 가능하며, 쉽고 유용한 정보이다.
1. pdfunite
만약 당신의 시스템에 Poppler 가 설치되어 있다면 "pdfunite" 라는 명령어 파일이 있을것입니다.
이 명령어는 아주 빠르게 실행되지만 설정관련 옵션기능은 없으며, 내부에 하이퍼링크는 깨져버리는 문제가 있습니다.
대신 사용법은 심플합니다.
$ pdfunite input1.pdf input2.pdf input3.pdf output.pdf
2. pdfjam
만약 LaTeX 및 pdfpages 를 설치했다면 "pdfjam" 명령어가 있을 것입니다. .
$ pdfjam input1.pdf input2.pdf input3.pdf -o output.pdf
pdfunite와 반대로 이것은 엄청난 양의 설정옵션이 있습니다. pdfjam --help 으로 확인해볼수있습니다.
예를 들면 페이지크기, LaTex 서문 등
그리고 다른 유용한 명령어들이 있습니다.
- pdf90, pdf180, pdf27 rotate the pages of one or more PDF files.
- pdfflip reflects the pages of one or more PDF files.
- pdfjam-slides6up, pdfjam-slides3up convert PDF presentation slides to six-per-page or three-per-page for handout purposes.
이것들은 pdfunite 보다 다소 느릴수 있고 모든 하이퍼링크는 사라져 버립니다.
3. pdftk
pdftk는 Ghostscript 팩키지에 포함되어 있는 명령어이며 대부분의 리눅스에서 사용이 가능하다.
사용방법은 아래 처럼 단순하다.
$ pdftk input1.pdf input2.pdf input3.pdf cat output output.pdf
이것은 또한 많은 옵션을 가지고 있다.(see pdftk --help) 이것은 pdfunit 보다 약간 느리지만 그래도
빠른편이다. 위의 다른 명령어와 달리 하이퍼링크가 보존되며 작동이 잘된다.
Comparison
pdfunite | pdfjam | pdftk | |
Configuration | No configuration options. | Lots of options. See pdfjam --help. | Lots of options. See pdftk --help. |
Speed | 0.200s | 1.297s | 0.293s |
File Size | 718 KiB | 743 KiB | 774 KiB |
Hyperlinks | Internal hyperlinks broken | Gone | OK |
Page Format | Original format is preserved. | All pages are converted to the same format. | Original format is preserved. |
Conclusion
Given the comparison table above, I'd usually go for pdftk. The command is harder to memorize and generates the largest files, but it is very fast and preserves both original file format and hyperlinks.
For the cases where I need additional features like header injection, page numbering, presentation handouts and more, I'll usepdfjam.