1

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}
\headding{dude!}
\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.

Please help!

  • 2
    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
  • 1
    @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
  • thanks guys, okay, but...so if I am working with latex, then I cannot add in a pdf document into it?? – Melba1993 Jul 24 '15 at 6:31
  • 1
    As you can add pdf images to your document you can also add full page size pdf images. But you can't do it currently with pdfpages. There is some support for dvipdfm(x) in the package but it isn't working correctly. You could ask the author if he intent to do something about it. – Ulrike Fischer Jul 24 '15 at 8:23
  • 1
    @Melba1993 You got the difference between compiling with "LaTeX" in opposite to compiling with "pdfLaTeX"? If you don't know, this were an important thing to learn. – Keks Dose Jul 24 '15 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.