Home  >  Article  >  Web Front-end  >  The solution to the problem that js calls the printer to print web page fonts is always reduced by one size_javascript skills

The solution to the problem that js calls the printer to print web page fonts is always reduced by one size_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:02:331513browse

Today I want to make a small function to print a web page. I call window.print() directly. However, after printing, the font size is always reduced by one size. I can't find the reason. . .

Later I tried to use an IE print control, but it was a bit disgusting to only support IE, so I had to go back and continue to find the reason

It turned out that the page I wanted to print appeared because of the pop-up layer. This phenomenon can be printed normally if you directly target="_blank" later.

In addition,

Copy the code The code is as follows:

function preview()
{
bdhtml=window.document.body.innerHTML;
sprnstr="";
eprnstr=" and Place it at the beginning and end of the content that needs to be printed, and only the required part will be printed, not the entire page. (I was reading someone else’s blog, hehe)
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn