Free Book for learning Ubuntu /Linux

Florian Diesch diesch at spamfence.net
Sun May 25 21:01:54 UTC 2008


NoOp <glgxg at sbcglobal.net> wrote:


> Very nice document, but I found that the document contains no bookmarks
> so that you can easily move to a subject section. So, I cheated and
> opened Win2KPro in VirtualBox, opened the html files in Acrobat (the
> licenced PDF editor) and created a rutebook PDF with bookmarks. This
> makes it so much easier for finding and going to subject chapters.
>
> My question: does anyone know how to do the above (use the html files
> and create a pdf with bookmarks from the internal urls) using a OS linux
> program? 

htmldoc can create a PDF from the HTML files but the result doesn't
look that good.


Using LaTeX you can get a better result. With Ubuntu 8.04 you need the
packages texlive-latex-base and texlive-latex-recommended for this.

Create a file rutebook.tex like that:

--8<---------------cut here---------------start------------->8---

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pdfpages}
\usepackage{hyperref}

\begin{document}

\pdfbookmark{Title}{1}
\includepdf[pages={1-4}]{rute.pdf}

\pdfbookmark{Chapter Summary}{5}
\includepdf[pages={5-6}]{rute.pdf}

\pdfbookmark{Contents}{7}
\includepdf[pages={7-26}]{rute.pdf}

\pdfbookmark{Preface}{27}
\includepdf[pages={27-28}]{rute.pdf}

\pdfbookmark{Acknowledgments}{29}
\includepdf[pages={29-30}]{rute.pdf}

\pdfbookmark{Introduction}{31}
\pdfbookmark[1]{What This Book Covers}{31a}
\includepdf[pages={31-34}]{rute.pdf}

\end{document}

--8<---------------cut here---------------end--------------->8---


A \pdfbookmark line creates a bookmark. It has two arguments encloed
in {} and one optional enclosed in [] (see the "What This Book Covers" line)

The first {} argument is the bookmark's title. The second one doesn't
matter but has to be unique for across the file, so I'm using page
numbers here. The optional [] argument is the bookmark's level. It
defaults to 0 (top level).

A \includepdf line includes pages from a PDF file. The [pages={X-Y}]
argument tells which pages to include (physical pages numbers),
{rute.pdf} gives the file to get the pages from.


When you rae finished, save the file and run 
  pdflatex rutebook.tex
three times in a row. It creates rutebook.pdf




   Florian
-- 
<http://www.florian-diesch.de/>
-----------------------------------------------------------------------
**  Hi! I'm a signature virus! Copy me into your signature, please!  **
-----------------------------------------------------------------------




More information about the ubuntu-users mailing list