Ich versuche, ein einfaches Zertifikat zu drucken. Der Text des Zertifikats ist als HTML-Tabelle angelegt. Ich stoße auf ein paar einfache, aber beunruhigende Probleme. 1) Meine CSS-Änderungen in der Tabelle werden vollständig ignoriert, wenn ich versuche, es über Chrome zu drucken. 2) Ich bin nicht in der Lage, einen Weg zu finden, konsequent zu drucken, der Text an den richtigen Stellen zentriert.
3) Ich kann keinen Weg finden, um die gesamte Tabelle zu transformieren und im Hochformat zu drucken.Drucken von Text in einer HTML-Tabelle mit einem Hintergrund
Meine CSS sieht wie folgt aus:
<table class="certContent" style="display: block">
<tbody >
<tr style="width: 800px !important">
<td class="smallText"> Valid From: {{vendor.dStartDate}}</td>
<td> </td>
<td> </td>
<td class="smallText">Valid Till: {{vendor.dEndDate}} </td>
</tr>
<tr>
<td colspan="2"> </td>
<td colspan="2"> </td>
</tr>
<tr>
<th colspan="4"> {{vendor.sBusinessnameLegal}}</th>
</tr>
<tr>
<th colspan="2">{{vendor.iSic1}}</th>
<th colspan="2">{{vendor.iSic2}}</th>
</tr>
<tr>
<td colspan="2">{{vendor.iSic3}}</td>
<td colspan="2">{{vendor.iSic4}}</td>
</tr>
<tr>
<td colspan="4"> </td>
</tr>
</tbody>
</table>
No Dice:
@media print {
/* show cover in print */
.cover {
display: block;
}
.dvCertWrapper {
}
.cert {
width: 1080px!important;
content: url('../Content/images/certificate.jpg');
margin-left: -210px;
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
.certContent {
display: block;
margin-top: -680px;
/*margin-left: 60px;*/
width: 100%;
text-align: center;
}
.startDate {
display: block;
font-family: "Century Schoolbook" !important;
font-size: 20px;
font-style: normal;
margin-top: -170px;
margin-left: -102px;
position: absolute;
}
.endDate {
display: block;
font-family: "Century Schoolbook" !important;
font-size: 20px;
font-style: normal;
margin-top: -10px;
margin-right: -60px;
position: absolute;
}
/* hide other elements in print */
button {
display: none;
}
.smallText {
font-size: .8em;
width: 800px;
}
table {
border-collapse: collapse;
width: 1800px;
}
}
My Table Def sieht wie folgt aus. Vorher habe ich folgendes versucht:
<style>
html,
body {
height: 100%;
margin: 0;
}
.cover {
/* hidden cover */
display: none;
height: 100%;
width: 100%;
}
/* fills entire sheet of paper */
.cert {
display: block;
height: 974px;
width: 1366px;
background-image: url('../Content/images/certificate.jpg');
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
/* only apply when printing */
@media print {
/* show cover in print */
.cover {
display: block;
}
.cert {
width: 800px;
content: url('../Content/images/certificate.jpg');
margin-left: -160px;
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
.certContent {
display: block;
font-family: "Century Schoolbook" !important;
font-size: 40px;
font-style: normal;
margin-top: -800px;
margin-left: 60px;
}
.leftDate {
display: block;
font-family: "Century Schoolbook" !important;
font-size: 40px;
font-style: normal;
margin-top: -10px;
margin-left: -60px;
}
/* hide other elements in print */
button {
display: none;
}
}
</style>
<button onclick="window.print()">print</button>
<div class="cover">COVERLETTER</div>
<div>
<div class="cert"></div>
<div class="certContent">My Business</div>
<div class="leftDate">01/01/1979</div>
</div>
Noch nicht mal nah dran.
Mein Hintergrundbild ist Größe, 834 x 595 Pixel und ich versuche, in einem legalen Papier zu drucken.
Mein fertiges Bild sollte so aussehen. (Ich entschuldige mich für diese Grafik, ich bin kein Designer, nur in ein Wohltätigkeitsprojekt geworfen).
Die roten Kästen zeigen, wie ich möchte Serverdaten angezeigt werden soll. Alle Ideen oder Hinweise werden sehr geschätzt. Danke ...