title: How to correctly set a fancy header and footer in a included pdf, which contains many pages?
body: <p>Last time I tried to add fancy header and footer in my document, but I'm not happy of it's result. How to correctly set a fancy header and footer in a included pdf, which contains many pages?</p>
  <p>My goal, which I want achieve, is: If the number of page is odd, I want to have a header and the number of page on the left side of page, otherwise I want to have it on the right.</p>
  <p>Here is my base code:</p>
  <pre><code>\documentclass[oneside, a4paper, 12pt]{article}
  
  \usepackage[utf8]{inputenc}
  \usepackage{polski}
  \usepackage{pdfpages}
  \usepackage{changepage}
  \usepackage{fancyhdr}
  
  \usepackage[right=2.7cm,left=3.5cm, top=2.7cm, bottom=2.5cm,includehead]{geometry}
  
  \strictpagecheck
  
  \begin{document}
      %\setcounter{page}{18}
  \includepdf[pages=-,pagecommand={
      \ifoddpage 
      \pagestyle{fancy} \fancyhf{}
      \fancyhead[L]{Test of left header}
      \fancyfoot[L]{\thepage} 
      \else
      \fancyhead[R]{Test of right footer}
      \fancyfoot[R]{\thepage} 
      \fi}]{scenariusz_wersja_do_edycji.pdf}
  \end{document}
  </code></pre>
  <p>I would be glad if somebody knows the solution, because i need it necessarily for the BA thesis!</p>