mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-27 18:56:34 +00:00
T.P.PDF: fix papersize on PDF generation via ms.
We need to set an option in pdfroff in addition to including a macro in the ms file. With this fix, `-Vpapersize=a4` should be sufficient to produce A4 PDF via ms. Closes #8403.
This commit is contained in:
+10
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user