example09_forms.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <?php
  2. define('_MPDF_PATH','../');
  3. include("../mpdf.php");
  4. $html = '
  5. <form>
  6. <b>Textarea</b>
  7. <textarea name="authors" rows="5" cols="80" wrap="virtual">Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. </textarea>
  8. <br /><br />
  9. <b>Select</b>
  10. <select size="1" name="status"><option value="A">Active</option><option value="W" >New item from auto_manager: pending validation</option><option value="I" selected="selected">Incomplete record - pending</option><option value="X" >Flagged for Deletion</option> </select> followed by text
  11. <br /><br />
  12. <b>Input Radio</b>
  13. <input type="radio" name="pre_publication" value="0" checked="checked" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="pre_publication" value="1" > Yes
  14. <br /><br />
  15. <b>Input Radio</b>
  16. <input type="radio" name="recommended" value="0" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="1" > Keep &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="2" checked="checked" > Choice
  17. <br /><br />
  18. <b>Input Text</b>
  19. <input type="text" size="190" name="doi" value="10.1258/jrsm.100.5.211">
  20. <br /><br />
  21. <b>Input Password</b>
  22. <input type="password" size="40" name="password" value="secret">
  23. <br /><br />
  24. <input type="checkbox" name="QPC" value="ON" /> Checkboxes<br>
  25. <input type="checkbox" name="QPA" value="ON" disabled="disabled" /> Disabled<br>
  26. <input type="checkbox" name="QLY" value="ON" checked="checked" /> Selected
  27. <br /><br />
  28. <input type="submit" name="submit" value="Submit" /><br /><br />
  29. </form>
  30. <hr style="width:80%;" />
  31. <div>
  32. <form>
  33. <b>Textarea</b>
  34. <textarea name="authors" rows="5" cols="50" wrap="virtual">Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. </textarea>
  35. <br /><br />
  36. <b>Select</b>
  37. <select size="1" name="status"><option value="A">Active</option><option value="W" >New item from auto_manager: pending validation</option><option value="I" selected="selected">Incomplete record - pending</option><option value="X" >Flagged for Deletion</option> </select>
  38. <br /><br />
  39. <b>Input Radio</b>
  40. <input type="radio" name="pre_publication" value="0" checked="checked" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="pre_publication" value="1" > Yes
  41. <br /><br />
  42. <b>Input Radio</b>
  43. <input type="radio" name="recommended" value="0" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="1" > Keep &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="2" checked="checked" > Choice
  44. <br /><br />
  45. <b>Input Text</b>
  46. <input type="text" size="40" name="doi" value="10.1258/jrsm.100.5.211" />
  47. <br />
  48. <b>Input Password</b>
  49. <input type="password" size="40" name="password" value="secret">
  50. <br /><br />
  51. <input type="checkbox" name="QPC" value="ON" /> Checkboxes<br>
  52. <input type="checkbox" name="QPA" value="ON" disabled="disabled" /> Disabled<br>
  53. <input type="checkbox" name="QLY" value="ON" checked="checked" /> Selected
  54. <br /><br />
  55. <input type="submit" name="submit" value="Submit" /><br /><br />
  56. </form>
  57. </div>
  58. <hr style="width:100%;" />
  59. <form>
  60. <table border="1" style="padding:2px;" >
  61. <tr><td valign="top" align="right"><b>Textarea</b></td><td><textarea name="title" rows="5" cols="50" wrap="virtual">TEXTINTABLE Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. Quisque viverra. Etiam id libero at magna pellentesque aliquet. Nulla sit amet ipsum id enim tempus dictum. </textarea></td></tr>
  62. <tr><td valign="top" align="right"><b>Select</b></td><td><select size="1" name="status"><option value="A">Active</option><option value="W" >New item from auto_manager: pending validation</option><option value="I" selected="selected">Incomplete record - pending</option><option value="X" >Flagged for Deletion</option> </select> <input type="hidden" name="old_status" value="A" /> </td></tr>
  63. <tr><td valign="bottom" align="right"><b>Input Radio</b></td><td><input type="radio" name="pre_publication" value="0" checked > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="pre_publication" value="1" > Yes </td></tr>
  64. <tr><td valign="top" align="right"><b>Input Radio</b></td><td><input type="radio" name="recommended" value="0" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="1" > Keep &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="2" checked="checked" > Choice </td></tr>
  65. <tr><td valign="top" align="right"><b>Input Text</b></td><td><input type="text" size="40" name="doi" value="10.1258/jrsm.100.5.211"> </td>
  66. </tr>
  67. </table>
  68. <br />
  69. <table border="1" style="padding:8px;">
  70. <tr><td valign="top" align="right"><b>Checkbox</b></td><td></td></tr>
  71. <tr><td><input type="checkbox" name="QPC" value="ON" > Checkboxes<br></td><td><input type="checkbox" name="QSC" value="ON" > Gardening</td></tr>
  72. <tr><td><input type="checkbox" name="QPA" value="ON" > Holidays<br></td><td><input type="checkbox" name="QPD" value="ON" > Motoring<br></td></tr>
  73. <tr><td><input type="checkbox" name="QLY" value="ON" checked="checked" > Books</td><td><input type="checkbox" name="QCA" value="ON" > Theatre</td></tr>
  74. <tr><td><input type="checkbox" name="QNU" value="ON" checked="checked" > Selected option</td><td><input type="checkbox" name="QET" value="ON" > Musicals</td></tr><tr><td><input type="checkbox" name="QBE" value="ON" > Eating out</td><td><input type="checkbox" name="QPY" value="ON" > Events</td></tr>
  75. <tr><td>
  76. <input type="submit" name="submit" value="Submit" /><br />
  77. </td><td></td></tr></table>
  78. </form>
  79. <form>
  80. <b>Input Radio</b>
  81. <input type="radio" name="pre_publication" value="0" checked="checked" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="pre_publication" value="1" > Yes
  82. <br /><br />
  83. <input type="hidden" name="doi" value="10.1258/jrsm.100.5.211" />
  84. <b>Input Radio</b>
  85. <input type="radio" name="recommended" value="0" > No &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="1" > Keep &nbsp;&nbsp;&nbsp;&nbsp; <input type="radio" name="recommended" value="2" checked="checked" > Choice
  86. <br /><br />
  87. <b>Input Text</b><br />
  88. Input text: <input type="text" size="40" name="doi" value="10.1258/jrsm.100.5.211" /> <br />
  89. Password: <input type="password" size="40" name="doi" value="pallcare" />
  90. <br /><br />
  91. Checkboxes: <br />
  92. <input type="checkbox" name="QPC" value="ON" /> Checkboxes<br>
  93. <input type="checkbox" name="QPA" value="ON" disabled="disabled" /> Disabled<br>
  94. <input type="checkbox" name="QLY" value="ON" checked="checked" /> Selected
  95. <br /><br />
  96. <input type="image" name="submit" src="goto.gif" />
  97. <input type="button" name="submit" value="Button" />
  98. <input type="reset" name="submit" value="Reset" />
  99. <input type="submit" name="submit" value="Submit" />
  100. </form>
  101. ';
  102. //==============================================================
  103. //==============================================================
  104. //==============================================================
  105. if (isset($_REQUEST['html'])) { echo '<html><head><style>'.file_get_contents('mpdfstyletables.css').'</style></head><body>'.$html.'</body></html>'; exit; }
  106. if (isset($_REQUEST['source'])) {
  107. $file = __FILE__;
  108. header("Content-Type: text/plain");
  109. header("Content-Length: ". filesize($file));
  110. header("Content-Disposition: attachment; filename='".$file."'");
  111. readfile($file);
  112. exit;
  113. }
  114. //==============================================================
  115. //==============================================================
  116. //==============================================================
  117. $mpdf=new mPDF('c');
  118. $mpdf->default_lineheight_correction = 1.2;
  119. // LOAD a stylesheet
  120. $stylesheet = file_get_contents('mpdfstyletables.css');
  121. $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text
  122. $mpdf->SetColumns(2,'J');
  123. $mpdf->WriteHTML($html);
  124. $mpdf->Output();
  125. exit;
  126. ?>