locked
how can i set print only page 1 by default in google chrome RRS feed

  • Question

  • User944339287 posted

    Hi guys... is it possible to write code from code-behind or web page to print only first page by default when i click print in Google Chrome?

    Currently Pages = All by default. TQ

    Tuesday, May 21, 2019 10:22 AM

All replies

  • User475983607 posted

    Hi guys... is it possible to write code from code-behind or web page to print only first page by default when i click print in Google Chrome?

    Currently Pages = All by default. TQ

    No, but you can write JavaScript to populate one page of content and print the one page.  Printing from JavaScript is very common and well documented on the Internet.

    https://www.google.com/search?rlz=1C1GGRV_enUS812US812&ei=KtjjXMfPC4yIggf1lo2oAg&q=JavaScript+window+print&oq=JavaScript+window+print&gs_l=psy-ab.3..0i20i263j0l4j0i20i263j0l4.12743.16939..18537...0.0..0.122.942.11j1......0....1..gws-wiz.......0i71j0i131.1bbLVzUgL74

    Tuesday, May 21, 2019 10:52 AM
  • User753101303 posted

    Hi,

    Full control is usually left to the user for this kind of settings. You could use @media print CSS rules to hide elements you don't want to show when printing (and leave then whatever you want that might fit on a single page).

    Tuesday, May 21, 2019 11:23 AM
  • User944339287 posted
    Yes. But i found that it’s slightly different when print from win7 and win10’s chrome.

    I can square all content in one page in win7’s chrome. but extra page with empty content will appear if i print in win10’s chrome.
    Tuesday, May 21, 2019 11:32 AM
  • User753101303 posted

    This is the same Chrome version on both? Could it be a printer configuration issue such as maybe default margins ? If I find nothing obvious I would try to hide elements on the page until I find which one triggers this 2nd page...

    In short always try to fix the source problem rather than trying to add some code to workaround a problem that shoudn't happen to start with...

    Tuesday, May 21, 2019 11:48 AM
  • User475983607 posted

    Yes. But i found that it’s slightly different when print from win7 and win10’s chrome.

    I can square all content in one page in win7’s chrome. but extra page with empty content will appear if i print in win10’s chrome.

    There is not much forum members can do to help you with this issue.  It is up to you to provide sample code that reproduces this issue.  Then forum members can troubleshoot your code and provide a solution.  Otherwise, you need to troubleshoot.  

    Are you sure this is even an ASP.NET issue?  Perhaps it has to do with local settings.

    Tuesday, May 21, 2019 11:52 AM