Answers.Body: <p>I came across the same issue yesterday. After a bit of reading and trial and error I found the most elegant way for now is to remove the white space between these elements. </p>
  
  <p><code>&lt;html&gt;&lt;head&gt;
  &lt;/head&gt;&lt;body&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></p>
  
  <p>Personally I achieved this by adding comments <code>&lt;!--  --&gt;</code> between to remove the white space</p>
  
  <p><code>&lt;html&gt;&lt;!--
  --&gt;&lt;head&gt;
  &lt;/head&gt;&lt;!--
  --&gt;&lt;body&gt;
  &lt;/body&gt;&lt;!--
  --&gt;&lt;/html&gt;
  </code></p>
  
  <p>I piked this up from this thread initially. 
  <a href="https://github.com/barryvdh/laravel-dompdf/issues/389" rel="nofollow noreferrer">https://github.com/barryvdh/laravel-dompdf/issues/389</a></p>
  
  <p>I think that the proper solution might be to enable the html5 parser, but I think this might be a config setting within the DomPDF? Would this fall ino the Craft Commerce files?</p>
  
  <p><code>
  "enable_html5_parser" =&gt; true,
  </code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T09:13:13.090Z
Answers.Text: I set tried both of those and had no success. I set "enable_html5_parser" within dompdf inside Craft Commerce and even created a template with zero whitespace!
Answers.UserDisplayName: Clive Portman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-22T11:31:34.390Z
Answers.Text: In the end, I've gone with your solution but without comments. It seems it's just having no whitespace before <head> and after </head> that works for me, so that was easy enough.
  
  Separately, I then found an issue with <thead> and <tbody> elements no longer being supoported. So I've taken them out as well.
Answers.UserDisplayName: Clive Portman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-20T09:06:33.613Z
Answers.LastActivityDate: 2018-01-20T09:12:30.580Z
Answers.LastEditDate: 2018-01-20T09:12:30.580Z
Answers.UserDisplayName: Terry Upton
Answers.Body: <p>This should be fixed as of Commerce 1.2.1354</p>
  
  <p><a href="https://craftcommerce.com/changelog#build1354" rel="nofollow noreferrer">https://craftcommerce.com/changelog#build1354</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-15T09:29:39.227Z
Answers.LastActivityDate: 2018-02-15T09:29:39.227Z
Answers.UserDisplayName: Luke Holder
Body: <p>Switching over to a new server and using PHP 7.0 (and 7.1) everything looked to be fine until I tried to view an order PDF within an email from Craft Commerce. Even using the email template provided by the plugin. The error is:</p>
  
  <pre><code>No block-level parent found. Not good.
  </code></pre>
  
  <p>I can't remember which DOM-PDF issue thread I came across it in, but the solution is to remove </p>
  
  <pre><code>&lt;head&gt;&lt;/head&gt; 
  </code></pre>
  
  <p>from the document. Does anyone know of a more elegant solution? I don't think it's my server.</p>
  
Tags: <plugin-craftcommerce><dompdf>
Title: PHP 7.0 and 7.1 PDF error with Craft Commerce orders
ThreadText: # PHP 7.0 and 7.1 PDF error with Craft Commerce orders
  
  (Asked by: username_0 on 2018-01-19)
  
  Switching over to a new server and using PHP 7.0 (and 7.1) everything looked to be fine until I tried to view an order PDF within an email from Craft Commerce. Even using the email template provided by the plugin. The error is:
  
  ```
  No block-level parent found. Not good.
  
  ```
  
  I can't remember which DOM-PDF issue thread I came across it in, but the solution is to remove
  
  ```
  <head></head> 
  
  ```
  
  from the document. Does anyone know of a more elegant solution? I don't think it's my server.
  
  **Tags:** plugin-craftcommerce, dompdf
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-01-20. Score: 2 | Accepted answer
  
  I came across the same issue yesterday. After a bit of reading and trial and error I found the most elegant way for now is to remove the white space between these elements.
  
  `<html><head>
  </head><body>
  </body></html>`
  
  Personally I achieved this by adding comments `<!-- -->` between to remove the white space
  
  `<html><!--
  --><head>
  </head><!--
  --><body>
  </body><!--
  --></html>`
  
  I piked this up from this thread initially.
  <https://github.com/barryvdh/laravel-dompdf/issues/389>
  
  I think that the proper solution might be to enable the html5 parser, but I think this might be a config setting within the DomPDF? Would this fall ino the Craft Commerce files?
  
  `"enable_html5_parser" => true,`
  
  > **Comments:**
  > **username_0**: I set tried both of those and had no success. I set "enable_html5_parser" within dompdf inside Craft Commerce and even created a template with zero whitespace!  
  > **username_0**: In the end, I've gone with your solution but without comments. It seems it's just having no whitespace before <head> and after </head> that works for me, so that was easy enough.  Separately, I then found an issue with <thead> and <tbody> elements no longer being supoported. So I've taken them out as well.  
  
  ---
  
  ### Answer by username_2 on 2018-02-15. Score: 2
  
  This should be fixed as of Commerce 1.2.1354
  
  <https://craftcommerce.com/changelog#build1354>
  
  
  ---
  
  