I would like to generate a pdf with wkhtmltopdf at the end of my batch.
I integrate the generation in the callback function but it does not offer me the download of the file
This is my finished function:
function csm_generate_pdf_finished($success, $results, $operations) {
$message = 'some errors';
if ($success) {
if (($library = libraries_load('phpwkhtmltopdf')) && !empty($library['loaded'])) {
$pdf = new WkHtmlToPdf();
$html = $results['data'];
$start = $results['start'];
$end = $results['end'];
$pdf->addPage( $html );
$filename = 'document_'.$start.'_'.$end.'.pdf';
$pdf->send($filename);
$message = 'Generation PDF ok';
}
}
drupal_set_message($message);
}