javascript - 如何从页面打印一部分?
问题描述
我想从打印中删除print_f4.blade.php
的部分:
@extends('_formulaires.f4')
<style>
...
</style>
<div style="display:flex; justify-content:space-between;">
<a class="bu-print" id="" href="/">Retour</a>
<a class="bu-print" id="buPrintF4" href="#" onclick="window.print()">Imprimer le formulaire</a>
</div>
<div style="width: 100%;">
<label for="client">Sélectionner l\'entreprise pour passer à choisir ses plans de formation en bas :</label>
<select name="client" id="client" style="padding: .5rem;">
@foreach ($client as $cl)
<option value="{{$cl->nrc_entrp}}">{{$cl->raisoci}}</option>
@endforeach
</select>
</div>
我要打印 f4.blade.php
的页面脚本:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script src={{ asset('js/jquery.js') }}></script>
</head>
<body>
<style>
...
</style>
<div class="paper" style="padding:.5rem; font-family:Calibri, 'Segoe UI', Geneva, Verdana, sans-serif; background-color: #fff;">
...THE CONTENT TO PRINT
</div>
打印页面按钮(从第一部分开始):Imprimer le formulaire
如何移除第一部分并打印下面的部分?
解决方案
将您的 print_f4 包装在一个名为“hide-from-print”的 div 中,并使用以下 CSS:
//CSS
@media print {
.hide-from-print {
display: none !important;
}
}
推荐阅读
- powershell - 替换 PowerShell 中的字符串:“-”
- android - 替换活动中的片段
- javascript - 窗口位置和innerHtml替换
- java - Jackson 将地图数组反序列化为带有 javax 约束验证的 TreeMap
- ruby-on-rails - .each 遍历空集合 - Ruby on Rails
- javascript - 尝试使用 Promises 和 .then() 从 Firebase 获取 Image-Url
- javascript - 使用 Rails 将插件添加到 Webpack
- node.js - socket.io 中的延迟发射回调
- java - 线程“main”中的异常 java.util.NoSuchElementException 第一次试用
- javascript - Javascript XMLHttpRequest 对预检错误的响应