Print-O-Matic and WordPress Charts

Here is an example of using Print-O-Matic to print a WordPress Chart using wp-charts

First, the chart:
[wp_charts title=”mypie” type=”pie” animation=”false” align=”alignright” margin=”5px 20px” data=”10,32,50,25,5″]

Now we make a print button:

It seems we need to wrap the chart shortcode in a div so we can target that div and include it’s related javascript.
Still not. maybe we also need to include the chart js on the page?
Nope. It seems the HTML Canvas element is not cloning it’s content that was generated by the javascript… hmmm.

Print-O-Matic Multiple Target Test

This is a test of Print-O-Matic using multiple targets, for example:

This is an element inside of a div with an ID called: targ_id_one
This is a second element that is wrapped in a div with an ID of: targ_id_two

And now for the trigger:

[print-me target="#targ_id_one, #targ_id_two"/]

Ultimate Print-O-Matic Form Elements Test

This is a test for printing various forms using Print-O-Matic and Print-Pro-Matic plugins.

Standard HTML Form



Boy
Girl
Dog


Contact Form 7

Ninja Forms

[ninja_forms id=9]
print me

here is some more text

Ninja Forms with Success Message

[ninja_forms id=2]

Google Form

[wpgform id=’2769′]
Print Google Form

Print-O-Matic External Buttons

this is a test element


As of version 1.6.7c we introduced a new printstyle value ‘external’ for Print-O-Matic. Now it is possible to create an external button to trigger a print in a less-hacky way. Here is an example of this works: To print the following div with an id of ‘print_me_please’:

<div id="print_me_please">This is our target print element</div>

First we create a kind of roll-your-own print trigger. The details that must be included are:

  1. a unique id
  2. a print-o-matic class such as printomatic or printomatictext
  3. a data-print_target attribute

For example:

<button id="my_print_button" class="printomatic" data-print_target="#print_me_please">Print Trigger</button>

Which will output:

The final thing we need to do is include a hidden print trigger using a print-me shortcode with the same id as our external trigger and the new external printstyle attribute. This shortcode must be placed someplace on the same page, and will load in all the required scripts and settings to make the print trigger work correctly.

[print-me id="my_print_button" printstyle="external"/]
This shortcode will not output anything to the page.
That’s it. You are done! Let us know on the WordPress Support Forum if you require any further assistance.

Print-Pro-Matic Inject Logo Before Print Element

This is a quick test to inject a logo at the top of a print-pro-matic page using only css.
In this case, the print element has a class of #post-2182 and it is targeted as normal:

[print-me target="#post-2182"]

However now we add the following css to the Custom Print Page Style in the plugin options page:

#post-2182::before {
   content: url(http://spacedonkey.de/wp-content/uploads/2012/09/ninja_turtles-300x223.jpg);
}

This will place the logo in the ::before pseudo class of the targeted print element. Let’s try it out:

Of course, with Print-Pro-Matic, if you want to add the logo to EVERY print page, you can simply use the Print Page Top HTML field to place any html, including images, in the upper part of the print page.

Keep in mind: When working with images that where not available on the display page (and therefore in the users cache) a bit of pause before print time will be needed to give the image time to load before triggering the print dialogue box.

Wonky Submit & Print-O-Matic Button

This is a Dr. Frankenstein experiment with Contact Form 7’s Submit button and the Print-O-Matic Print button. In theory, when submitting this form, the form should also also force-launch the print dialogue. Years of working in UI tells us NOT do this, but hey, people still have music playing on page load, so what do we know.

[contact-form-7 id="1018" title="SubPrint"/]

To cross-breed the Submit button with the print-o-matic print trigger, use the roll-your-own method as follows:

  1. create a cf7 submit/print button by assigning it a unique ID (in this case subprint) and a class of printomatic.
    [submit id:subprint class:printomatic]

  2. manually insert a hidden input that has the ID of “target-” and a value of the target you wish to print.
    <input type="hidden" id="target-subprint" value=".wpcf7-form" />

  3. be sure the ‘Shortcode Loads Scripts’ checkbox is NOT checked in the plugins options page.

Update: This is no longer supported in the current version of print-o-matic. Here is how to implement this solution with print-pro-matic.

Print-O-Matic Test