• Resolved DickHo

    (@dickho)


    Hello,

    This plugin adds a print button on the pages, which is not exactly what we need. We need to print the pages clean, directly with the browser function or keyboard shortcut.
    Any idea of how to get the action of print-o-matic button with browser print function? Is it possible?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    This is exactly how the plugin works.
    See demos at SpaceDonkey test site.
    What are you assigning as the target?
    Can you share a link to your page?

    Thread Starter DickHo

    (@dickho)

    Thanks for quick reply.

    I leave “article” in target.

    The printing output is not the same if I click on the printer button generated from shortcode or if do ctrl+p.

    Sorry the page is currently private.

    What should I change?

    Thanks in advance.
    Kind regards.

    • This reply was modified 6 years, 8 months ago by DickHo.
    Plugin Contributor twinpictures

    (@twinpictures)

    This is because if you hit ctrl+p it will print the entire page.
    if you leave the target at the default article it is going to target the…
    article for printing.

    A shortcode is not needed to trigger the browser’s print function. Use simple HTML and JavaScript like:

    <input type="button" onClick="window.print()" value="Print This Page"/>
    
    Thread Starter DickHo

    (@dickho)

    Sure, but I don’t get only the article, I get everything: navigation, header, etc.

    For example on the website below, if you hit ctrl+p, you get a clean printing. This is what I’m not sure how to obtain with the plugin.

    https://brandlift.ch/example9

    Sorry for stupid question, but where should I add <input type=”button” onClick=”window.print()” value=”Print This Page”/>

    Thanks a lot for your help.

    • This reply was modified 6 years, 8 months ago by DickHo.
    Plugin Contributor twinpictures

    (@twinpictures)

    So not every theme uses the ‘article’ element.
    Are you able to identify the wrapping element you want to print either by class or ID?

    Thread Starter DickHo

    (@dickho)

    Yeah, it’s id=”content-container”

    Once I add this id as target, will the ctrl+p shortcut print only this element?

    Thanks in advance.
    Kind regards.

    Plugin Contributor twinpictures

    (@twinpictures)

    1. then you want to use the following:
    [print-me target="#content-container"/]

    2. no. ctrl+p will always trigger the standard browser print (entire page). no plugin can modify the behaviour of software on the client computer (the browser in this case)

    3. …but, what should happen, if everything is set up correctly is the following when a user clicks on the print icon from our plugin’s shortcode:
    – Open a new window
    – Populate it with the targeted content
    – Trigger the browser’s print-dialogue box
    – Close the document

    Hope that clears things up a bit?

    Thread Starter DickHo

    (@dickho)

    I saw that it is possible on this example: https://brandlift.ch/example9

    Try to hit ctrl-p and the browser will print page without menu and header.

    But maybe I have to do this with css or php modifications.

    Thanks.

    Plugin Contributor twinpictures

    (@twinpictures)

    Achso!
    Yes, that page simply has defined the print-only css to hide elements that should not be printed.

    https://www.smashingmagazine.com/2011/11/how-to-set-up-a-print-style-sheet/
    https://www.smashingmagazine.com/2015/01/designing-for-print-with-css/
    https://stackoverflow.com/questions/3463796/how-to-only-show-certain-parts-with-css-for-print

    Issue marked as resolved, as it’s not related to the plugin.
    Best of luck!

    Thread Starter DickHo

    (@dickho)

    Thank you so much!

    You helped me understand how to fix this.

    Bye ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Printing clean pages, directly with the browser function or keyboard shortcut.’ is closed to new replies.