On Tuesday, July 26, 2011 2:05:59 AM UTC-4, Lakshman wrote:
I am trying to add php in line scrit.But i am not able to get
the result.plz help me. My code is like this.
File name :hello.php
--------------
<?php
require_once("../dompdf_config.inc.php");
$html =
'<html><body>'.
'<p>Hello World!</p>'.
'<script type="text/php"> echo "test123456"; </script>'.
'</body></html>';
You can not use inline script to print some text into your PDF. The
echo command will send the text to stdout, which in the case of a web page goes to the web browser. Inline script is mainly used to access the PDF library internals (e.g. to lay out text manually, add a password, etc.).
See the FAQ for some inline script examples. For most layout options you can now use HTML+CSS only (in the 0.6.0 release).
Regarding the example code you posted, modifying it to read as follows would be more appropriate:
<?php
require_once("../dompdf_config.inc.php");
Considering the above, you can disable inline script, which we would definitely recommend if you don't need it. If your reason for wanting to use inline script is more complex you'll have to provide more details.