printing

How to apply some styles to first and last elements on a print page?

人盡茶涼 提交于 2019-12-23 09:29:24
问题 I have the following dummy code: <!doctype html> <html> <head> <style> p {font-size: 20px;} </style> </head> <body> <script type="text/javascript"> window.onload = function () { var body = document.getElementsByTagName('body')[0], p = document.createElement('p'), el; p.style.height = '20px'; p.innerText = 'Some Test'; for (var i = 0, len=30; i<len; i++) { el = p.cloneNode(true); body.appendChild(el); } }; </script> </body> </html> It's render some elements and on page preview it looks like

Printing just an iFrame

流过昼夜 提交于 2019-12-23 09:10:04
问题 I'm working on a case resolution system, and am currently using a jquery colorbox to display a list of open tasks to the user. Users want to be able to print this list, and I guess you can do it from within the page itself by adding a JavaScript link that triggers window.print from within the iframe. However, I've also got to account for users possibly selecting print from the browser's menu. In that case, if the colorbox is open, I just want to print its contents and not the overlying page.

How can I use counter-increment to show page numbers on a printed web page?

穿精又带淫゛_ 提交于 2019-12-23 07:57:46
问题 I have the following CSS: @media print { div.question-list-footer { position: fixed; bottom: 0; padding-left: 180px; } div.question-list-footer-center { text-align: center; } @page { counter-reset: page 1} } #pageNumber:after { content: counter(page); } #pageNumber { counter-increment: page; } and the following html on my page: <div class="question-list-footer"> <div class="question-list-footer-center"> <span>Page Number: <span id="pageNumber"></span></span><br/> Date: @firstItem.Date.Value

window print method is not working in ipad chrome browser

天涯浪子 提交于 2019-12-23 07:48:06
问题 I have the following code: <input type="button" value="Print" onclick="window.print(); return false;"> Which works in all browsers but it is doing nothing ( not opening print dialog box ) in ipad chrome browser. How can I solve this problem? However if I do manually print with chrome settings print then its working. 回答1: Multiple questions on SO show (1, 2, 3) that it's currently not possible to print in Chrome for iOS due to Apple's policy on using alternative browser engines. Another

Bootstrap 4 CSS causing Chrome's print “Layout” to disappear

时光总嘲笑我的痴心妄想 提交于 2019-12-23 07:04:26
问题 I want my website users to be able to print pages in either portrait or landscape mode. When printing from Google Chrome using Bootstrap 3.3.7, the Chrome print settings has a Layout option. Simply changing the css/js to 4.0.0, the Chrome print settings no longer has the Layout option. I suspect this has something to do with one of these CSS directives: @page @media 回答1: I was able to fix this by adding this CSS: @page { size: auto; } 来源: https://stackoverflow.com/questions/49018636/bootstrap

How to delete the last 5 lines of a file

半城伤御伤魂 提交于 2019-12-23 06:45:45
问题 I have several commands printing text to a file using perl. During these print commands I have an if statement which should delete the last 5 lines of the file I am currently writing to if the statement is true. The number of lines to delete will always be 5. if ($exists == 0) { print(OUTPUT ???) # this should remove the last 5 lines } 回答1: You can use Tie::File: use Tie::File; tie my @array, 'Tie::File', filename or die $!; if ($exists == 0) { $#array -= 5; } You can use the same array when

How to delete the last 5 lines of a file

北城余情 提交于 2019-12-23 06:45:15
问题 I have several commands printing text to a file using perl. During these print commands I have an if statement which should delete the last 5 lines of the file I am currently writing to if the statement is true. The number of lines to delete will always be 5. if ($exists == 0) { print(OUTPUT ???) # this should remove the last 5 lines } 回答1: You can use Tie::File: use Tie::File; tie my @array, 'Tie::File', filename or die $!; if ($exists == 0) { $#array -= 5; } You can use the same array when

The word “array” prints instead of databse information

风流意气都作罢 提交于 2019-12-23 06:22:18
问题 My code keeps on print the word "array" instead of the database information. When i try to use print_r() or var_dump() it echos all the information about the array this is with var_dump array(1) { ["Team"]=> string(8) "Oakville" } array(1) { ["Team"]=> string(8) "Brampton" } array(1) { ["Team"]=> string(7) "Toronto" } array(1) { ["Team"]=> string(11) "Mississauga" } Here's my code if(isset($_REQUEST['submit2'])){ $leaguename = $_POST['league']; $db_host = '**'; $db_user = '**'; $db_pwd = '**'

Flutter create Chinese character PDF file and print file in printer

一世执手 提交于 2019-12-23 06:06:18
问题 I am trying to develop a Flutter application which can print a document to paper. I am only able to get it to work with English characters. Can someone help to make it work with Chinese please? Here is my main.dart import 'dart:convert'; import 'dart:io'; import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:pdf/pdf.dart'; import 'package:printing/printing.dart'; void main() => runApp(new MaterialApp(home:

Gtk-Python : Is it possible to print a window content and how to do this?

喜夏-厌秋 提交于 2019-12-23 06:04:36
问题 I have a Gtk.Window which contains a Gtk.Grid and Gtk.Labels. I would like to print all of what is displayed on this window. Is it possible to do this and how? I've searched for tutorials but only found one to print pdf files. Here is my print function : def on_print(self, widget): print("*** Print ***") print_op = Gtk.PrintOperation() print_op.set_n_pages(1) print_op.connect("draw_page", self.print_window) res = print_op.run(Gtk.PrintOperationAction.PRINT_DIALOG, None) def print_window(self)