1<html> 2<head> 3<title>html2ps/html2pdf script parameters</title> 4<link rel="stylesheet" type="text/css" medial="all" title="Default" href="css/help.css"/> 5</head> 6<body> 7<h1 id="top">html2ps/pdf script parameters</h1> 8 9<p><a href="index.html">Back to table of contents</a></p> 10 11<p> Note that parameter names are case-sensitive. This script accepts parameters 12 passed using both the GET and POST methods. Script parameters (in alphabetical order) are:</p> 13 14<table class="description_table"> 15<tr class="odd"> 16<th>Parameter</th> 17<th>Description</th> 18</tr> 19 20<tr class="even"> 21<td>batch[]</td> 22<td> 23Specify a list of URL for "batch-processing" mode here. 24Note that ##PAGES## directive will not work in this case. 25</td> 26</tr> 27 28<tr class="odd"> 29<td>compress</td> 30 <td>Set this option to generate compressed Postscript files. You'll probably 31 only need this option only if you're working with Postscript (NOT PDF) files 32 via Adobe Acrobat Distiller, as it does not support compressed Postscript. 33 In any other case, use compressed Postscript, as it will save on bandwidth. 34<p>PDF files may be compressed, but you will need to unpack them manually before viewing.</td> 35</tr> 36</tr> 37 38<tr class="even"> 39<td id="cssmedia">cssmedia</td> 40 <td>HTML page can contain stylesheets for different target media types; for 41 example, the printable version of a page may have navigation panes and banners 42 hidden, while the version for handhelds may be specially formatted to work 43 on small displays and so on. By setting the value of this parameter, you 44 determine which set of CSS rules will be used during PS/PDF rendering.</td> 45</tr> 46 47<tr class="odd"> 48<td id="debugbox">debugbox</td> 49<td> 50<p>Set this option if you want to see boundaries of all boxes generated by the script. 51It is unlikely you'll need this option, as it is mostly for debugging purposes.</p> 52<p>Please note if you're using this option that the script renders the <i>content</i> 53boundary which is different from the "normal" box border!</td> 54</tr> 55 56<tr class="even"> 57<td id="encoding">encoding</td> 58 <td>Encoding can usually be automatically detected using HTTP response header 59 or META tags inside the HTML. Sometimes, encoding information is missing; 60 you can specify encoding name as a value of this parameter.</td> 61</tr> 62 63<tr class="odd"> 64<td id="footerhtml">footerhtml</td> 65<td>HTML string containing text to insert to every page footer. 66<p>You may use 'style' attribute to control header/footer appearance; for example:</p> 67<pre> 68<div style="background: red;">SOME TEXT</div> 69</pre> 70<p>Note this string must be (almost) valid XHTML (almost means that HTML/HEAD/BODY tags may be omitted). In particular:</p> 71<ul> 72<li>you should replace &,< and > with &amp;,&lt and &gt; correspondingly.</li> 73<li>All tags should be closed (including self-closing tags like BR or IMG).</li> 74<li>Tag and attribute names should be in lower case.</li> 75</ul> 76<p>See also: <a href="http://www.w3.org/TR/xhtml1/#diffs">XHTML 1.0: Differences with HTML 4</a>.</p> 77<p>For more sophisticated control over the header/footer data, please refer to <a href="compatibility.css.3.html#marginboxes">CSS 3 margin boxes</a></p> 78</td> 79</tr> 80 81<tr class="even"> 82<td id="headerhtml">headerhtml</td> 83<td> 84<p>HTML string containing text to insert to every page header. 85You may use 'style' attribute to control header/footer appearance; for example:</p> 86<pre><div style="background: red;">SOME TEXT</div></pre> 87<p>Note this string must be (almost) valid XHTML (almost means that HTML/HEAD/BODY tags may be omitted). In particular:</p> 88<ul> 89<li>you should replace &,< and > with &amp;,&lt and &gt; correspondingly.</li> 90<li>All tags should be closed (including self-closing tags like BR or IMG).</li> 91<li>Tag and attribute names should be in lower case.</li> 92</ul> 93<p>See also: <a href="http://www.w3.org/TR/xhtml1/#diffs">XHTML 1.0: Differences with HTML 4</a>.</p> 94<p>For more sophisticated control over the header/footer data, please refer to <a href="compatibility.css.3.html#marginboxes">CSS 3 margin boxes</a></p> 95</td> 96</tr> 97 98<tr class="odd"> 99<td>html2xhtml</td> 100 <td>If you're absolutely sure you have valid strict XHTML page, you can set 101 this option to disable HTML-to-XHTML conversion and speed up script execution 102 a little. In any other case, do not set this option, as the script will 103 not work with non-well-formed XML. Use this option at your own risk; if you encounts any 104 errors first enable the HTML-to-XHTML conversion.</td> 105</tr> 106 107<tr class="even"> 108<td id="landscape">landscape</td> 109 <td>Set this parameter to rotate the media to landscape orientation. Please 110 note that the 'virtual resolution' will remain the same; all page content 111 will be scaled to fit the new page width.</td> 112</tr> 113 114<tr class="odd"> 115<td id="margins">leftmargin, rightmargin, topmargin, bottommargin</td> 116 <td>Page margins (millimeters). Note that you may calculate top and bottom margin height automatically 117 to fit header/footer content (provided it is defined using CSS 3 margin boxes) by specifying zero values for 118 topmargin AND bottommargin at the same time.</td> 119</tr> 120 121<tr> 122<tr class="even"> 123<td id="media">media</td> 124<td>Name of <a href="configuration.html#common" title="Media definitions in configuration file">predefined media</a> to use. Note that media name is case-sensitive!</td> 125</tr> 126 127<tr class="odd"> 128<td>method</td> 129<td>This option determines the type of script output: 130 <ul> 131 <li>fastps -- Postscript;</li> 132 <li>pdflib -- PDF generated using PDFLIB;</li> 133 <li>fpdf -- PDF generated using <a href="http://www.fpdf.org" target="_blank">FPdf</a></li> 134 </ul> 135</td> 136</tr> 137 138<tr class="even"> 139<td>output</td> 140 <td>The value of this parameter determines how the generated file will be 141 handled: 142 <ul> 143 <li>0 -- PDF file will be opened immediately (possibly in the same browser 144 window). Note it will not work for Postscript files in most cases, they 145 will be downloaded as usual;</li> 146 <li>1 -- user will be prompted to download generated file;</li> 147 <li>2 -- generated file will be <a href="configuration.html#common" title="How to configure this option">stored 148 on the server</a>;</li> 149</ul> 150</td> 151</tr> 152 153<tr class="odd"> 154<td id="pageborder">pageborder</td> 155<td>Set this parameter if you want the page border to be printed.</td> 156</tr> 157 158<tr class="even"> 159<td>pdfversion</td> 160 <td>This option determines the compatibility level of PDF to be generated; 161 the higher level you use, more features can this PDF contain. On the other 162 hand, high-level PDFs may not be readable by older viewer versions: 163 <ul> 164<li>1.2 (Acrobat Reader 3)</li> 165<li>1.3 (Acrobat Reader 4)</li> 166<li>1.4 (Acrobat Reader 5)</li> 167<li>1.5 (Acrobat Reader 6)</li> 168</ul> 169</td> 170</tr> 171 172<tr class="odd"> 173<td id="pixels">pixels</td> 174<td> 175 <p>'Virtual screen' horizontal resolution used during the page rendering 176 process. As you know, a lot of HTML pages contain dimensions set in pixels 177 -- images, in most cases, but sometimes fonts. Postscript/PDF files do 178 not have "pixels", all dimensions are measured in "points" 179 so we need to provide information about the pixel/point ratio. In our 180 case, this ratio can be calculated as follows: </p> 181 <pre>R = (page full width in points - page horizontal margins in points) / virtual resolution</pre> 182 183 <p>Thus, you can specify resolution in 800 pixels and make pages designed 184 for 800x600 resolution to fit your printed page exactly.</p> 185 <p><tt>index.php</tt> provides three default values for this parameter: 186 640, 800 and 1024; if you need more exotic value, say 945, you may specify 187 this in the script query string manually and still get correct results.</p> 188 <p>Please note that pages may be cut off on the right side if they're designed for the higher resolution 189than you've specified (for example, if they have hardcoded table widths or wide images). It is a feature. 190In such cases please consider increasing 'pixels' value.</p> 191</td> 192</tr> 193 194<tr class="even"> 195<td>process_mode</td> 196<td>Set this parameter to 'batch' to process several URLs at once and merge results in one PDF file; 197if this parameter have any other value, script runs in normal "single-url" mode.</td> 198</tr> 199 200<tr class="odd"> 201<td>pslevel</td> 202<td> 203If this parameter have value of '3', the script will generate Postscript Level 3; 204otherwise – Postscript Level 2. Default value is '3'. This parameter does not affect PDF generation. 205</td> 206</tr> 207 208<tr class="even"> 209<td>ps2pdf</td> 210<td>Flag indicating whether script should convert generated Postscript file to PDF using Ghostscript utility. 211Note that generally script does not prevent you to enable this filter for 'fpdf' and 'pdflib' methods, but 212this will result in conversion error.</td> 213</tr> 214 215<tr class="odd"> 216<td id="renderfields">renderfields</td> 217<td>Flag indicating whether script should render special fields like ##PAGE##. Fields will be rendered if this parameter 218is present (even if it has empty value)</td> 219</tr> 220 221<tr class="even"> 222<td id="renderforms">renderforms</td> 223<td>Flag indicating whether script should render interactive form controls. Forms will be rendered if this parameter 224is present (even if it has empty value)</td> 225</tr> 226 227<tr class="odd"> 228<td id="renderimages">renderimages</td> 229<td>Flag indicating whether script should fetch and render image files. Images will be rendered if this parameter 230is present (even if it has empty value)</td> 231</tr> 232 233<tr class="even"> 234<td id="renderlinks">renderlinks</td> 235<td>Flag indicating whether script should render internal and external hyperlinks. Links will be rendered if this parameter 236is present (even if it has empty value)</td> 237</tr> 238 239<tr class="odd"> 240<td id="scalepoints">scalepoints</td> 241<td> 242 <p>When a page contains both device-dependent (in pixels) and device-independent 243 (in points) dimensions, we're in trouble. For example, imagine a page 244 containing absolute-positioned text inside the image; in this case, as 245 display and paper have different sizes, point/pixel ratio will be different 246 in the browser window and file rendered by the script, possilibly breaking 247 the page layout. To prevent this, the <tt>scalepoint</tt> option is used. 248 </p> 249 250 <p>If this parameter is set, the HTML page "points" are scaled 251 to keep the mentioned ratio, so if you print the resulting file and measure 252 fonts, they will be smaller than you expect, but the page layout will 253 be exactly the same as you see in browser window (well, close to it). 254 If you want fonts to have their real size, disable this option.</p> 255 256<p>Note that this additional scaling applies to points only; such units as in, cm, mm and pc 257are not affected by this option.</p></td> 258</tr> 259 260<tr class="even"> 261<td id="renderlinks">toc</td> 262<td>Flag indicating whether script should automatically generate <a href="generated_toc.html">table of contents</a></td> 263</tr> 264 265<tr class="odd"> 266<td id="renderlinks">toc-location</td> 267<td>Defines the place where to place generated table of contents: 268<ul> 269<li><tt>before</tt> — on the first (separate) page</li> 270<li><tt>after</tt> — on the last (separate) page (default)</li> 271<li><tt>placeholder</tt> — replace placeholder DIV</li> 272</ul> 273</td> 274</tr> 275 276<tr class="even"> 277<td>URL</td> 278<td> 279<p> 280URL you're going to convert (page should be available via either <tt>http</tt> 281or <tt>https</tt>). Note that the <tt>http://</tt> prefix is prepended to 282this value automatically in case no http or https protocol part is found, 283thus you may set the value of this parameter, for example, to <tt>www.google.com</tt>, 284not <tt>http://www.google.com</tt>. 285</p> 286<p> 287Note that if you're trying to use URL containing GET request (e.g. http://www.google.com/search?q=test), 288you <b>must</b> apply <a title="Documentation on 'urlencode' - new window" target="_blank" href="http://php.net/urlencode">urlencode</a> function 289to this url. 290</p> 291</td> 292</tr> 293 294<tr class="odd"> 295<td id="watermarkhtml">watermarkhtml</td> 296<td>HTML string containing text to display across every page.</td> 297</tr> 298 299</table> 300 301<a href="#top">Top↑</a> 302 303<div style="height: 800px;"> </div> 304 305</body> 306</html>