在你开始向我推荐相关页面之前,让我首先说我已经检查了几乎所有关于这个主题的问题。我有一个表单,我想使用window.priint()函数打印。没什么好看的,只有几页数据。问题是,我不能让它显示超过2个可打印的页面。 (格式化以便于阅读)
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Intake Form</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a routerLink="/dashboard">Dashboard</a></li>
<li class="active"><a routerLink="/intake">Create a New Case File</a></li>
<li><a routerLink="/opencases">Open Cases</a></li>
<li><a routerLink="/closedcases">Closed Cases</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a routerLink="/dashboard">Back to Dashboard</a></li>
<li><a (click)="onLogout()" type="button" class="btn btn-danger">Logout</a></li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</nav>
<header id="header">
<div class="container">
<div class="row">
<div class="col-md-10">
<h1><span class="glyphicon glyphicon-pencil" aria-
hidden="true"></span>Telephonic Intake<small></small></h1>
</div>
<div class="Well">
<h4> % of Open Cases</h4>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
<h4> % of Closed Cases</h4>
<div class="progress">
<div class="progress-bar" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 80%;">
<span class="sr-only">70% Complete</span>
</div>
</div>
</div>
</div>
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">New Process Note</h3>
</div>
<div class="panel-body" id="printSection">
<!--To Add Intake Form Below-->
<div class="container padding-top-10p">
<!--Creating Form Panel-->
<div class="panel panel-default">
<div class="panel-heading">Confidential when Completed</div>
<div class="panel-body"></div>
<!--Form Content-->
<h1>1: Child Abuse Telephonic Intake</h1>
<form (ngSubmit)="onSubmit(f)" #f="ngForm">
<!--Form CSS Styling-->
Name:
<br>
<input type="text" name="Name" ngModel required>
<br>
<br> Time:
<br>
<input type="time" name="Time" ngModel required>
<br>
<br> Call Taken By:
<br>
<input type="text" name="CallTakenBy" ngModel required>
<br>
<br> Referred By:
<br>
<input type="text" name="ReferredBy" ngModel required>
<br>
<br>
<h2>Details of Child(ren)</h2>
<br>
<br> Forename:
<br>
<input type="text" name="ChildName" ngModel required>
<br>
<br> Surname:
<br>
<input type="text" name="ChildSurname" ngModel required>
<br>
<br> Age:
<br>
<input type="text" name="ChildAge" ngModel required>
<br>
<br> Gender:
<br>
<input type="text" name="ChildGender" ngModel required>
<br>
<br> School:
<br>
<input type="text" name="ChildSchool" ngModel required>
<br>
<br> Address:
<br>
<input type="text" name="ChildAddress" ngModel required>
<br>
<br> Telephone Number:
<br>
<input type="text" name="ChildTel" ngModel required>
<br>
<br>
<h2>Details of Parent or Caregiver</h2>
<br>
<br> Name of Parent (Mother):
<br>
<input type="text" name="MotherName" ngModel required>
<br>
<br> Name of Parent (Father):
<br>
<input type="text" name="FatherName" ngModel required>
<br>
<br> Contact Number Home(Mother):
<br>
<input type="number" name="MotherContactHomeTel" ngModel required>
<br>
<br> Contact Number Home(Father):
<br>
<input type="number" name="FatherContactHomeTel" ngModel required>
<br>
<br> Contact Number Work(Mother):
<br>
<input type="number" name="MotherContactWorkTel" ngModel required>
<br>
<br> Contact Number Work(Father):
<br>
<input type="number" name="FatherContactWorkTel" ngModel required>
<br>
<br> Address:
<br>
<input type="text" name="ParentAddress" ngModel required>
<br>
<br>
<h2> Details of Abuse</h2>
<br> Type of Abuse:
<br>
<input type="text" name="TypeOfAbuse" ngModel required>
<br>
<br> Prepetrator:
<br>
<input type="text" name="Perpetrator" ngModel required>
<br>
<br>
<title>Case Details:</title>
<br>
<div class="form-group">
<label for="Case Details">Case Details:</label>
<textarea class="form-control" rows="5" id="Case Details" name="CaseDetails" ngModel required></textarea>
<br>
<br> Worker Referred to:
<br>
<input type="text" name="WorkerReferredTo" ngModel required>
<br>
<br>
<div>
<!--Buttons-->
<div class="form-group">
<button type="button" class="btn btn-primary" onClick="window.print()">Print</button>
<button [disabled]="!f.valid" class="btn btn-primary" type="submit">Submit
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
如果我在codepen.io中粘贴它,它会打印所有内容。 如果我在我的角度应用程序中使用它,它会在第二页之后切断。