By sergiod on
Hi.
I use print module, with wkhtmltopdf libraby, to generate pdf from contents.
Is it possibile to save a copy of pdf files, after they are created?
thanks,
Sergej
Hi.
I use print module, with wkhtmltopdf libraby, to generate pdf from contents.
Is it possibile to save a copy of pdf files, after they are created?
thanks,
Sergej
Comments
You can use Views PDF module
You can use Views PDF module with Rules to achieve that.
Margaret Could you explain
Margaret
Could you explain how ? I can see that there is an action in Rules to save the PDF file but what event should I link this to, or do I have to write my own ?
Thanks
you can write your own module
El Bandito,
You can write your own module to generated pdf using dompdf library. use hook hook_node_presave($node) to get the contents.
you can get the dompdf library from dompdf and then you can use the following code to save the content.
require_once(realpath(".") . "/sites/all/libraries/dompdf/dompdf_config.inc.php");
spl_autoload_register('DOMPDF_autoload');
$html = "Your content in html format"
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$pdf = $dompdf->output();
$file = file_save_data($pdf, 'public://'.$filename);
in this way you can create pdf by writing a custom module