Problem Description
Occasionally, I encountered such a problem. I wanted to download and print the attached pdf on a web page. However, I tried many methods but could not download it. When I clicked to print, the result was blank.
Baidu searched for some solutions, but none of them worked. The main solutions are:https://zhuanlan.zhihu.com/p/476673864
Solution
Looking carefully at the loading path of this pdf, I found that it is not stored directly in the server and loaded through the web when used, but is usedpdfreader/viewer.html?file=getpdf2.jsp%3Fp%3D2023%2F2023hj
in this form. The path to read the pdf file from the server is used to load it, using the PDF online reader pdf.js, which mainly uses a viewer.html , implemented pdf online preview method
If you understand this principle, you can start to solve it from this viewer.html. Open the debug console via F12 and press Crtl + F to search for " print”, find the printing-related attributes,
- Delete this attribute, and then use the "Crtl + P" shortcut key to open the print window and check whether the print preview page has content displayed. ,
- If it doesn't work, continue searching for print to find the attribute, and continue deleting it.