diff --git a/print_pdf/print_pdf.pages.inc b/print_pdf/print_pdf.pages.inc
index 5d02a2b8e555aefc75bb65ab28423c8434ba99f7..be44839638c7cac05c871d07ab24275ee1122518 100644
--- a/print_pdf/print_pdf.pages.inc
+++ b/print_pdf/print_pdf.pages.inc
@@ -43,23 +43,27 @@ function print_pdf_controller() {
$print['logo'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['logo']);
$print['footer_message'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['footer_message']);
// And converted from private to public paths
+ switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
+ case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
+ case LANGUAGE_NEGOTIATION_PATH:
+ $lang = $language->language;
+ break;
+ default:
+ $lang = '';
+ break;
+ }
$file_downloads = variable_get('file_default_scheme', 'public');
if ($file_downloads == 'private') {
- switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
- case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
- case LANGUAGE_NEGOTIATION_PATH:
- $lang = $language->language;
- break;
- default:
- $lang = '';
- break;
- }
- $pattern = "!(]*?src\s*?=\s*?['\"]?)${base_url}/(?:(?:index.php)?\?q=)?(?:${lang}/)?system/files(/[^>]*?>)!is";
- $replacement = '$1file://' . realpath(file_directory_path()) . '$2';
- $print['content'] = preg_replace($pattern, $replacement, $print['content']);
- $print['logo'] = preg_replace($pattern, $replacement, $print['logo']);
- $print['footer_message'] = preg_replace($pattern, $replacement, $print['footer_message']);
+ $pattern = "!(]*?src\s*?=\s*?['\"]?)${base_url}/(?:(?:index.php)?\?q=)?(?:${lang}/)?system/files/([^>]*?>)!is";
+ $replacement = '$1file://' . realpath(file_directory_path()) . '/$2';
}
+ else {
+ $pattern = "!(]*?src\s*?=\s*?['\"]?)${base_url}/(?:(?:index.php)?\?q=)?(?:${lang}/)?([^>]*?>)!is";
+ $replacement = '$1file://'. realpath($_SERVER["DOCUMENT_ROOT"].base_path()) .'/$2';
+ }
+ $print['content'] = preg_replace($pattern, $replacement, $print['content']);
+ $print['logo'] = preg_replace($pattern, $replacement, $print['logo']);
+ $print['footer_message'] = preg_replace($pattern, $replacement, $print['footer_message']);
// Send to printer option causes problems with PDF
$print['sendtoprinter'] = '';
@@ -290,7 +294,7 @@ function _print_pdf_tcpdf($print, $html, $filename) {
*/
function _print_pdf_wkhtmltopdf($print, $html, $filename) {
$print_pdf_pdf_tool = variable_get('print_pdf_pdf_tool', PRINT_PDF_PDF_TOOL_DEFAULT);
- $print_pdf_paper_size = drupal_strtolower(variable_get('print_pdf_paper_size', PRINT_PDF_PAPER_SIZE_DEFAULT));
+ $print_pdf_paper_size = variable_get('print_pdf_paper_size', PRINT_PDF_PAPER_SIZE_DEFAULT);
$print_pdf_page_orientation = variable_get('print_pdf_page_orientation', PRINT_PDF_PAGE_ORIENTATION_DEFAULT);
$print_pdf_content_disposition = variable_get('print_pdf_content_disposition', PRINT_PDF_CONTENT_DISPOSITION_DEFAULT);
$print_pdf_wkhtmltopdf_options = variable_get('print_pdf_wkhtmltopdf_options', PRINT_PDF_WKHTMLTOPDF_OPTIONS);