title: Reportlab: How to add a footer to a pdf file
body: <p>I already asked this <a href="https://stackoverflow.com/questions/28115052/merging-two-pdfs">question</a> but there's no answer yet, so I want to take a look at Reportlab which seems to be actively developed and better than fpdf python library.</p>
  
  <p>I've already seen this <a href="https://stackoverflow.com/questions/8827871/a-multilineparagraph-footer-and-header-in-reportlab">question</a> The answer given seems more or less the same as this <a href="http://eric.sau.pe/tag/reportlab-header-footer/" rel="noreferrer">blog post</a>. Anyhow, the script shown is full of errors, but I don't want to vote it down, the OP accepted it, seemed to solve his problem, who am I to argue, I'd rather ask another question.</p>
  
  <p>First of all you need to import </p>
  
  <pre><code>from reportlab.pdfgen.canvas import Canvas
  </code></pre>
  
  <p>and it's not <code>canvas</code> it's <code>Canvas</code> and then you can't just do</p>
  
  <p><code>Canvas.restoreState()</code> or  <code>Canvas.saveState()</code></p>
  
  <p>Maybe there are more errors, I'd rather use another example. I spent the entire night yesterday trying to make that snippet work and couldn't.</p>
  
  <p>Is there another method to create footer? A specific method I want to ask about is <a href="https://www.youtube.com/watch?v=Ei0fL6j8DtI" rel="noreferrer">this</a>, the guy do a for loop, on <code>row[0]</code> he writes something, <code>row[1]</code> something</p>
  
  <p>I counted on a LibreOffice document, which is A4, using <code>Liberation Serif</code> 12, there are 49 rows. Assuming that on average there are 45 rows, depending on the font size, and the footer font size is 8, can't one just insert the footer like this <code>x=row[45]</code> and then increment x based on the page number? wouldn't that be a far easier solution?</p>
  
  <p>If I can detect that the end of file, or the last line on which text is inserted, then I can do it, I think.</p>
  
  <p>If you refer to my other question, you would notice that I convert powerpoint, excel and word to pdf and then insert a footer.</p>
  
  <p>If there is a library that works on linux and windows covert powerpoint and excel to word, then add the footer then convert to pdf, it would be great, since I think it's easier to work with documents then PDFs</p>