]*?src\s*?=\s*?['\"]?{$base_url}[^>]*?>!is"; $html = preg_replace_callback($pattern, create_function('$matches', 'return html_entity_decode($matches[0], ENT_QUOTES);'), $html); // Remove queries from the image URL $pattern = "!(]*?src\s*?=\s*?['\"]?{$base_url}[^>]*?)(?:%3F|\?)[^\s'\"]+([^>]*?>)!is"; $html = preg_replace($pattern, '$1$2', $html); require_once(DRUPAL_ROOT . '/' . $pdf_tool[1]); module_load_include('inc', 'print_pdf_tcpdf', 'print_pdf_tcpdf.class'); $font = Array( check_plain(variable_get('print_pdf_font_family', PRINT_PDF_TCPDF_FONT_FAMILY_DEFAULT)), '', check_plain(variable_get('print_pdf_font_size', PRINT_PDF_TCPDF_FONT_SIZE_DEFAULT)), ); $orientation = drupal_strtoupper($page_orientation[0]); // create new PDF document $pdf = new PrintTCPDF($orientation , 'mm', $paper_size, TRUE); // set document information if (isset($meta['name'])) { $pdf->SetAuthor(strip_tags($meta['name'])); } $pdf->SetCreator(variable_get('site_name', 'Drupal')); $pdf->SetTitle(html_entity_decode($meta['title'], ENT_QUOTES, 'UTF-8')); $pdf->setPDFVersion('1.6'); $pdf->setFontSubsetting(variable_get('print_pdf_font_subsetting', PRINT_PDF_TCPDF_FONT_SUBSETTING_DEFAULT)); $pdf->setTcpdfLink(false); if ($language->direction == LANGUAGE_RTL) { $pdf->setRTL(TRUE); } $pdf = theme('print_pdf_tcpdf_header', array('pdf' => $pdf, 'html' => $html, 'font' => $font)); $pdf = theme('print_pdf_tcpdf_footer', array('pdf' => $pdf, 'html' => $html, 'font' => $font)); $pdf = theme('print_pdf_tcpdf_page', array('pdf' => $pdf)); // Enable third-party module to alter the pdf object, via hook_print_pdf_tcpdf_alter() drupal_alter('print_pdf_tcpdf', $pdf, $html, $meta); // add a page $pdf->AddPage(); $pdf = theme('print_pdf_tcpdf_content', array('pdf' => $pdf, 'html' => $html, 'font' => $font)); // reset pointer to the last page $pdf->lastPage(); // try to recover from any warning/error ob_clean(); return $pdf = $pdf->Output('', 'S'); } /** * Format the TCPDF header * * @param array $vars * An associative array containing: * - $pdf: current TCPDF object * - $html: contents of the body of the HTML from the original node * - $font: array with the font definition (font name, styles and size) * * @return object * modified PDF object * * @ingroup themeable * @ingroup print_themeable */ function theme_print_pdf_tcpdf_header($vars) { global $base_url; $pdf = $vars['pdf']; preg_match('!