pvorb / scala-pandoc

scala pandoc wrapper
MIT License
10 stars 1 forks source link

PDF output is unsupported without a file #2

Open bfontaine opened 9 years ago

bfontaine commented 9 years ago

I’m trying to convert a file from GitHub’s flavored Markdown to PDF:

scala> val f = Pandoc(from=MarkupFormat.MarkdownGitHub, to=MarkupFormat.PDF, in=new FileInputStream("/…/foo.md"))
f: scala.concurrent.Future[String] = scala.concurrent.impl.Promise$DefaultPromise@4c97cb05

scala> f.onSuccess{case succ => println(succ.length) }
0

This comes from pandoc itself, which doesn’t support PDF as an output format if you don’t give it a file:

$ pandoc -v
pandoc 1.13.1
Compiled with texmath 0.8, highlighting-kate 0.5.9.
(…)

$ pandoc -f markdown_github -t pdf foo.md
pandoc: Unknown writer: pdf
To create a pdf with pandoc, use the latex or beamer writer and specify
an output file with .pdf extension (pandoc -t latex -o filename.pdf).

This is not a problem with your library, but you might want to add a note somewhere in your documentation about this issue.


Update: there’s in fact an issue, because you have to remove the -f argument when converting into a PDF, e.g.:

$ pandoc -f markdown_github -t pdf -o foo.pdf foo.md  # this doesn't work
pandoc: Unknown writer: pdf
To create a pdf with pandoc, use the latex or beamer writer and specify
an output file with .pdf extension (pandoc -t latex -o filename.pdf).

$ pandoc -f markdown_github -o foo.pdf foo.md  # this works