11

If man -t ls | ps2pdf - > ls.pdf is useful for outputting the ls man page via ps2pdf to pdf, what about info pages?

I've tried something like the following but with no success:

info -o info | ps2pdf - > info.pdf

All this does is output a blank pdf file called info.pdf and output the body into a text file.

5
  • That's good enough for me. It appears that info2man is in the Debian repositories so if you want to formulate that as an answer with example, I'll mark as correct. I can work it out without an example, but it may help anyone who stumbles upon this question. Jan 29, 2013 at 10:56
  • It's also in Fedora 17 and Ubuntu according to pkgs.org Jan 29, 2013 at 10:57
  • 1
    info -o - info | /usr/bin/groff -mandoc -Tpdf > info.pdf except it does not handle any formatting at all... not sure if there is a way to preserve that directly with the info command Jan 29, 2013 at 12:14
  • Thanks but it's the formatting I was after. I might stick with the text files for info then as, while they are not pdf, they are at least laid out correctly. Jan 29, 2013 at 12:18
  • According to gnu.org/software/texinfo/manual/info-stnd/… you should go looking for the tex sources of those info pages...? Jan 29, 2013 at 12:22

4 Answers 4

13

Ah, info brings along the texi2ps and texi2pdf programs.

So if you find the info source (info.texi) you can generate beautiful (or bloated, depending on your point of view) PDF using:

texi2pdf info.texi
2
  • 1
    Thanks. Don't get me wrong, I love the terminal. I just don't enjoy reading man/info pages there. Jan 29, 2013 at 13:29
  • Ok, since I didn't specifically request an example, I'm going to give you the points. Jan 30, 2013 at 8:18
4

Info is a specialized format with few formatting capabilities, it's basically man with hyperlinks. Most info files are generated from a Texinfo source with the makeinfo command. Texinfo is designed to accommodate a wide range of outputs, both hypertext and printed, with basic or pretty formatting. Supported output formats include info, HTML, DVI, PostScript and PDF.

The PDF may already be present in the same package as the info file or in a separate package (depending on how much your distributing).

If it isn't, install a Texinfo setup and get the source of the package. You can then process the Texinfo source with texi2pdf, and you'll get a manual in PDF format with nicer formatting.

1
  • Thanks but if it isn't a 1 or 2-step process the advantage is lost. I was just quite impressed that a single expression could turn a man page into an attractive formatted pdf document. Jan 30, 2013 at 8:03
0

I'd go with this freecode.com/projects/info2man as I don't know if you can output info directly. It's in the Debian and Ubuntu repositories, at least. Simply give your class file (.ci) extension as the argument to info2man.

2
  • AUR also has it.
    – schaiba
    Jan 29, 2013 at 10:59
  • Could you provide an example. I've tried info2man /path/to/info-page (as per the info2man manual page) but do I need other arguments? Where does this output to? Jan 29, 2013 at 11:21
0

I have found a solution that may not need the info source file to convert the info pages to pdf. However, the generated pdf format may not be beautiful as you think, but it much like the info pages.
According to the info man pages, here is a -o, --output=file option to convert the info pages to text files. So then you can convert the text file to pdf with enscript and ps2pdf.

Example: info --subnodes -o - info | enscript -o - | ps2pdf - info.pdf
Note: --subnodes: recursively output menu items.
Then it will generate the info.pdf in your working directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.