Front End - Web Printing Web Printing pixel setting -Jqprint-

 

Jqprint achieve web printing:

(Transfer from: http://www.jq22.com/jquery-info347 )

Introduced jqorint:

<script language="javascript" src="jquery-1.4.4.min.js"></script>
<script language="javascript" src="jquery.jqprint-0.3.js"></script>

JS code:

<script language="javascript">
function  a(){
        $("#ddd").jqprint();
    }
</script>

Html:

<div id="ddd">
    <table>
        <tr>
            <td>test</td>
            <td>test</td>
            <td>test</td>
            <td>test</td>
            <td>test</td>
        </tr>
    </table>
</div>
<input type="button" onclick=" a()" value="打印"/>

Related parameters:

$ ( "# printContainer" ) .jqprint ({ 
     Debug: false , // if it is true you can display the iframe to see the effect (the default iframe height and width are very small, you can then turn up the source code), the default is false 
     importCSS: true , // to true representation of the original introduction of css page, the default is true. (If it is true, will find the first $ ( "link [media = print ]"), if not will go to $ ( "link") in css file) 
     printContainer: to true , // indicate if the original selected object must be included in print (Note: set to false might break your CSS rules). 
     operaSupport: to true // means that if the plug-in must also support the song opera browser, in this case, it provides the establishment of a temporary default print option card is to true. 
});

 

Production of printed pages of A4 paper pixel setting:

(Transfer from: https://www.cnblogs.com/sun-star/p/3934299.html )

A4 size paper is 210mm * 297mm, i.e. 21.0cm * 29.7cm, and the 1 inch = 2.54cm, if the screen resolution is 72 DPI pixels / inch, about the conversion: 1cm equivalent may be presented (72px / 2.54cm) = 28.34px

Here are some of the common resolutions of A4 size in pixels on the screen:

The resolution is 72 pixels / inch when the pixel size of the image of the A4 paper is 595 × 842;

The resolution is 96 pixels / inch when the pixel size of the image of the A4 paper is 794 × 1123; (default)

Resolution is 120 pixels / inch when the pixel size of the image of the A4 paper is 1487 × 2105;

Resolution is 150 pixels / inch when the pixel size of the image of the A4 paper is 1240 × 1754;

Resolution is 300 pixels / inch when the pixel size of the image of the A4 paper is 2480 × 3508;

 

When metric unit of length for conversion and screen resolution, you must use a DPI (Dot Per Inch) index.
After my careful testing, found a Web page to print, the default uses 96dpi, not rumors 72dpi

A4 paper size is 210 × 297mm, by 1 inch = 25.41mm conversion, i.e., 8.264 × 11.688 inch

Therefore, resolution of 96dpi A4 paper is 794 × 1123, which is the pixels we need in the production of the web page.

But the printer can not print borderless, there must be margins, so we must subtract margins in the production of the web page.

The following are the various margins I tested, the corresponding pixel size A4 paper:

Print margin is set to 0mm , the maximum resolution in-page element: 794 × 1123

Print margin is set to 5mm , the maximum resolution in-page element: 756 × 1086

Print margin is set to 19.05mm , the resolution of the maximum in-page element: 649 × 978

Other size, generally 300dpi when standard printing:

Image pixel size A4 paper is 2480 × 3508;

Pixels of the image of A3 paper size is 4960 × 3508;

B3 image pixel size paper is 3248 × 4300;

Image pixel size B4 paper is 3248 × 2150.

 

Guess you like

Origin www.cnblogs.com/clis/p/12431439.html