如果Internet Explorer调整大小的打印页到60%
问题描述:
在IE如果Internet Explorer调整大小的打印页到60%
打印时,我使用铬或Mozilla一切正常 这当我卡住我的工作是我的页面截图:
,但是当我使用IE浏览器都无法正常工作像它应该工作:(
这是IE浏览器的截图:
这是我的代码:
<?php
include("bd.php");
$print[] = null;
if(isset($_GET['option1'])) {
$print = $_GET['option1'];
}
$integerIDs = array_map('intval', explode(',', $print));
$usersIDS = implode(',', $integerIDs);
$requete = "SELECT p.pr_id as id, p.pr_nom as nom, p.pr_poids as poids, p.pr_ingredients as ingredients, p.pr_description as description, p.pr_valeurs_energetiques as valeurs_energetiques, p.pr_valeurs_nutritionnelles as valeurs_nutritionnelles, c.ca_nom as categorie, sc.sc_nom as sous_categorie, p.pr_enligne as enligne FROM produit p,categorie c,sous_categorie sc WHERE p.pr_id_categorie=c.ca_id AND p.pr_id_sous_categorie=sc.sc_id AND p.pr_id IN ({$usersIDS}) ORDER BY pr_ordre";
$resultat = mysql_query($requete);
$num_rows = mysql_num_rows($resultat);
mysql_query("SET NAMES 'utf8'");
?>
<!DOCTYPE html>
<html>
<head lang="fr">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<script src="js/jquery-1.10.2.js"></script>
<script src="js/bootstrap.min.js"></script>
<style>
body {
font-size: small;
}
.lewa {
float: left;
}
</style>
</head>
<body onload="window.print()">
<!--<body>-->
<div class="container">
<div class="row">
<!--right-->
<div class="col-md-12">
<?php
if($num_rows > 0) {
/*
Start with variables to help with row creation;
*/
$startRow = true;
$postCounter = 0;
$idCheck = 0;
while($num_rows > 0){
$ligne = mysql_fetch_assoc($resultat);
if ($startRow) {
echo '<div class="row">';
echo "<img class='logoPuricard' src='./images/logo.jpg' >";
echo '<div class="col-sm-12">';
echo "<!-- TEST 6 kolumn -->";
echo "<div class='row'>";
$startRow = false;
}
$postCounter += 1;
?>
<?php
$id = $ligne["id"];
$nom = $ligne["nom"];
$poids = $ligne["poids"];
$ingredients = $ligne['ingredients'];
$description = $ligne['description'];
$valeurs_energetiques = $ligne['valeurs_energetiques'];
$valeurs_nutritionnelles = $ligne['valeurs_nutritionnelles'];
?>
<div class="col-sm-3" style="width: 32%" >
<?php if (file_exists('../Assets/produit_'.$id . ".png")) {?>
<img src="../Assets/produit_<?php echo $id; ?>.png" style="width: 8em; float: left" />
<?php } ?>
<?php echo "<p style='font-size: 20px;font-weight: bold;'> " . $nom . "</p><br>
<b>Poids</b>"
. $poids . "
<br><br><br>" . $description
."<!-- DIV Ingrédients START -->
<div style='border: solid 2px #000000;padding: 1.5em;min-width:285px'>
<b style='text-decoration: underline;'>Ingrédients :</b>
<br><br> ". wordwrap($ingredients, 30, "\n", false)
. "</div> <!-- DIV Ingrédients END -->
<div></div>
<br>
<!-- DIV Valeurs énergétiques START -->
<div style='border: solid 2px #000000;padding: 0.5em;min-width:285px'>
<br><b style='text-decoration: underline;'>Valeurs énergétiques :</b><br><br>" . $valeurs_energetiques
. "</div>
<!-- DIV Valeurs énergétiques END -->
<br>"
?>
<!-- Valeurs nutritionnelles START -->
<div style='border: solid 2px #000000;padding: 0em;min-width:285px;'>
<b style='text-decoration: underline;'><br> Valeurs nutritionnelles :</b><br><br>
<div class='tableNutritionneles'>
<?php echo $valeurs_nutritionnelles; ?>
<script type="text/javascript">
var el = document.getElementsByClassName('tableNutritionneles');
window.addEventListener('load', function() {
var td = document.getElementsByClassName("tableNutritionneles");
var nrOfCollumns = td.length;
for(var i = 0; i < nrOfCollumns; i++){
var styles = td[i].getElementsByTagName("table")[0].style;
styles.minWidth = "100%";
styles.maxWidth = "100%";
styles.overflow = "hidden";
styles.textAlign = "center";
}
});
</script>
<!-- Valeurs nutritionnelles END -->
</div>
</div>
<!-- Allergènes START -->
<!-- DIV Allergenes start -->
<div style='border: solid 2px #000000;padding: 1.5em;min-width:285px;margin-top: 10px;'>
<br><p><b style='text-decoration: underline;'>Allergènes :</b></p>
<!--Table alegene start -->
<style>
.logoPuricard {
margin-left: 44%;
width: 12%;
margin-top: 20px;
margin-bottom: 20px;
}
td {
border-collapse: collapse;
border: 1px solid #000000;
/*text-align: center;*/
/*vertical-align: middle;*/
}
.rotate {
font-size: 12px;
/* FF3.5+ */
-moz-transform: rotate(-90.0deg);
/* Opera 10.5 */
-o-transform: rotate(-90.0deg);
/* Saf3.1+, Chrome */
-webkit-transform: rotate(-90.0deg);
/* IE6,IE7 */
filter: progid: DXImageTransform.Microsoft.BasicImage(rotation=0.083);
/* IE8 */
-ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)";
/* Standard */
transform: rotate(-90.0deg);
}
td.alergenneTd {
opacity: 0.6 !important;
color: #FFEBCD !important;
}
.allergenePresent {
}
/*p:nth-of-type(6).*/
.allergeneTextCell {
margin-left: -41px;
}
@media print {
[class*="col-sm-3"] {
float: left;
}
body table td.alergenneTd:first-child{
-webkit-print-color-adjust:exact;
background-color: #33CC33 !important;
}
body table td.alergenneTd:nth-child(2){
-webkit-print-color-adjust:exact;
background-color: #3399FF !important;
}
body table td.alergenneTd:nth-child(3){
-webkit-print-color-adjust:exact;
background-color: #FFCCCC !important;
}
body table td.alergenneTd:nth-child(4){
-webkit-print-color-adjust:exact;
background-color: #003300 !important;
}
body table td.alergenneTd:nth-child(5){
-webkit-print-color-adjust:exact;
background-color: #3399FF !important;
}
body table td.alergenneTd:nth-child(6){
-webkit-print-color-adjust:exact;
background-color: #FF6B24 !important;
font-size: 8px !important;
}
body table td.alergenneTd:nth-child(7){
-webkit-print-color-adjust:exact;
background-color: #492544 !important;
}
body table td.alergenneTd:nth-child(8){
-webkit-print-color-adjust:exact;
background-color: #0080C0 !important;
}
body table td.alergenneTd:nth-child(9){
-webkit-print-color-adjust:exact;
background-color: #ABABD6 !important;
}
body table td.alergenneTd:nth-child(10){
-webkit-print-color-adjust:exact;
background-color: #FF8040 !important;
}
body table td.alergenneTd:nth-child(11){
-webkit-print-color-adjust:exact;
background-color: #000093 !important;
}
body table td.alergenneTd:nth-child(12){
-webkit-print-color-adjust:exact;
background-color: #007D00 !important;
}
body table td.alergenneTd:nth-child(13){
-webkit-print-color-adjust:exact;
background-color: #C0C0C0 !important;
}
body table td.alergenneTd:nth-child(14){
-webkit-print-color-adjust:exact;
background-color: #FFB366 !important;
}
body table td.alergenneTd:nth-child(15){
-webkit-print-color-adjust:exact;
background-color: #FF0CCC !important;
}
/*#allergeneTable {*/
/*padding-bottom: 10cm;*/
/*}*/
.tableNutritionneles {
overflow: hidden;
}
.row {
margin-top: 1cm;
margin-bottom: 6cm;
}
.tableNutritionneles {
margin: 0 auto;
}
.allergenePresent {
color: red !important;
font-size: 15px;
font-weight: bold;
}
/*.alergenneTd:first-child {*/
/*background-color: #0f0f0f;*/
/*}*/
.alergenneTdColors {
border: solid #000000 1px;
}
.logoPuricard {
margin-left: 44%;
width: 12%;
margin-top: 2px;
margin-bottom: 10px;
}
.pRed {
color: red !important;
font-weight: bold;
}
}
@page {
size: A3;
margin-left: -5cm;
margin-right: -5cm;
}
</style>
<table id="allergeneTable" border="0" cellspacing="0" cellpadding="0" width="100%">
<?php
$colors = array("#33CC33","#3399FF","#FFCCCC","#003300","#3399FF","#FF6B24","#492544","#0080C0","#ABABD6","#FF8040","#000093","#007D00","#C0C0C0","#FFB366","#FF0CCC");
$presenceTab = array();
$tracesTab = array();
mysql_query("SET NAMES 'utf8'");
$allergenes = "SELECT a.al_nom as nom,pa.pa_presence as presence,pa.pa_traces as traces FROM allergene a,produit p,produit_allergene pa WHERE pa.pa_id_produit=p.pr_id AND pa.pa_id_allergene=a.al_id and p.pr_id=".$id." ORDER BY a.al_id ASC";
$resultat_all = mysql_query($allergenes);
$colorNumber = 0;
echo '<tr>';
while($ligne_all = mysql_fetch_assoc($resultat_all))
{
$colorNumber++;
$nom = htmlentities(stripslashes($ligne_all["nom"]));
$presence = $ligne_all["presence"];
$traces = $ligne_all["traces"];
/*fill $presenceTab and $tracesTab with results*/
$presenceTab[$colorNumber] = $presence;
$tracesTab[$colorNumber] = $traces;
$fruit = "Fruits à coques";
?>
<td class="alergenneTd" style="background-color: <?php echo $colors[$colorNumber];?>;border: 1px solid #000000; color: #000000" >
<?php
if($colors[$colorNumber] !== "#492544"){?>
<div class='rotate'><p class='allergeneTextCell' style='padding-top: 53px;color: #ffffff;'><?php $nomAll = html_entity_decode($nom); echo $nomAll;?> </p></div>
<?php }elseif($colors[$colorNumber] == "#492544"){?>
<div class='rotate'><p class='allergeneTextCell' style='padding-top: 53px;color: #ffffff;font-size: 8px'><?php $nomAll = html_entity_decode($nom); echo $nomAll;?> </p></div>
<?php } ?>
</td>
<?php
}
echo "</tr>";
?>
<?php
// echo "<tr>";
for($i=0; $i<$colorNumber; $i++){
if($presenceTab[$i]=="y")
{
?>
<td style="padding-left: 4px;" >
<span><font class="pRed" style="color: red; font-weight: bold;text-align: center;vertical-align: middle">P</font></span>
</td>
<?php
}
else if($tracesTab[$i]=="y")
{
?>
<td style="padding-left: 6px;padding-top: 6px">
*
</td>
<?php
}
else
{
?>
<td class="trace_allergene">
</td>
<?php
}
?>
<!-- </tr>-->
<?php
}
?>
<!-- DIV Allergenes end -->
</div>
</table>
<script>
window.addEventListener('load', function() {
var rotates = document.getElementsByClassName('rotate');
for (var i = 0; i < rotates.length; i++) {
rotates[i].style.height = 117 + 'px';
rotates[i].style.width = 17 + 'px';
}
var tds = document.getElementsByClassName('alergenneTd');
});
</script>
<!--Table alegene end -->
<p><span class="allergenePresent">P</span>: Présence</p>
<p>* : Présence possible</p>
</div>
</div>
<?php
if (3 === $postCounter) {
echo ' </div>'; /*END OF ?????*/
echo '</div><!-- END OF INTERNAL ROW -->';
$startRow = true;
$postCounter = 0;
}
--$num_rows;
}/*endWhile*/
if ($postCounter !== 0) {
echo '</div>';
}
}else {
echo '<div class="page-header"><h1>Pas des resultat</h1></div>';
echo ' <p>desole vous n\'avez pas choisir des produits</p>';
}
if (3 === $postCounter || $num_rows == 0) {
echo '</div><!-- END OF INTERNAL ROW -->';
$startRow = true;
$postCounter = 0;
}
?>
</body>
</html>
是否有可能来调整页面以60%
答
有几种可能性。
首先,您可以更改您的Internet Explorer浏览器 的页面设置,去工具 - >打印 - >页面设置。在这里你可以启用 缩小到适合。
另一种方法是将您的网页转换为PDF文件。然后可以打印页面的 PDF文件。
编辑 为了把一个页面上的一个巧克力,巧克力中的类使用下面的CSS代码:
page-break-after:always
非常感谢你的帮助,但即使是使用你的意见,我以后在IE中像在sceenshot中获得相同的结果...我想,但我不能使用PDF文件 – mike
当我试图在一个页面上打印一个项目,第二个项目,我想在另一个页面上打印如何跳过页面1到第2页?请你有一些建议 – mike
好吧,让我们测试一下。在IE中打开这个网页,然后进入**工具 - >打印 - >打印预览**,并告诉我你看到了什么。整页,或只是一半的页面? – Reptar