惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
I
InfoQ
H
Help Net Security
GbyAI
GbyAI
博客园 - 叶小钗
Recent Announcements
Recent Announcements
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
Y
Y Combinator Blog
L
LangChain Blog
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
博客园 - Franky
D
Docker
Jina AI
Jina AI
罗磊的独立博客

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
How to Merge PDF/images to Generate a Single PDF
2021-05-31 · via jdhao's digital space

I have several PDF files/images that I want to merge to one file. Each page in the PDF is actually an image. Here is what works best for me.

Merge PDF files#

Use pdfunite from poppler-utils package:#

Pdfunite provided by package poppler-utils can be used to achieve our goal:

pdfunite a.pdf b.pdf output.pdf

The size of produced PDF file is small (about the sum of size of a.pdf and b.pdf). The image quality is well preserved.

Use convert from imagemagick:#

convert a.pdf b.pdf output.pdf

The images in the produced pdf have very poor quality and is blurred to be hardly recognizable. We can use -desnity option to increase the image quality:

convert -density 200 a.pdf b.pdf output.pdf

This time, the image quality improves greatly, but the size of produced file also increases greatly (significantly larger that what is produce by pdfunite).

Overall, using pdfunite is the best choice.

Merge images to produce a PDF file#

To merge several iamges and produce a PDF file. We can use convert from imagemagick:

convert img1.jpg img2.jpg output.pdf

We can also use img2pdf for this:

img2pdf img1.jpg img2.jpg -o output.pdf

Reference#