Getting the page width from the reference file

Uses it to scale images that are too large.
When there is no reference files, default to a US letter portrait size
to scale the images
Merge pull request #1668 from gbataille/widthFromRef2

Getting the page width from the reference file