Support direct pdf generation with asciidoc
Posted: 23 Feb 2018, 12:51
For now a2x is used only to create html, while to create pdf - this html is processed by wkhtmltopdf.
I have live ebuild for warzone2100 under gentoo, in local overlay.
Last time i faced problem with wkhtmltopdf - since it requires X environment. Appart that it also needs home directory with write permission.
Without that i get this error:
Since it happens just when wkhtmltopdf is installed, temporary solution would be to uninstall it (i installed it to see, how it will work during wz2100 installation).
It would be not problem, if building with root access, however portage has FEATURES to do as much job as possible (sources fetch, build, etc) under special "portage" user. Problem, is that this user doesn't have own home directory, instead using root's home, where it can't write. Though this particular issue doesn't look unsolvable, i tried to create two pdf versions manually, one with wkhtmltopdf and second - with a2x:
To be able to create pdf in this way you need dblatex: http://dblatex.sourceforge.net/
Resulting pdfs differ slightly by style - for me a2x output has a very slightly wider space between text lines. Generated TOC has much wider line spacing as well, but for pros - it creates pdf TOC, so you can use it through document viewer sidebar - so, you don't even need to watch TOC pages in begining, no matter how much they occupy.
Both results are in attachement.
I did not experiment with options yet, so i think style may be improved.
Would be good to add options to control, what tool is used for pdf generation: like --with-pdf-tool=asciidoc/wkhtmltopdf.
I have live ebuild for warzone2100 under gentoo, in local overlay.
Last time i faced problem with wkhtmltopdf - since it requires X environment. Appart that it also needs home directory with write permission.
Without that i get this error:
Code: Select all
wkhtmltopdf ./quickstartguide.html ./quickstartguide.pdf
QStandardPaths: wrong ownership on runtime directory /var/run/user/0, 0 instead of 250
It would be not problem, if building with root access, however portage has FEATURES to do as much job as possible (sources fetch, build, etc) under special "portage" user. Problem, is that this user doesn't have own home directory, instead using root's home, where it can't write. Though this particular issue doesn't look unsolvable, i tried to create two pdf versions manually, one with wkhtmltopdf and second - with a2x:
Code: Select all
a2x -f pdf ./quickstartguide.asciidoc
Resulting pdfs differ slightly by style - for me a2x output has a very slightly wider space between text lines. Generated TOC has much wider line spacing as well, but for pros - it creates pdf TOC, so you can use it through document viewer sidebar - so, you don't even need to watch TOC pages in begining, no matter how much they occupy.
Both results are in attachement.
I did not experiment with options yet, so i think style may be improved.
Would be good to add options to control, what tool is used for pdf generation: like --with-pdf-tool=asciidoc/wkhtmltopdf.