git.iko.soy/typeable/pandoc
on master help sign in
Make image size detection for PDFs more robust.

See #4322.

commitc75740e22ce35165108e020be174ebe9f35ea667 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 16 Feb 2018, 13:45 (9 years ago) parent5a56819
1 file changed+4−2
src/Text/Pandoc/ImageSize.hs+4−2
src/Text/Pandoc/ImageSize.hs+4−2
@@ -283,8 +283,10 @@ pdfSize img =
283283 "/MediaBox" `B.isPrefixOf` l)) (B.lines img) of
284284 (x:_)
285285 | "/MediaBox" `B.isPrefixOf` x
286− -> case B.words $ B.filter (\c -> c /= '[' && c /= ']')
287− $ B.drop 10 x of
286+ -> case B.words . B.takeWhile (/=']')
287+ . B.drop 1
288+ . B.dropWhile (/='[')
289+ $ x of
288290 [x1, y1, x2, y2] -> do
289291 x1' <- safeRead $ B.unpack x1
290292 x2' <- safeRead $ B.unpack x2