title: HtmlRenderer.PdfSharp: Some Pages Blank In Acrobat Reader Only When Images Present
body: <p>I'm using HtmlRenderer (1.5.0.6) and PdfSharp (1.32.3057) to generate PDFs from HTML that is generated by passing a hunk of data into a Razor template. The data gets rendered into a table of some header values arranged in four columns of label and value pairs, and the body which is a series of divs for section headers and tables for each row of data in each section, spanning six columns of data. The results can extend onto second or third (or more) pages.</p>
  
  <p>Some of the rows of results contain images. If there are images present for any individual result, they are placed into a table row that spans the six columns in a single cell.</p>
  
  <p>Everything works wonderfully . . . until the PDF is viewed in Adobe Acrobat Reader. In Chrome, IE, or Edge, there are no problems. Complete results show, as expected, for as many pages as are needed. In Acrobat, only the first page shows content, with images, and all subsequent pages are blank. </p>
  
  <p>This only happens when there are images present. If there are no images with any of the results, the PDF displays in Acrobat as expected on all pages. The problem is not the presence of images, as they show on the first page in Acrobat.</p>
  
  <p><a href="https://i.stack.imgur.com/xs2bv.png" rel="nofollow noreferrer">Viewed in Chrome</a></p>
  
  <p><a href="https://i.stack.imgur.com/EDwQT.png" rel="nofollow noreferrer">Viewed in Acrobat Reader</a></p>
  
  <p>Here is the generated HTML that spans immediately above and below the page break:</p>
  
  <pre><code>&lt;div class="section header"&gt;Emergency Plan&lt;/div&gt;
  &lt;table class="answers"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th class="column-width-double"&gt;&lt;/th&gt;
              &lt;th class="column-width-half"&gt;&lt;/th&gt;
              &lt;th class="column-width-double"&gt;&lt;/th&gt;
              &lt;th class="column-width"&gt;&lt;/th&gt;
              &lt;th class="column-width"&gt;&lt;/th&gt;
              &lt;th class="column-width-half"&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Exits plans posted&lt;/td&gt;
              &lt;td colspan="4"&gt;&lt;/td&gt;
              &lt;td class="green"&gt;OK&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr class="issue-row"&gt;
              &lt;td&gt;Emergency contact info accurate&lt;/td&gt;
              &lt;td&gt;Issue&lt;/td&gt;
              &lt;td&gt;Emergency contact info accurate Issue&lt;/td&gt;
              &lt;td&gt;Unassigned&lt;/td&gt;
              &lt;td&gt;Misc.&lt;/td&gt;
              &lt;td&gt;Not Down&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td colspan="6"&gt;
                  &lt;img class="question-image" src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj9=" /&gt;
                  &lt;img class="question-image" src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCACiAOwDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFB=" /&gt;
                  &lt;br/&gt;
                  &lt;br/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Exit drill performed annually&lt;/td&gt;
              &lt;td colspan="4"&gt;&lt;/td&gt;
              &lt;td class="green"&gt;OK&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;div class="section header"&gt;Ladders&lt;/div&gt;
  &lt;table class="answers"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th class="column-width-double"&gt;&lt;/th&gt;
              &lt;th class="column-width-half"&gt;&lt;/th&gt;
              &lt;th class="column-width-double"&gt;&lt;/th&gt;
              &lt;th class="column-width"&gt;&lt;/th&gt;
              &lt;th class="column-width"&gt;&lt;/th&gt;
              &lt;th class="column-width-half"&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Safety feet, good condition, labels intact, used properly&lt;/td&gt;
              &lt;td colspan="4"&gt;&lt;/td&gt;
              &lt;td class="green"&gt;OK&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Monthly checks completed and documented&lt;/td&gt;
              &lt;td colspan="4"&gt;&lt;/td&gt;
              &lt;td class="green"&gt;OK&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>After exhausting all the options that I can find, I'm wondering if there is something in the HTML that HtmlRenderer or PdfSharp is unhappy with, that is causing Acrobat Reader to be even more unhappy? </p>
  
  <p>I can find no malformations in the generated HTML.</p>
  
  <p><strong>Edit</strong>: On a hunch that perhaps the BR tags were causing the problem, I replaced them with some padding-bottom in CSS. That also did not help.</p>
  
  <p><strong>Edit</strong>: Found a machine with Full Acrobat installed. Opened there, same problem. Click Edit, and the layout of each element is shown where it should be on the blank page, in the form of hollow borders. Export to Word, and everything appears as expected.</p>