Mac PDF 操作

Command Line - Extract

brew install qpdf

// 假如文件太大, 操作需时
qpdf infile.pdf --pages infile.pdf 1-5,20-30 -- outfile.pdf

qpdf infile.pdf --pages infile.pdf 1-5,20-30 -- outfile.pdf --verbose


Command Line - Add page number

NIN: 在mojave中, 似乎无法用下面的方法安装。也无法使用opam安装。
最后只能local 安装。

$ wget
$ brew install --build-from-source ./cpdf.rb
$ brew tap oncletom/brew
$ brew install cpdf

// Add page number to bottom center

$ cpdf -bottom 10 -font Courier -add-text "- %Page -" 1.pdf -o out.pdf

Ref: PDF Command Line Tools Usage Examples

Install various tools

brew install poppler

Command Line - Combine images to PDF

convert *.jpg mypdf.pdf

Command Line - Convert PDF to images

$ brew install imagemagick

// 需要安装ghostscript, 否则报错
$ brew install ghostscript

// 全部页面转换
$ convert file.pdf image.png

// 转换某一页
$ convert file.pdf[0] image.png # convert the first page
$ convert file.pdf[2] image.png # convert the third page

// 转换某几页
	$ convert file.pdf[5-10,15-22,35] images/image.png

Ref: split pdf

Combine PDFs

qpdf --empty --pages 1.pdf 2.pdf -- out.pdf

// 下面用 Mac 的 Preview

Extract Pages

In Preview, View > Thumbnails

  1. 选择需要导出的页面, 然后按 Cmd+C, 复制.
  2. File > New From Clipboard, 将以选择的页面创建一个临时的 PDF
  3. Save

Join PDF

  1. Edit - Insert - Pages from File
  2. Save

Delete PDF

  1. In Preview, open the PDF.
  2. From the toolbar, click Sidebar to open the sidebar drawer. You will see thumbnails of each page in the PDF.
  3. Click on the thumbnail of the page you would like to delete.
  4. Go to Edit >Delete or click the delete button on your keyboard.


Bonus - Print Oversized pdf

Adobe Reader - Print - Poster

Show Comments