protected function views_data_export_pdf_plugin_display_export::convert_batch_output_to_pdf in Views Data Export PDF 7
Same name and namespace in other branches
- 7.2 plugins/views_data_export_pdf_plugin_display_export.inc \views_data_export_pdf_plugin_display_export::convert_batch_output_to_pdf()
Converts the output of the export from HTML to PDF formats.
Return value
bool TRUE if conversion of the file was attempted and has completed; FALSE if the conversion is still in progress in a background thread.
Throws
views_data_export_pdf_conversion_exception If the conversion fails.
1 call to views_data_export_pdf_plugin_display_export::convert_batch_output_to_pdf()
- views_data_export_pdf_plugin_display_export::execute_pdf_generation in plugins/
views_data_export_pdf_plugin_display_export.inc - Converts the results of the export from HTML into PDF format.
File
- plugins/
views_data_export_pdf_plugin_display_export.inc, line 496 - Contains the Views Data Export Display plug-in for PDF format.
Class
- views_data_export_pdf_plugin_display_export
- The PDF export display plug-in for Views Data Export.
Code
protected function convert_batch_output_to_pdf(array &$sandbox) {
$this->view
->build();
if (empty($sandbox['conversion_initialized'])) {
// Before conversion officially starts, prepare the view for final
// rendering.
$temp_store = $this
->build_temp_result_store($sandbox);
$temp_store
->restore_view_results();
$sandbox['pdf_output_fid'] = $this
->tempfile_create();
// Avoid reinitialization
$sandbox['conversion_initialized'] = TRUE;
}
try {
$source_html_file = $this
->outputfile_entity();
$target_pdf_file = file_load($sandbox['pdf_output_fid']);
$finished = $this
->get_style_plugin()
->render_html_file_to_pdf($source_html_file, $target_pdf_file);
if ($finished) {
$this
->switch_output_file($target_pdf_file);
}
return $finished;
} finally {
if (isset($temp_store)) {
// The temp store is only needed until conversion has started.
$temp_store
->cleanup();
}
}
}