locked
need to write media quereis for different printers RRS feed

  • Question

  • User81789783 posted

    Hello to every one

    i need to write different media queries for different printers settings i.e  different resolution , Can any one suggest me what could be different options . please note down i m using landscapes 

    @page { size: Letter landscape;padding:0px;}

    Also i need to set margin so that it start with beginning .

    Please do let me know if have any question is order to solve issue

    Thursday, August 1, 2019 1:49 PM

All replies

  • User753101303 posted

    Hi,

    Maybe testing https://developer.mozilla.org/en-US/docs/Web/CSS/@media/resolution

    Depending on the exact need you could maybe try other measurement units such as centimeters or inches ?

    Thursday, August 1, 2019 1:56 PM
  • User81789783 posted

    Thanks for instant reply

    well , how can i figure out which printer is attached  ,what its resolution  what is its measuring unite etc etc , then what would be mechanism/strategy  to write code ??

    Thursday, August 1, 2019 2:13 PM
  • User475983607 posted

    well , how can i figure out which printer is attached  ,what its resolution  what is its measuring unite etc etc , then what would be mechanism/strategy  to write code ??

    Browsers not not allow web applications to interact with printers.

    Thursday, August 1, 2019 6:13 PM
  • User753101303 posted

    One step at a time. I meant CSS units: https://www.tutorialspoint.com/css/css_measurement_units

    For now it seems you are trying to define a margin in pixels ? If using mm, cm, in etc... you should be able to get a consistent result without having to care about the printer resolution.

    If printing client side the user is left in control and will choose whatever printer he wants.

    Thursday, August 1, 2019 6:40 PM
  • User-474980206 posted

    you have no access to the printer data. you only control the size of you printed page. see:

    https://www.w3.org/TR/css-page-3/

    Thursday, August 1, 2019 8:17 PM
  • User81789783 posted

    well mgebhard i m using print.js library 

    Friday, August 2, 2019 5:36 AM
  • User753101303 posted

    It is likely best to discuss each problem one after the other or in separate threads.

    Any progress on your initial request. Can you confirm the issue is trying to size elements using pixels ? Have you tried to use units such as mm, cm, in in which case I believe you shouldn't need any more to care about the device resolution ?

    If not start first by explaining what is you final goal so that we can understand why you feel you need to take into account the device resolution (and see if it could be avoided).

    Friday, August 2, 2019 8:01 AM
  • User475983607 posted

    well mgebhard i m using print.js library 

    Well erum, the browser cannot find the attached printer in code or read printer data.

    Friday, August 2, 2019 10:23 AM