diff options
| author | Albert Krewinkel <albert@zeitkraut.de> | 2022-01-17 18:19:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-17 09:19:03 -0800 |
| commit | 7f50324ff940b6fa996c59726d46ec108d5e23bd (patch) | |
| tree | 0c095117cac06120c9d37b4e5edd40b2dbc39711 /src | |
| parent | 41476092ff20d4919ff49399e67933330d1f42d2 (diff) | |
PDF: support pagedjs-cli as pdf engine (#7838)
PagedJS is a polyfill and supports the Paged Media standards by the W3C.
<https://www.pagedjs.org/>
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 2 | ||||
| -rw-r--r-- | src/Text/Pandoc/PDF.hs | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index 17db2cb3b..dbf1ca706 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -109,7 +109,7 @@ latexEngines :: [String] latexEngines = ["pdflatex", "lualatex", "xelatex", "latexmk", "tectonic"] htmlEngines :: [String] -htmlEngines = ["wkhtmltopdf", "weasyprint", "prince"] +htmlEngines = ["pagedjs-cli", "wkhtmltopdf", "weasyprint", "prince"] engines :: [(Text, String)] engines = map ("html",) htmlEngines ++ diff --git a/src/Text/Pandoc/PDF.hs b/src/Text/Pandoc/PDF.hs index 85e41a105..5833cb605 100644 --- a/src/Text/Pandoc/PDF.hs +++ b/src/Text/Pandoc/PDF.hs @@ -70,7 +70,8 @@ changePathSeparators = makePDF :: (PandocMonad m, MonadIO m, MonadMask m) => String -- ^ pdf creator (pdflatex, lualatex, xelatex, - -- wkhtmltopdf, weasyprint, prince, context, pdfroff, + -- wkhtmltopdf, weasyprint, prince, context, + -- pdfroff, pagedjs, -- or path to executable) -> [String] -- ^ arguments to pass to pdf creator -> (WriterOptions -> Pandoc -> m Text) -- ^ writer @@ -80,7 +81,7 @@ makePDF :: (PandocMonad m, MonadIO m, MonadMask m) makePDF program pdfargs writer opts doc = case takeBaseName program of "wkhtmltopdf" -> makeWithWkhtmltopdf program pdfargs writer opts doc - prog | prog `elem` ["weasyprint", "prince"] -> do + prog | prog `elem` ["pagedjs-cli" ,"weasyprint", "prince"] -> do source <- writer opts doc verbosity <- getVerbosity liftIO $ html2pdf verbosity program pdfargs source @@ -434,7 +435,8 @@ html2pdf verbosity program args source = hClose h1 hClose h2 BS.writeFile file $ UTF8.fromText source - let pdfFileArgName = ["-o" | takeBaseName program == "prince"] + let pdfFileArgName = ["-o" | takeBaseName program `elem` + ["pagedjs-cli", "prince"]] let programArgs = args ++ [file] ++ pdfFileArgName ++ [pdfFile] env' <- getEnvironment when (verbosity >= INFO) $ |
