# Latex report \usepackage{pdfpages} does not work

I am trying insert a PDF file as an appendix to a report. I am making it using Latex.

I came across the command \usepackage{pdfpages} to do this, but it does not work.

Here is how the latex file looks like;

\documentclass[a4paper]{jsarticle}
%\documentclass[a4paper]{jarticle}
%\documentclass{jsarticle}
\usepackage[dvipdfmx]{graphicx}
\usepackage[dvipdfmx]{color}
\usepackage{pdfpages}

\usepackage{lab}

\title{I wanna put a pdf file dude}
\author{how do I do it}
\date{14/07/2015}

\oddsidemargin=-0.5cm %-1.3cm
\textheight=25 cm
\textwidth=17cm

\begin{document}
\twocolumn
\maketitle

\tableofcontents

\newpage
\section
BLAH BLAH
\end{document}


So, without \usepackage{pdfpages}, it compiles just fine. But when it is inserted to where it is shown above, it spits out a bizarre error.

line 65 ! LaTeX Error: Missing \begin{document}.


But that's way down the document and besides, it is where the body paragraph is not where a \begin{document} command is supposed to be. I mean, I already have that on the top! And it has nothing to do with the package I want to import.

What is going on with this? I have no idea what it's complaining about, any ideas at all? seriously if I remove \usepackage{pdfpages} it compiles without error.

• pdfpages requires you to compile with pdflatex. Given that you are specifying dvipdfmx for graphicx and color - which is not necessary and dis-recommended, by the way - you are probably trying to compile with latex. – cfr Jul 24 '15 at 2:00
• @cfr Note that if you use dvipdfmx you do need a driver option as this can't be auto-detected as different from dvips. – Joseph Wright Jul 24 '15 at 4:37