Location: PHPKode > projects > FreeWebshop > addons/dompdf/www/examples.php
if ( isset( $_POST["html"] ) ) {

  if ( get_magic_quotes_gpc() )
    $_POST["html"] = stripslashes($_POST["html"]);
  $old_limit = ini_set("memory_limit", "16M");
  $dompdf = new DOMPDF();
  $dompdf->set_paper($_POST["paper"], $_POST["orientation"]);



<?php include("head.inc"); ?>
<div id="toc">
<h2>On this page:</h2>
<?php echo li_arrow() ?><a href="#samples">Samples</a></li>
<?php echo li_arrow() ?><a href="#demo">Demo</a></li>

<a name="samples"> </a>

<p>Below are some sample files. The PDF version is generated on the fly by dompdf.  (The source HTML &amp; CSS for
these files is included in the test/ directory of the distribution

<ul class="samples">
$test_files = glob(dirname(__FILE__) . "/test/*.{html,php}", GLOB_BRACE);
$dompdf = dirname(dirname($_SERVER["PHP_SELF"])) . "/dompdf.php?base_path=" . rawurlencode("www/test/");
foreach ( $test_files as $file ) {
  $file = basename($file);
  $arrow = "images/arrow_0" . rand(1, 6) . ".gif";  
  echo "<li style=\"list-style-image: url('$arrow');\">\n";
  echo $file;
  echo " [<a class=\"button\" target=\"blank\" href=\"test/$file\">HTML</a>] [<a class=\"button\" href=\"$dompdf&input_file=" . rawurlencode("www/test/$file") .  "\">PDF</a>]\n";
  echo "</li>\n";

<a name="demo"> </a>
<p>Enter your html snippet in the text box below to see it rendered as a
PDF: (Note by default, remote stylesheets, images &amp; are disabled.)</p>

<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<p>Paper size and orientaion:
<select name="paper">
foreach ( array_keys(CPDF_Adapter::$PAPER_SIZES) as $size )
  echo "<option ". ($size == "letter" ? "selected " : "" ) . "value=\"$size\">$size</option>\n";
<select name="orientation">
  <option value="portrait">portrait</option>
  <option value="landscape">landscape</option>

<textarea name="html" cols="60" rows="20">

/* Type some style rules here */



&lt;!-- Type some HTML here --&gt;


<div style="text-align: center; margin-top: 1em;">
<input type="submit" name="submit" value="submit"/>
<p style="font-size: 0.65em; text-align: center;">(Note: if you use a KHTML
based browser and are having difficulties loading the sample output, try
saving it to a file first.)</p>

<?php include("foot.inc"); ?>
Return current item: FreeWebshop