title: Selectpdf - cannot remove top margin on page
body: <p>I am using <code>SelectPdf</code>, and when configuring my converter to convert the string to a pdf, my pdf keeps ending up generating some margin on the top of the page.</p>
  
  <p><strong>My converter:</strong></p>
  
  <pre><code>private Stream ConvertToPdf(string data)
  {
      HtmlToPdf converter = new HtmlToPdf();
  
      converter.Options.PdfPageSize = PdfPageSize.A4;
      converter.Options.AutoFitWidth = HtmlToPdfPageFitMode.NoAdjustment;
      converter.Options.DisplayFooter = true;
      converter.Options.DisplayHeader = true;
      converter.Options.MarginTop = 0;
      converter.Options.MarginBottom = 0;
      converter.Options.DisplayHeader = false;
      converter.Options.DisplayFooter = false;
      converter.Options.CssMediaType = HtmlToPdfCssMediaType.Screen;
      converter.Options.EmbedFonts = true;
      PdfDocument doc = converter.ConvertHtmlString(data);
  
      // create memory stream to save PDF
      MemoryStream pdfStream = new MemoryStream();
  
      // save pdf document into a MemoryStream
      doc.Save(pdfStream);
      pdfStream.Seek(0, SeekOrigin.Begin);
  
      return pdfStream;
  }
  </code></pre>
  
  <p>In my template, I have no apparent margin in the top of the page, so I am, so far, unable to figure out where it is coming from. </p>
  
  <p><strong>My template:</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;style&gt;
          html, body {
              font-family: Arial, Helvetica, sans-serif;
              margin:0;
              padding:0;
          }
  
          .red-color {
              color: red;
              margin-left: 10px;
          }
  
          p.red-color {
              margin-top: 0;
              font-weight:800;
          }
  
          p.red-color:first-of-type {
              margin-bottom: 0;
          }
  
          h1.red-color {
              margin-bottom: 10px;
              margin-top:0;
          }
          h2.red-color {
              margin-bottom: 20px;
          }
          #wrapper {
              position: relative;
              width:750px;
              height:1050px;
          }
  
          .image-wrapper {
              width: 96%;
              height: 350px;
              margin-left: 2%;
              position: relative;
              background-position: center;
              background-repeat: no-repeat;
              background-size: cover;
          }
  
          #info-banner {
              position: absolute;
              bottom: 0;
              background-color: red;
              width: 96%;
              margin-left: 2%;
              height: 125px;
          }
  
          #info-banner #banner-left {
              float:left;
              width:40%;
          }
          #info-banner #banner-right {
              float:left;
              width:60%;
          }
  
          #info-banner #banner-left a {
              display: block;
              text-align: center;
              margin-top: 20px;
              color: white;
              text-decoration: none;
          }
  
          #info-banner #banner-left a img{
              width:50px;
          }
          #info-banner #banner-right p:first-of-type {
              margin-top:20px;    
          }
          #info-banner #banner-right p {
              margin: 0;
              color: white;
              padding-bottom: 5px;
              font-size: 14px;
          }
  
          .amount {
              text-align:left;
              padding-left:5px;
          }
          .name {
  
          }
          .price {
  
          }
          table th {
              text-align: left;
          }
  
          td {
              padding: 10px 0;
          }
  
          table {
              width: 96%;
              margin-left:2%;
              border-collapse: collapse;
          }
  
          .top-border {
              border-top: 2px solid black;
          }
  
          .heavy-font {
              font-weight: 800;
          }
          .less-spacing td{
              padding:5px 0;
          }
      &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="wrapper" style="page-break-after: always"&gt;
      &lt;h1 class="red-color"&gt;Name&lt;/h1&gt;
  
      &lt;div class="image-wrapper" style="background-image: url('@@EventImage@@');"&gt;&lt;/div&gt;
  
      &lt;h2 class="red-color"&gt;@@Title@@&lt;/h2&gt;
      &lt;p class="red-color"&gt;your ticket:&lt;/p&gt;
      &lt;p class="red-color"&gt;Print it.&lt;/p&gt;
  
      &lt;table&gt;
              &lt;tr&gt;
                  &lt;th&gt;Amount&lt;/th&gt;
                  &lt;th&gt;name&lt;/th&gt;
                  &lt;th&gt;Price&lt;/th&gt;
              &lt;/tr&gt;
              &lt;tr class="top-border"&gt;
                  &lt;td class="amount"&gt;@@Amount@@&lt;/td&gt;
                  &lt;td class="name"&gt;
                      @@Title@@&lt;br /&gt;
                      Adresse: @@Address@@ &lt;br /&gt;
                      Dato: @@Date@@&lt;br /&gt;
                      Tidspunkt: @@Time@@
                  &lt;/td&gt;
                  &lt;td class="price"&gt;@@Price@@ USD&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr class="top-border "&gt;
                  &lt;td class="amount"&gt;&lt;/td&gt;
                  &lt;td class="name"&gt;In Total&lt;/td&gt;
                  &lt;td class="price"&gt;@@ProductTotalPrice@@ USD&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr class="less-spacing"&gt;
                  &lt;td class="amount"&gt;&lt;/td&gt;
                  &lt;td class="name"&gt;Total ex. tax:&lt;/td&gt;
  
  
    &lt;td class="price"&gt;@@ProductTotalExTax@@ USD&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="less-spacing"&gt;
              &lt;td class="amount"&gt;&lt;/td&gt;
              &lt;td class="name"&gt;shipping: &lt;/td&gt;
              &lt;td class="price"&gt;@@ShippingPrice@@ USD&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="less-spacing"&gt;
              &lt;td class="amount"&gt;&lt;/td&gt;
              &lt;td class="name"&gt;Subtotal ex. tax&lt;/td&gt;
              &lt;td class="price"&gt;@@PriceNoTax@@ USD&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="less-spacing"&gt;
              &lt;td class="amount"&gt;&lt;/td&gt;
              &lt;td class="name"&gt;tax&lt;/td&gt;
              &lt;td class="price"&gt;@@Tax@@ USD&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="top-border"&gt;
              &lt;td class="amount"&gt;&lt;/td&gt;
              &lt;td class="heavy-font name"&gt;Total:&lt;/td&gt;
              &lt;td class="heavy-font price"&gt;@@FinalPrice@@ USD&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;div id="info-banner"&gt;
          &lt;div id="banner-left"&gt;
              &lt;a href="#"&gt;&lt;img src="facebook-icon.png" /&gt;&lt;br /&gt;Find us on facebook&lt;/a&gt;
          &lt;/div&gt;
          &lt;div id="banner-right"&gt;
              &lt;p&gt;Name&lt;/p&gt;
              &lt;p&gt;Address&lt;/p&gt;
              &lt;p&gt;Second Address&lt;/p&gt;
              &lt;p&gt;Phone: 0000000000 Email: info@test.com&lt;/p&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I generate this, I have no issues making it a pdf, but on each page it appears with a top margin, or some sort of a header. </p>