git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: better handling of PDF images.

Previously we tried to get the image size from the image even if an explicit size was specified. Since we still can't get image size for PDFs, this made it impossible to use PDF images in docx. Now we don't try to get the image size when a size is already explicitly specified.

commit622f09617e7ecac86024a0e63f4371112e315e2e authorJohn MacFarlane <jgm@berkeley.edu> dateTue 1 Dec 2015, 00:11 (11 years ago) parent5c45a43
1 file changed+2−8
src/Text/Pandoc/Writers/Docx.hs+2−8
src/Text/Pandoc/Writers/Docx.hs+2−8
@@ -1117,14 +1117,8 @@ inlineToOpenXML opts (Image attr alt (src, tit)) = do
11171117 inlinesToOpenXML opts alt
11181118 Right (img, mt) -> do
11191119 ident <- ("rId"++) `fmap` getUniqueId
1120− (xpt,ypt) <- case imageSize img of
1121− Right size -> return $
1122− desiredSizeInPoints opts attr size
1123− Left msg -> do
1124− liftIO $ warn $
1125− "Could not determine image size in `" ++
1126− src ++ "': " ++ msg
1127− return (120,120)
1120+ let (xpt,ypt) = desiredSizeInPoints opts attr
1121+ (either (const def) id (imageSize img))
11281122 -- 12700 emu = 1 pt
11291123 let (xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700) (pageWidth * 12700)
11301124 let cNvPicPr = mknode "pic:cNvPicPr" [] $