Improve the output of printed pages to pdf

This commit is contained in:
Manuel Cillero 2017-10-01 20:55:21 +02:00
parent 39729c5f8e
commit 2e20b06d22
3 changed files with 10 additions and 8 deletions

View file

@ -85,6 +85,8 @@ function print_pdf_generate_path($path, $cid = NULL, $pdf_filename = NULL) {
return; return;
} }
$print['body_class'] = 'print-pdf';
// Img elements must be set to absolute // Img elements must be set to absolute
$pattern = '!<(img\s[^>]*?)>!is'; $pattern = '!<(img\s[^>]*?)>!is';
$print['content'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['content']); $print['content'] = preg_replace_callback($pattern, '_print_rewrite_urls', $print['content']);

View file

@ -1212,25 +1212,25 @@ div.field-items img.imagefield[class$="_image"] {
width: auto\9; /* IE8 */ width: auto\9; /* IE8 */
} }
@media (max-width: 889px) { @media (max-width: 889px) {
div.stormfields { body:not(.print-pdf) div.stormfields {
margin-bottom: 0; margin-bottom: 0;
} }
div.stormfields div.label, body:not(.print-pdf) div.stormfields div.label,
body.suitedesk div.field-label { body:not(.print-pdf).suitedesk div.field-label {
float: none; float: none;
width: auto; width: auto;
line-height: 1.2em; line-height: 1.2em;
} }
div.stormfields div.value, body:not(.print-pdf) div.stormfields div.value,
body.suitedesk div.field-items { body:not(.print-pdf).suitedesk div.field-items {
margin-left: 0; margin-left: 0;
margin-right: 44%; margin-right: 44%;
line-height: 2em; line-height: 2em;
} }
} }
@media (max-width: 529px) { @media (max-width: 529px) {
div.stormfields div.value, body:not(.print-pdf) div.stormfields div.value,
body.suitedesk div.field-items { body:not(.print-pdf).suitedesk div.field-items {
margin-right: 0; margin-right: 0;
} }
} /* } /*

View file

@ -22,7 +22,7 @@
<?php print $print['css']; ?> <?php print $print['css']; ?>
</head> </head>
<body class="print-body suitedesk"> <body class="print-body<?php print (empty($print['body_class']) ? '' : ' ' . $print['body_class']); ?> suitedesk">
<?php if (!empty($print['message'])) { <?php if (!empty($print['message'])) {
print '<div class="print-message">'. $print['message'] .'</div>'; print '<div class="print-message">'. $print['message'] .'</div>';