Forum How do I...?

PHP/ Slim routing

madrid
Hello,

I am just trying to create a PDF document, which once set up I will pass some data through.
I have found some help in the forum setting up my PHP file as seen below(just to get started). The webpage is rendering a PDF document but with the error "Failed to Load PDF Document". Any help would be great! I am new to PHP and slim as well. Thanks :)

PDFBIBLE.PHP
<?php
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="file.pdf"');
?>

<?php
require "prince.php";

$prince = new Prince('/usr/lib/prince/bin/prince');
if(!$prince) die("Prince instantiation failed");


$prince->setHTML(1);



$xmlString="<h1>Hello World</h1><p>This is a test. Did you guess?</p>";
if(!$prince->convert_string_to_passthru($xmlString))die("Error running Prince");

convert_string_to_passthru($xmlString);

?>



and in my router.php file I have

$app->get('/pdfbible', function ($request, $response, $args) {
				$response = $this->response->withHeader( 'Content-type', 'application/pdf' );
				include ('../controllers/PdfBible.php');
				return $response;
			});


mikeday
It might help to check with wget or curl to see exactly what the server is responding with.