dompdf freezes not showing content. page is blank

somdow

I'm working on a small project that is supposed to send out a certificate via a pdf. The way its supposed to work is that, the client goes to his admin page and fills out certain information like name/age/date/email etc and thereafter, once Submit is hit its supposed to fill out a PDF(with dompdf) and send it via email.

I'm getting stuck in the part where the PDF is generated.

If i stick to normal text the pdf is generated just fine. As soon as i start to use inline php it freezes after 30 seconds. I found it weird because I've cut the whole document down to literally one long sentence with small string vars and after cutting it down, it now shows the pdf but it comes out blank.

Here is a truncated piece of what i have so far.

HTML: on this page i have a test link like so:

Click this link <a href="certificate-proc.php?loc=florida&name=Lopan&courseMan=mike%20bitz">HERE</a> to send over details to fill into the certificate.

CODE: On the page that receives this information, i have this which is supposed to get the GET info from the link, and pass it to the document.

<?php
require_once('dompdf_config.inc.php');

$locs = $_GET["loc"];
$name = $_GET["name"];
$course = $_GET["courseMan"];
$date = "sunday at some time today it will happen";





//create new dompdf object
$html = ' <!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>

</head>

<body>
    <div id="mainW">
<?php echo $name; ?>

   </div><!-- mainW ender -->
</body>
</html> ' ;

$dompdf = new DOMPDF(); 
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");


?>

Right now as it stands, with the above, its supposed to show the name. Although the PDF is generated, nothing prints inside it. Its blank. If i take out the php and add regular text. it works.

Any ideas as to what im missing? im new to all this so any help or direction is greatly appreciated.

Thanks in advanced.

davewoodhall

You are using <?php ?> tags within your string. Try this:

$html = '... <div id="mainW">'.$name.'</div>' ...;

Alternatively, you could add it like so:

$html = '...';
$html .= $name;
$html .= '...';

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

dompdf inserts blank page at end of document

From Dev

Webmatrix showing blank page

From Dev

Dompdf default page header content overlap

From Dev

DOMPDF - break page when not fit content

From Dev

javascript blank page showing up

From Dev

Page content not showing on mobile devices

From Dev

Backend content of page is not showing in wordpress

From Dev

Login page content not showing in AngularJS

From Dev

Facebook App Canvas Showing Blank Page

From Dev

Facebook Graph API Explorer is showing a blank page

From Dev

webview error screen showing blank page

From Dev

Facebook Graph API Explorer is showing a blank page

From Dev

Skyepub on swift2 showing blank page

From Dev

React Router With Handler showing blank page

From Dev

How to fix AMPPS showing blank page

From Dev

Social media links showing blank page

From Dev

Ionic apk showing blank page but showing list of products in browser

From Dev

Facebook login page showing blank page in IOS 9

From Dev

Start showing new php page in middle of the content

From Dev

google map not showing in page by ajax loaded content

From Dev

Master page content not showing up in child

From Dev

Master page content not showing up in child

From Dev

content of the page is not showing up in some manner

From Dev

Start showing new php page in middle of the content

From Dev

default tab not showing content while load the page

From Dev

DangerouslySetInnerHtml() showing content from previous page in React

From Dev

WebView showing blank white page when trying Facebook login

From Dev

Why is React Webpack production build showing Blank page?

From Dev

Delete command is working but showing a blank page after button click

Related Related

HotTag

Archive