title: ABCpdf - Add margin-top to each page and keep the footer in a block
body: <p>I have started to use abcpdf for a c# application. First I get the pdf and then I get a screenshot to convert it in pdf(I do it because I load some charts). I have 2 problems:</p>
  
  <p>1- I can add margin to the top of my html but the problem is when I the size of my html is longer than a page so.. I have more than one page and I don't know how can I add <code>x</code> margin per page in the top and in the bottom.</p>
  
  <p>I found a guy asking something similar but he didn't get an answer. <a href="https://stackoverflow.com/questions/29306527/abcpdf-render-an-html-within-a-template-how-to-add-margin">ABCpdf, render an HTML within a &quot;template&quot;: How to add margin?</a></p>
  
  <p>2- Also I have a problem with the footer because I have to print terms and conditions always in the bottom and depends on the size of my html it's breaking the block of wording and I don't want that. I have to print it always in the bottom and in only one block not in two.</p>
  
  <p>Below is the code I have implemented.</p>
  
  <pre><code>public FileStreamResult HtmlToPdf(Uri pdfUrl, bool landscape, int screenResolutionWidth, bool enableCache)
          {
              var pdfStream = new MemoryStream();
              using (var theDoc = new Doc())
              {
                  if (landscape)
                  {
                      // apply a rotation transform
                      double w = theDoc.MediaBox.Width;
                      double h = theDoc.MediaBox.Height;
                      double l = theDoc.MediaBox.Left;
                      double b = theDoc.MediaBox.Bottom;
                      theDoc.Transform.Rotate(90, l, b);
                      theDoc.Transform.Translate(w, 0);
                      // rotate our rectangle
                      theDoc.Rect.Width = h;
                      theDoc.Rect.Height = w;
                  }
                  theDoc.HtmlOptions.Engine = EngineType.Gecko;
                  theDoc.HtmlOptions.PageCacheClear();
                  theDoc.HtmlOptions.PageCachePurge();
                  theDoc.HtmlOptions.UseScript = true;
                  theDoc.HtmlOptions.Timeout = 90000;
                  theDoc.HtmlOptions.AddLinks = false;
  
                  var url = Uri.UnescapeDataString(pdfUrl.ToString());
  
                  var pageRef = theDoc.AddImageUrl(url, true, screenResolutionWidth, true);
                  while (theDoc.Chainable(pageRef))
                  {
                      theDoc.Page = theDoc.AddPage();
                      pageRef = theDoc.AddImageToChain(pageRef);
                  }
                  for (var i = 1; i &lt;= theDoc.PageCount; i++)
                  {
                      theDoc.PageNumber = i;
                      theDoc.Flatten();
                  }
  
                  theDoc.Save(pdfStream);
                  theDoc.Clear();
              }
              var byteInfo = pdfStream.ToArray();
              pdfStream.Write(byteInfo, 0, byteInfo.Length);
              pdfStream.Position = 0;
              return new FileStreamResult(pdfStream, "application/pdf");
  </code></pre>
  
  <p>Thanks for your time. </p>