Quite a specific question, I was looking to add PDF files to an appendix before. Found my solution in this thread: Appendix - Adding PDF, But it also created my next problem. This macro does create new sections in the appendix, but when adding a label to an appendix set-up with this macro it points to the last "normal" appendix section.
Here is an example in the code from the other thread:
\documentclass[a4paper]{article}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{xparse}
\makeatletter
\NewDocumentCommand\headerspdf{ O {pages=-} m }{% [options for includepdf]{filename.pdf}
\includepdf[%
#1,
pagecommand={\thispagestyle{fancy}},
scale=.7,
]{#2}}
\NewDocumentCommand\secpdf{somO{1}m}{% [short title]{section title}[page specification]{filename.pdf} --- possibly starred
\clearpage
\thispagestyle{fancy}%
\includepdf[%
pages=#4,
pagecommand={%
\IfBooleanTF{#1}{%
\section*{#3}}{%
\IfNoValueTF{#2}{%
\section{#3}}{%
\section[#2]{#3}}}},
scale=.65,
]%
{#5}}
\makeatother
\pagestyle{fancy}
\begin{document}
As you can see, Appendix \ref{1}, \ref{2} and \ref{3} all say they're appendix A
\newpage
\appendix
\secpdf*{PDF on Starred Section Page}[3]{mypdf.pdf}
\kant[2]
\section{Include PDF after Section Page}
\headerspdf[pages=1-2]{mypdf.pdf}
\label{1}
\secpdf{PDF on Section Page}[4]{mypdf.pdf}
\label{2}
\secpdf[Short Title]{PDF on Section Page with Short Title}{mypdf.pdf}
\label{3}
\headerspdf[pages=2-3]{mypdf.pdf}
\end{document}
Here is what the first page compiles into:
Thanks in advance!

