From 8b8bdca56a77ff9c8d6b450547064e75b5997d1e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 21 Dec 2015 22:59:01 -0800 Subject: Allow setting margins from metadata variables for wkhtmltopdf. Variables margin-top, margin-bottom, margin-left, margin-right. Setting them with css inside @page doesn't seem to work, at least with the released wkhtmltopdf. --- src/Text/Pandoc/PDF.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 852e8c033..e7a19c81e 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -46,7 +46,6 @@ import Control.Monad (unless, when, (<=<)) import qualified Control.Exception as E import Data.List (isInfixOf) import Data.Maybe (fromMaybe) -import qualified Data.Map as M import qualified Text.Pandoc.UTF8 as UTF8 import Text.Pandoc.Definition import Text.Pandoc.Walk (walkM) @@ -84,7 +83,12 @@ makePDF "wkhtmltopdf" writer opts doc@(Pandoc meta _) = do (\x -> ['-':'-':f, x]) $ getField f meta' let args = mathArgs ++ concatMap toArgs [("page-size", Just "letter") - ,("title", Nothing)] + ,("title", Nothing) + ,("margin-bottom", Just "1in") + ,("margin-top", Just "1in") + ,("margin-left", Just "1in") + ,("margin-right", Just "1in") + ] let source = writer opts doc html2pdf (writerVerbose opts) args source makePDF program writer opts doc = withTempDir "tex2pdf." $ \tmpdir -> do -- cgit v1.2.3