[Tex/LaTex] Failed to load PDF – TexWorks

pdftexworks

I am trying to export my tex file to a PDF but it is not working. When I open TeXworks (under pdfLaTeX) and hit the green run button, it opens a window and displays my pdf correctly. However, when I click File > Save As and save it as a pdf and then try and open it in Chrome, it says "Failed to load PDF document".

Does anyone know what might be causing this?

Here is my code after removing all personal information:

\documentclass{article}

\usepackage{titlesec}
\usepackage{titling}
\usepackage[a4paper, top=0.8in, bottom=0.8in, left=1in, right=1in]{geometry}
\usepackage{hyperref}
\usepackage[none]{hyphenat}

\setlength\parindent{0pt}

\hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=magenta,      
    urlcolor=blue,
}

\urlstyle{same}

\titleformat{\section}
{\fontsize{15}{25}\bfseries}
{}
{0em}
{}[\titlerule]

\titlespacing{\section}
{0em}{2.5em}{1.8em}

\titleformat{\subsection}
{\fontsize{10}{0}\bfseries}
{}
{0em}
{}

\titlespacing{\subsection}
{0em}{2em}{0.85em}

\renewcommand{\maketitle}{
\begin{center}
{\huge\bfseries
\theauthor}

\vspace{.4em}

email@gmail.com --- number
\end{center}
}

\begin{document}
\title{Resume}
\author{A B}

\maketitle

\section{Personal profile}

x

\section{Education}

\subsection{University of Example, BSc (Hons) in Computer Science\hfill A - B }

X\\[0.08in] Y:

\begin{itemize}
\item 1
\item 2
\item 3
\item 4
\item 5
\item 6
\item 7
\item 8
\end{itemize}


\subsection{School\hfill A - B}

\begin{itemize}
\item A --- B
\item A --- B
\end{itemize}

\section{Technical skills}

\subsection{A}

B

\subsection{A}

B

\subsection{A}

B

\subsection{A}

B

\subsection{A}

B

\subsection{A}

B

\subsection{A}

B

\section{A}

\subsection{X (\href{https://www.google.co.uk}{A}, \href{https://www.google.co.uk}{B}) --- x}

x

\subsection{X (\href{https://www.google.co.uk}{A}, \href{https://www.google.co.uk}{B}) --- x}

x


\end{document}

Thanks.

Best Answer

TeXworks supplied with MiKTeX has several options to save as, and it is not apparent to a user that when you "save as" PDF you are most likely saving the TeX file with an incorrect PDF extension !

it is easy to see the editor now is editing filename.pdf !!!

One easy way to get the PDF into an external PDF viewer is to ask for a print ! That is the natural way in windows to call a "print to PDF"

HOWEVER

On Windows MiKTeX it tells me It can't and do I want to open the PDF in a viewer !!

I can then print or save the pdf there at will