• Resolved rwdrummond

    (@rwdrummondcoxnet)


    Using the free version of print-o-matic I’d like to use an HTML button to print. Is this possible? From reading in the support forum, I tried this:

    <button id="subprint" class="printomatictext" data-print_target="article" >Print</button>
    <input id="target-subprint" type="hidden" value="#main-content">

    That does open the print “preview” window, but there are two problems: it doesn’t recognize the “custom print page style” I defined in settings, and it doesn’t open the print dialog. Am I close?

    Thanks for your assistance!

    https://wordpress.org/plugins/print-o-matic/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Baden

    (@baden03)

    OK, so what you will need to do is a bit of a hack solution, but it should work.
    If you are able to define your button with the data-print_target attribute, you will not need the hidden input element, so yank that part out:

    <button id="subprint" class="printomatictext" data-print_target="article">Print</button>

    This should target the article element… if you wanted to target the main-content element, then you would have to modify the data-print_target attribute as follows:

    <button id="subprint" class="printomatictext" data-print_target="#main-content">Print</button>

    Update: We decided to add a new feature to the plugin that allows you to do this is a much less hacky way. Here is a complete step-by-step demo on how to create Print-O-Matic External Buttons. You will also want to download the latest release candidate of the Print-O-Matic from GitHub.

    Let us know if you require further assistance!

    Thread Starter rwdrummond

    (@rwdrummondcoxnet)

    Well, that is just awesome! Works perfectly. Thank you so very much. I really appreciate the ability to set the print target to “article” or to a particular element.

    In my case, I will mostly be using “argument” so I’ll need to “noprint” the button itself.

    Again, thanks so much.

    Plugin Author Baden

    (@baden03)

    excellent. we’ll include this with our next update.

    if you are happy with the plugin or it’s support, please consider leaving a review to helps others make informed decisions.

    Issue marked as resolved.

    Hi
    I am using this plugin with contact form 7. i have done fields not to print but want to know how hide labels of that which are not printing.

    http://upssg.in/application/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Print from HTML button’ is closed to new replies.