[Tex/LaTex] Adobe reader tells me error when opening the PDF

errors

I'm transfering Master thesis from Word to LaTex (and I'm not expert in this). I have to use template, which we have from school. I pasted it here on pastebin.com.

What was my problem: When I create PDF with this template, it works fine somewhere. But Adobe reader had some problems.

I'm using TexWorks (I installed it with MikTex) and pdfLatex to create pdf. I see everything fine in TexWorks viewer. Also Google Chrome displayes everything OK. But when I open it in Adobe Reader X, title page is blank and when I scroll to first real page (with chapter 1), it tells me, that there is problem on page (content, list of tables and list of images are fine).

What I have found: When I comment stuff around insertOutline, it's better (it displayes more text), but there is still no title page and I still get the message from Adobe.

Doesn't anybody of you have any idea what could be the problem?

EDIT:

According to comments, I have found, that problem was in outline and hyperlinks (I have updated pastebin code). First blank page was blank because of this line: \usepackage[table]{xcolor}.

But I dont't understant code about outline and hyperlinks. Could someone please tell me, what it means, so I can try to fix it by other way than in my template?

%% external hyperlinks
\def\@@ignorewhs#1{%
  \bgroup \catcode`\ =9 \catcode`\~=12 \catcode`\_=12 \catcode`\@=12
  #1}

\def\mail{\@@ignorewhs{\s@mail}}
\def\s@mail#1{\@pdfuri{\lowercase{\tt\char60#1\char62}}{mailto:#1}\egroup}

\def\url{\@@ignorewhs{\s@url}}
\def\s@url#1{\@pdfuri{\lowercase{\tt#1}}{#1}\egroup}

\def\link#1{\gdef\@linktxt{#1}\@@ignorewhs{\s@link}}
\def\s@link#1{\@pdfuri{\@linktxt}{#1}\egroup}

%% internal hyperlinks
\def\emphref#1{\gdef\@emphreftxt{#1}\@@ignorewhs{\s@emphref}}
\def\s@emphref#1{\@pdflink{\@emphreftxt}{lnk#1}\egroup}

\def\hyplabel#1{\@pdfdest{lnk#1}}

\def\emphref#1{\gdef\@emphreftxt{#1}\@@ignorewhs{\s@emphref}}
\def\s@emphref#1{\@pdflink{\@emphreftxt}{lnk#1}\egroup}

%% initialize outlines
\def\insertoutline#1#2{%
  \@inspdf{\special{pdf:outline #1 
      << /Title (#2) /Dest [ @thispage /FitH @ypos ] >>}}}

\def\nextoutline#1{\gdef\@@nextoutlinelabel{#1}}
\let\@oldsect=\@sect
\def\@sect#1#2#3#4#5#6[#7]#8{%
  \ifx\@@nextoutlinelabel\undefined\insertoutline{#2}{#7}%
  \else\insertoutline{#2}{\@@nextoutlinelabel}%
  \let\@@nextoutlinelabel=\undefined\fi%
  \@oldsect{#1}{#2}{#3}{#4}{#5}{#6}[#7]{#8}}

%% insert outlines manually
\def\outline{\insertoutline{1}}
\def\suboutline{\insertoutline{2}}
\def\subsuboutline{\insertoutline{3}}
\def\subsubsuboutline{\insertoutline{4}}

I have also modified my latex code, which uses this style:

%%% Deklarace hlavičky dokumentu, použijte písmo velikosti 12 bodů.
\documentclass[12pt]{article}

\usepackage[tables,figures]{updiplom}
\usepackage[utf8]{inputenc}

%%% Moje package navic
\usepackage{hyperref}


\title{Název diplomové práce}
\author{Nějaký Pán}
\year{2012}
\date{13. březen 2012}

\docinfo{Nejakjy Pan}{Nazev diplomove prace}

%%% Vytvoření anotace. Pouze jeden odstavec!
\annotation{
Anotace 
}

%%% Nepovinný text poděkování. Pouze jeden odstavec!
\thanks{%
Poděkování vedoucímu práce, rodině apod. (nepovinné)}

\begin{document}

%%% Vytvoření úvodních stránek, obsahu a seznamu tabulek a obrázků.
\maketitle
\newpage


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1. chapter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newpage
\section{Programátorská dokumentace}

Již na začátku diplomové práce bylo přesně definováno, jaký druh aplikace má vzniknout. Mělo se jednat o webovou aplikaci a dle toho také byl zvolen přístup k vývoji, jak už z pohledu použitých programovacích jazyků, tak z~pohledu návrhu architektury aplikace. Při vývoji byly respektovány zažité normy a idiomy.


\end{document}

It's no more giving me error (I have commented that stuff about hyperlinks and outlines), but Adobe reader still doesn't display title page.

If you want to try it, please create some small image named uplogo and put it to latex code folder.

Best Answer

I understand your pain, but the template you are using has a lot of \special commands dealing with PDF. A special command in TeX is one that writes straight into the output file (i.e., they are PDF commands rather than TeX commands). The problem lies here, and is difficult to solve without knowing the version of the pdf used when the template was written.

It is highly unlikely it will get fixed without you having to modify or patch the template. A better approach is not to use any commands that require specials. You may be able to get the same effect with just adding the package hyperref. I would work slowly from a working minimal and add items until an error occurs.