alphagov/whitehall — pull request #1509 by alext (2014-05-29 16:08:56+00:00)
Title: Use pdf-reader gem to count pdf pages.

Further to https://github.com/alphagov/whitehall/pull/1458

Although pdfinfo is slower than imagemagic in some cases, imagemagic is
significantly slower for pdfs with a large number of pages:

```
$ time pdfinfo test.pdf
Title: Salisbury Plain army basing programme OEA
Keywords:
CreationDate: Tue May 20 12:46:01 2014
ModDate: Tue May 20 12:46:01 2014
Tagged: yes
Pages: 836
Encrypted: yes (print:yes copy:yes change:no addNotes:no)
Page size: 595 x 842 pts (A4)
File size: 7161312 bytes
Optimized: yes
PDF version: 1.6

real 0m0.012s
user 0m0.004s
sys 0m0.007s

$ time identify -format %n test.pdf
836

real 1m23.043s
user 1m21.184s
sys 0m1.810s
```

The pdf-reader gem is near instant for both this example, and the one
used in the previous PR.