aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/PDF.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs
index bdcdbeddd..419798f7e 100644
--- a/src/Text/Pandoc/PDF.hs
+++ b/src/Text/Pandoc/PDF.hs
@@ -61,6 +61,7 @@ import Text.Pandoc.Class (fillMediaBag, getVerbosity,
readFileLazy, readFileStrict, fileExists,
report, extractMedia, PandocMonad)
import Text.Pandoc.Logging
+import Text.DocTemplates ( FromContext(lookupContext) )
#ifdef _WINDOWS
changePathSeparators :: FilePath -> FilePath
@@ -89,8 +90,16 @@ makePDF program pdfargs writer opts doc =
liftIO $ html2pdf verbosity program pdfargs source
"pdfroff" -> do
source <- writer opts doc
+ let paperargs =
+ case lookupContext "papersize" (writerVariables opts) of
+ Just s
+ | T.takeEnd 1 s == "l" -> ["-P-p" <>
+ T.unpack (T.dropEnd 1 s), "-P-l"]
+ | otherwise -> ["-P-p" <> T.unpack s]
+ Nothing -> []
let args = ["-ms", "-mpdfmark", "-mspdf",
- "-e", "-t", "-k", "-KUTF-8", "-i"] ++ pdfargs
+ "-e", "-t", "-k", "-KUTF-8", "-i"] ++
+ paperargs ++ pdfargs
generic2pdf program args source
baseProg -> do
withTempDir "tex2pdf." $ \tmpdir' -> do