Note that there are some explanatory texts on larger screens.

plurals
  1. POhtml2pdf page-break-after creating issue
    primarykey
    data
    text
    <p>I want to create new page using css property "page-break-after". I have followed all steps given on <a href="https://stackoverflow.com/questions/2117788/page-break-in-html2pdf">Page break in Html2Pdf</a> but getting following error.</p> <p><img src="https://i.stack.imgur.com/EIwSO.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/WBISp.png" alt="enter image description here"></p> <p>As you can see... 2nd page is starting from where first page ended.. I want 2nd page to start from top.</p> <pre><code>&lt;? /* Template Name: View Form */ include_once(ABSPATH."connection/localhost.php"); include_once(ABSPATH."include/cls_forms.php"); include_once(ABSPATH."include/cls_fields.php"); //Authenticate("U"); $oFields = new Fields; $oForm = new Forms; $Title = $oForm-&gt;getFormTitleByID($_GET['form_id']); $Content = $oForm-&gt;getFormContentByID($_GET['form_id']); $isPleading = $oForm-&gt;getFormTypeByID($_GET['form_id']); $FieldValues = $oForm-&gt;getUserFormFields($_SESSION['user_id'], $_GET['distinct_id']); foreach($FieldValues as $Name =&gt; $Value) { $Content = str_replace("«".$Name."»", "&lt;b&gt;".$Value."&lt;/b&gt;", $Content); } function filterMsWord($Content) { $Content = preg_replace("&lt;([A-Za-z0-9\/]*):([A-Za-z0-9-\"=: ]*)&gt;", "", $Content); $Content = str_replace("&lt;&gt;", "", $Content); return $Content; } if ($_GET['type'] == 'doc') $Content = str_replace("[---pagebreak---]", '&lt;br clear=all style="mso-special-character:line-break; page-break-before:always"&gt;', $Content); elseif ($_GET['type'] == 'pdf') $Content = str_replace("[---pagebreak---]", "&lt;div class='page-break-before'&gt;&lt;/div&gt;&lt;div class='page-break'&gt;&lt;/div&gt;", $Content); else $Content = str_replace("[---pagebreak---]", "&lt;div class='page-break'&gt;&lt;/div&gt;", $Content); if ($_GET['type'] == 'doc') { header("Content-type: application/vnd.ms-word"); header("Content-Disposition: attachment;Filename=".$Title.".doc"); } else if ($_GET['type'] == 'pdf') { require_once(ABSPATH.'pdf/html2pdf.class.php'); ob_start(); } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Preview Form&lt;/title&gt; &lt;style&gt; .pleading-paper-size { width: 6.35in !important; max-width: 8.5in !important; &lt;? if ($_GET['type'] != 'pdf' and $_GET['type'] != 'doc') {?&gt; background-image: url(../images/pleading.jpg); background-position: -0.5in 0; background-repeat: repeat-y; &lt;? } ?&gt; padding-left: 1in !important; padding-right: 1in !important; &lt;? if ($_GET['type'] != 'pdf') { ?&gt; line-height: 0.3242in !important; &lt;? } ?&gt; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } .normal { width: &lt;? if (!isset($_GET['type'])) { ?&gt;6.0&lt;? } else if ($_GET['type'] == 'doc') { ?&gt;6.5&lt;? } else { ?&gt;5.0&lt;? } ?&gt;in !important; text-align: left; } .page-break { page-break-after: always; page-break-inside: avoid; clear:both; } page-break-before { page-break-before: always; page-break-inside: avoid; clear:both; } p, td { margin: 0 !important; text-indent: 0 !important; padding: 0 !important; height: auto !important; } @media print { .pleading-paper-size { background-image: none; } } &lt;/style&gt; &lt;? if (isset($_GET['preview'])) { ?&gt; &lt;script language="javascript"&gt; function clearData(){ window.clipboardData.setData('text','') } function cldata(){ if(clipboardData){ clipboardData.clearData(); } } setInterval("cldata();", 1000); &lt;/script&gt; &lt;? $Body = ' ondragstart="return false;" onselectstart="return false;" oncontextmenu="return false;" onload="clearData();" onblur="clearData();" style="background-image: url('.ABSPATH.'images/PREVIEW.png);"'; } ?&gt; &lt;/head&gt; &lt;body &lt;?=$Body?&gt;&gt; &lt;? if (isset($_GET['preview'])) { ?&gt; &lt;table class="&lt;? if ($isPleading) { ?&gt;pleading-paper-size&lt;? } else { ?&gt;normal&lt;? } ?&gt;" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td&gt;&lt;a href="javascript:void()" onclick="javascript: window.history.back()"&gt; &lt;input name="continue" type="button" value="Go Back" style="font-size:24px" /&gt; &lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="../addons/?distinct_id=&lt;?=$_GET['distinct_id']?&gt;"&gt; &lt;input name="continue" type="button" value="Continue to Next Step" style="font-size:24px" /&gt; &lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;? } ?&gt; &lt;div class="&lt;? if ($isPleading) { ?&gt;pleading-paper-size&lt;? } else { ?&gt;normal&lt;? } ?&gt;"&gt; &lt;?=filterMsWord($Content)?&gt; &lt;/div&gt; &lt;? if (isset($_GET['preview'])) { ?&gt; &lt;table class="&lt;? if ($isPleading) { ?&gt;pleading-paper-size&lt;? } else { ?&gt;normal&lt;? } ?&gt;" border="0" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a href="javascript:void()" onclick="javascript: window.history.back()"&gt; &lt;input name="continue" type="button" value="Go Back" style="font-size:24px" /&gt; &lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;a href="../addons/?distinct_id=&lt;?=$_GET['distinct_id']?&gt;"&gt; &lt;input name="continue" type="button" value="Continue to Next Step" style="font-size:24px" /&gt; &lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;? } ?&gt; &lt;/body&gt; &lt;/html&gt; &lt;? if ($_GET['type'] == 'pdf') { try { $html = ob_get_contents(); ob_end_clean(); $html2pdf = new HTML2PDF('P', 'A4', 'en'); $html2pdf-&gt;pdf-&gt;SetDisplayMode('fullpage'); $html2pdf-&gt;writeHTML($html, isset($_GET['vuehtml'])); $html2pdf-&gt;Output($Title.'.pdf', 'D'); } catch(HTML2PDF_exception $e) { echo $e; exit; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload