git.iko.soy/typeable/pandoc
on master help sign in
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.

commit8b8bdca56a77ff9c8d6b450547064e75b5997d1e authorJohn MacFarlane <jgm@berkeley.edu> dateMon 21 Dec 2015, 22:59 (11 years ago) parent0596b65
1 file changed+6−2
src/Text/Pandoc/PDF.hs+6−2
src/Text/Pandoc/PDF.hs+6−2
@@ -46,7 +46,6 @@ import Control.Monad (unless, when, (<=<))
4646import qualified Control.Exception as E
4747import Data.List (isInfixOf)
4848import Data.Maybe (fromMaybe)
49−import qualified Data.Map as M
5049import qualified Text.Pandoc.UTF8 as UTF8
5150import Text.Pandoc.Definition
5251import Text.Pandoc.Walk (walkM)
@@ -84,7 +83,12 @@ makePDF "wkhtmltopdf" writer opts doc@(Pandoc meta _) = do
8483 (\x -> ['-':'-':f, x]) $ getField f meta'
8584 let args = mathArgs ++
8685 concatMap toArgs [("page-size", Just "letter")
87− ,("title", Nothing)]
86+ ,("title", Nothing)
87+ ,("margin-bottom", Just "1in")
88+ ,("margin-top", Just "1in")
89+ ,("margin-left", Just "1in")
90+ ,("margin-right", Just "1in")
91+ ]
8892 let source = writer opts doc
8993 html2pdf (writerVerbose opts) args source
9094makePDF program writer opts doc = withTempDir "tex2pdf." $ \tmpdir -> do