Modify web printing Settings Using batch processing notes for IE
Source: Internet
Author: User
I had to adjust the web page margins and remove the header and footer. I checked a lot of information on the Internet and found that IE did not bring these printer settings functions and could not use pure JavaScript settings.
I checked the information on the Internet a few days ago and can delete the header and footer by modifying the Registry. However, I tried it and found that IE was not allowed to directly modify the registry. Two solutions are coming up later: 1) the salesperson uses the "page settings" function of IE to set the print effect based on the settings parameters we provide; 2) We provide a batch processing file, the necessary parameters have been set, and the salesperson only needs to run the batch processing file once.
I chose the second method. I have never written a batch file before, but I heard that it is easy to read some syntax for writing batch files through data query, but this time I used very little syntax, I wrote a simple file, mainly setting the page margin and removing the header and footer. Details Code As follows:
@ Echo off
ECHO is modifying page settings...
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V footer/T REG_SZ/D ""/F
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V Header/T REG_SZ/D ""/F
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V margin_bottom/T REG_SZ/D "0.75"/F
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V margin_left/T REG_SZ/D "0.75"/F
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V margin_right/T REG_SZ/D "0.75"/F
Reg Add "HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ pagesetup"/V margin_top/T REG_SZ/D "0.1"/F
Pause
Echo on
Although the Code is very simple, it took me a morning to finish writing the code. After running the code, the "page settings" in IE does not change the corresponding value in the registry. At first, I didn't use pause, I didn't stop running it, so I didn't know what went wrong. I found the pause statement through the Internet, so I used it, this indicates that "Reg is not an internal or external command or is not runable. Program Or batch processing files ", some information on the Internet has not been resolved, and found that few people ask such questions, later I found that the prompt "×× is not an internal or external command" was prompted when I entered any command in the command line. I found a solution based on this clue for online search, the reason is that when the environment variable is modified, change the path in the environment variable to "% SystemRoot % \ system32; % SystemRoot %; % SystemRoot % \ system32 \ WBEM.
The margin unit set in the registry is not in millimeters. I still don't know what it is. When I set the registry value to 0.75, the IE page value is 19.05mm.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service