# Adding pdf pages into latex

I am trying to insert a PDF file as an appendix in my latex file. But when I add the \usepackage{pdfpages}, I have some compiler errors as

! LaTeX Error: Missing \begin{document}.


Do you know how can I solve this problem?

• \usepackage{pdfpages} \includepdf[pages=-]{myfile.pdf}
– Elli
Mar 14 '16 at 16:21

You have to follow the LaTeX structure with the following order:

\documentclass{article}

\usepackage{pdfpages}

\begin{document}

\includepdf[pages=-]{myfile.pdf}

\end{document}

• consider use fitpaper=true in your \includepdf[fitpaper=true, pages=-]{test.pdf} for a fully fit to the page Sep 7 '20 at 20:37