From 622f09617e7ecac86024a0e63f4371112e315e2e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 1 Dec 2015 00:11:57 -0800 Subject: 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. --- src/Text/Pandoc/Writers/Docx.hs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index dd4a4b258..c46a5efae 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -1117,14 +1117,8 @@ inlineToOpenXML opts (Image attr alt (src, tit)) = do inlinesToOpenXML opts alt Right (img, mt) -> do ident <- ("rId"++) `fmap` getUniqueId - (xpt,ypt) <- case imageSize img of - Right size -> return $ - desiredSizeInPoints opts attr size - Left msg -> do - liftIO $ warn $ - "Could not determine image size in `" ++ - src ++ "': " ++ msg - return (120,120) + let (xpt,ypt) = desiredSizeInPoints opts attr + (either (const def) id (imageSize img)) -- 12700 emu = 1 pt let (xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700) (pageWidth * 12700) let cNvPicPr = mknode "pic:cNvPicPr" [] $ -- cgit v1.2.3