I would like to see info or man pages in PDF format so the formatting displays correctly. I see texi file can be converted (with texi2pdf) but I don't find any texi files with locate. In this case, I'm interested in the Gpg2 info page.
-
did you do updatedb before using locate? locate's database is updated once a day with crond.daily. if you want to use locate files created earlier than 24h from when cron.daily ran, it won't find them. – Alex Austin Oct 06 '17 at 14:53
-
No, the info page **info gpg2** @dessert – userDepth Oct 06 '17 at 14:53
-
4Do you need to generate them? The GNU info pages are [all available](https://www.gnupg.org/documentation/manuals.html) as PDF files on the GNU website. For example: https://www.gnupg.org/documentation/manuals/gnupg.pdf – terdon Oct 06 '17 at 14:55
-
Yes I totally need to generate them because the gnu pdf files may not be the same version – userDepth Oct 06 '17 at 14:59
-
4Um. Then choose the right version? But in any case, this won't be simple. The info files in `/usr/share/info` are in info format. As you can see if you open one, these were generated *from* the `foo.texinfo` files, but I don't think the `foo.texinfo` are distributed by default. After all, they're already being distributed in a format designed to be displayed correctly. You just need to use `info` to see them. But try getting the source packages of whatever package's info you want. They might contain the texinfo files. – terdon Oct 06 '17 at 15:04
-
2@terdon Btw, where are different versions of the info pages stored? I didn't find any other than the one you linked – it says “Version 2.2.0” whereas `gpg2 --version` says “gpg (GnuPG) 2.1.11” (in Xenial). – dessert Oct 06 '17 at 15:15
-
1@dessert I stand corrected. I had assumed they'd all be available, but apparently I was wrong. – terdon Oct 06 '17 at 16:21
-
Made this little script for both **man** and **info**: http://paste.ubuntu.com/25687487/ – userDepth Oct 06 '17 at 18:43
-
@userDepth … and I took the freedom to correct it using [shellcheck.net](http://www.shellcheck.net): https://paste.ubuntu.com/25687548/ – dessert Oct 06 '17 at 18:53
3 Answers
i=gpg2; info $i | aha | wkhtmltopdf - $i.pdf
creates a decent PDF file.
LibreOffice is also able to convert to PDF:
i=gpg2; info $i > $i && libreoffice --convert-to pdf $i && rm $i
The output can compete with the above solution in my opinion.
Also there's enscript which offers interesting formatting options (seeman enscript):
i=gpg2; info $i > $i; enscript -B -o $i.ps $i; ps2pdf $i.ps $i.pdf && rm $i{,.ps}
info gpg2 | lp -d PDF
makes use of CUPS PDF (you might need to install the cups-pdf package first) to print a PDF file in ~/PDF/ – but it's not as fancy.
i=gpg2; info -ao $i.pdf $i
also works, but the output is plain ugly.
- 39,392
- 12
- 115
- 163
-
1FYI this also works for man pages - **man gpg2 | aha | wkhtmltopdf - info_gpg2.pdf** – userDepth Oct 06 '17 at 15:40
Others have already answered the question of how to convert info pages to PDF, so I'll cover man pages (the original and best online documentation!).
On most modern Unix systems you can convert man pages to PDF just by using the -Tpdf option to man, but be aware that it will output to stdout so you'll need to redirect it:
man -Tpdf man > manpage.pdf
If, for any reason, your installed version of troff/groff (the formatting engine behind man pages) doesn't support direct PDF output then you can use ps2pdf, part of Ghostscript:
man -Tps man | ps2pdf - manpage.pdf
- 71
- 2
You can get the .texi files from the source package:
Use
info -w Gpg2
to find the .info file. In this case it's /usr/share/info/gnupg.info.gz.
Now find the package that contains it:
dpkg -S /usr/share/info/gnupg.info.gz
This tells you the file is in the package gnupg. So download the source package:
apt-get source gnupg
apt-get tells you
Picking 'gnupg2' as source package instead of 'gnupg'
and
dpkg-source: info: extracting gnupg2 in gnupg2-2.1.15
So you should find the .texi files somewhere in the folder gnupg2-2.1.15/ (in this case they are in gnupg2-2.1.15/doc)
- 86,013
- 17
- 224
- 214