我是编程的新手,这是我的第一个项目。我试图打印出屏幕截图中显示的信息,这些信息会打印出来。哪个是“Caplugs West”“PN”“QTY”和“B#”。此打印正常打印机和普通纸张尺寸。但我试图将这些信息打印到标签上,当我将其打印到标签时,它打印出整个页面,甚至是它的底部空白部分,没有任何信息。我只想打印信息,就是这样。我不想打印页眉和页脚,我不想打印页面的空白部分。有没有办法做到这一点?
这是我的索引视图模型
@model NavisionStore.WebUI.Models.PrintIndexViewModel
@{
ViewBag.Title = "Bag Labels: Your Print";
}
<h2>Caplugs West</h2>
<table>
<tbody>
@foreach(var line in Model.Print.Lines) {
<tr>
<td>PN: @line.Product.PartName</td>
</tr>
<tr>
<td>QTY: @line.Product.Quantity</td>
</tr>
<tr>
<td>B# @line.Product.BagNumber</td>
</tr>
}
</tbody>
</table>
<p align="center" class="actionButtons noprint">
<a href="@Model.ReturnUrl">Continue shopping</a>
</p>
她是我的Site.css
body {
font-size: .85em;
font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
color: #232323;
background-color: #fff;
}
header, footer, nav, section {
display: block;
}
/* Styles for basic forms
-----------------------------------------------------------*/
fieldset {
border: 1px solid #ddd;
padding: 0 1.4em 1.4em 1.4em;
margin: 0 0 1.5em 0;
}
legend {
font-size: 1.2em;
font-weight: bold;
}
textarea {
min-height: 75px;
}
.editor-label {
margin: 1em 0 0 0;
}
.editor-field {
margin: 0.5em 0 0 0;
}
/* Styles for validation helpers
-----------------------------------------------------------*/
.field-validation-error {
color: #f00;
}
.field-validation-valid {
display: none;
}
.input-validation-error {
border: 1px solid #f00;
background-color: #fee;
}
.validation-summary-errors {
font-weight: bold;
color: #f00;
}
.validation-summary-valid {
display: none;
}
BODY {
font-family: Cambria, Georgia, "Times New Roman"; margin: 0;
}
DIV#header DIV.title, DIV.item H3, DIV.item H4, DIV.pager A {
font: bold 1em "Arial Narrow", "Franklin Gothic Medium", Arial;
}
DIV#header {
background-color: #444;
border-bottom: 2px solid #111;
color: white;
}
DIV#header DIV.title {
font-size: 2em;
padding: .6em;
}
DIV#content {
border-left: 2px solid gray;
margin-left: 9em;
padding: 1em;
}
DIV#categories {
float: left;
width: 8em;
padding: .3em;
}
DIV.item {
border-top: 1px dotted gray;
padding-top: .7em;
margin-bottom: .7em;
}
DIV.item:first-child {
border-top: none;
padding-top: 0;
}
DIV.item H3 {
font-size: 1.3em;
margin: 0 0 .25em 0;
}
DIV.item H4 {
font-size: 1.1em;
margin: .4em 0 0 0;
}
DIV.pager {
text-align: right;
border-top: 2px solid silver;
padding: .5em 0 0 0;
margin-top: 1em;
}
DIV.pager A {
font-size: 1.1em;
color: #666;
text-decoration: none;
padding: 0 .4em 0 .4em;
}
DIV.pager A:hover {
background-color: silver;
}
DIV.pager A.selected {
background-color: #353535;
color: white;
}
/*This styles the left menu pane*/
DIV#categories A {
font: bold 1.1em "Arial Narrow","Franklin Gothic Medium",Arial;
display: block;
text-decoration: none;
padding: .6em;
border-bottom: 1px solid silver;
}
DIV#categories A.selected {
background-color: #666;
color: white;
}
DIV#categories A.hover {
background-color: #CCC;
}
DIV#categories A.selected:hover {
background-color: #666;
}
FORM {
margin: 0;
padding: 0;
}
DIV.item FORM {
float: right;
}
DIV.item INPUT {
color: white;
background-color: #333;
border: 1px solid black;
cursor: pointer;
}
H2 {
margin-top: 0.3em;
}
.actionButtons A, INPUT.actionButtons {
font: .8em Arial;
color: white;
margin: .5em;
text-decoration: none;
padding: .15em 1.5em .2em 1.5em;
background-color: #353535;
border: 1px solid black;
}
@media print {
.noprint {
display: none;
}
}
@media print {
#header, #categories, .actionButtons {
display: none;
}
DIV#content {
border-left: 0;
margin-left: 0;
}
}