Dear all,
I am using HTML2PDF to generate quotations.
In my dev environment everything just work fine but on the prod server, sending the converted PDF to the browser results in opening a blank page instead of opening the open/save dialog for PDF files.
I have also seen that this is primarily caused by the fact that i'm using an include file for my HTML page that I want to convert using HTML2PDF as if I use a more simple code it works.
Please find the exemples below :
THE FOLLOWING CODE IS WORKING :
<?php
// GET the HTML
ob_start();
$content = ob_get_clean();
$content = 'TEST';
// CONVERT to PDF
require_once($_SERVER['DOCUMENT_ROOT']."/ImagIn/INCLUDES/HTML2PDF/html2pdf.class.php");
$html2pdf = new HTML2PDF('P','A4','fr');
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
ob_clean();
$html2pdf->Output('test.pdf', 'D');
?>
THE CODE THAT IS CAUSING PROBLEMS ON THE PROD SERVER ONLY :
<?php
$fact = Facture::Charger(2013001);
// GET the HTML
ob_start();
$langUser = $fact->Utilisateur->Langage;
$PDF_filename = "Quotation_".$quotID.".pdf";
include($_SERVER['DOCUMENT_ROOT'].'/ImagIn/templateQuotation_'.$langUser.'.php');
$content = ob_get_clean();
$content = str_replace('%%QRCode%%', $qrCode, $content);
$content = str_replace('%%DevisNumero%%', $quotIDFormatted, $content);
$content = str_replace('%%UtilisateurID%%', $fact->Utilisateur->Identifiant, $content);
// CONVERT to PDF
require_once($_SERVER['DOCUMENT_ROOT']."/ImagIn/INCLUDES/HTML2PDF/html2pdf.class.php");
$html2pdf = new HTML2PDF('P', 'A4', strtolower($langUser), TRUE, 'UTF-8', array(10, 8, 10, 5));
$html2pdf->WriteHTML($content, isset($_GET['vuehtml']));
ob_clean();
$html2pdf->Output($PDF_filename, 'D');
?>
Does anyone have an idea of which parameter(s) on the server could block the above code to work ???
Thank you very much for your help !