Back to the #itlab main page

PDF files from LaTeX

You can write your document as you normally would and in addition you can use the hyperref package to set some PDF (and HTML) specific stuff.

For instance in the preamble:

\usepackage[dvips,colorlinks=false,pdfborder={0 0 0}]{hyperref}
\hypersetup{
pdftitle=Some Title,
pdfauthor=My Name
}

There are lots of other things you can do, see your local documentation, which can be found in /usr/share/texmf/source/latex/hyperref/doc/manual.pdf or a similar location.

An example Makefile for pure PDF output and for converting EPS files to PDF: Makefile4.txt (save as Makefile) It also handles font embedding properly.

Note: The above Makefile uses texi2pdf, which is broken in recent Ubuntu and Debian versions: The literal tilde problem in Ubuntu #526974 , Debian #487974 and Debian #534458. One way to work around this is to download texi2dvi (texinfo 4.13) and save it as $HOME/bin/texi2dvi (texi2pdf calls texi2dvi --pdf). Adjust your PATH so it overrides the system texi2dvi.

An old example Makefile for creating PS and PDF output: http://www.iki.fi/pq/htyot/textemplate/Makefile Please, read the notes in the file before use.

There is a test suite for PS and PDF document creating: http://www.ctan.org/tex-archive/macros/latex/contrib/IEEEtran/testflow/ That documentation was used in writing these instructions.

Fonts

Embedding fonts is important to get correct document appearance. Also font type is very important. If you have xpdf installed, you can use pdffonts filename.pdf to get a list of fonts. All fonts should have type 1 or 1C (i.e. vector fonts), something else might be bad. You can also see what fonts are embedded into the document.

You can see roughly the same information in Acrobat Reader via File → Document Properties → Fonts. Every font should be “Embedded” or “Embedded Subset”. Font type “Type 1” is a vector font.

If a font is not embedded in a PDF file, a printer will have to use a font that happens to be installed. There is a good chance that it is not the font you used, and that will break your document appearance. Further more, each printer may use a different font.

Contrary to vector fonts, bitmap fonts do not scale properly. Therefore only vector fonts should be used.

Embedding fonts in Adobe Distiller

To embed all the fonts in Adobe Distiller, sometimes an external set of fonts is needed. You can download set from fonts.zip. Note that the font set ONLY for internal use. Do not share it outside of university.

Extract .zip-file to a folder. To embed fonts, go in Adobe Distiller to Settings → Font Locations, and add to list the folder, to which you extracted fonts. Then go to Settings → Edit Adobe PDF settings. In fonts, check that Embed all the fonts is marked, and list of Never embed is empty. Now you should be able to embed all the fonts in Distiller. To verify that you have all the fonts embedded, check it again according to the following procedure if you use Adobe Acrobat Reader 6.0, for example.

  1. Under the Document menu, be sure that “Use local fonts” is not checked.
  2. Under the File menu, select “Document Properties”.
  3. In the Document Properties dialogue, select “Fonts”.
  4. Check whether all fonts are embedded properly.

Hints

Combining multiple pdf files:

Say a spell to ghostscript:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf

The downside is that Ghostscript will recompress all pixel images, so your pictures might get mushy. It also removes metadata, which you might want to preserve.

Some people say pdftk is a good tool. For more info about PDF concatenation: http://ansuz.sooke.bc.ca/software/pdf-append.php

Embedding pdf files:

An alternative when working with pdf(la)tex is to use pdfpages package:

\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{etukansi.pdf}
blah blah
\end{document}

This is good when you get the cover pages from somewhere else (Tite office) and need to add them into the document.