Print-Pro-Matic: Add PDF to Print Page

The following is an example of how to add a pdf document to be printed along with a target using the new add_print_url attribute.

First, we need a simple target to print:

<div id="print_target">This is the simple print target for the page</div>

Now, we simply add our print-me shortcode and use the add_pdf_url attribute to include a pdf document to be printed:

[print-me target="#print_target" add_pdf_url="" pause_time="3000"/]

Direct PDF Print

As of version 1.2.6 we have introduced a new shortcode to print-pro-matic, just for printing PDFs.Note: the ability to print pdf files from javascript is currently not supported in FireFox. Therefore the PDF will open in a new tab and the user can print from there.

[print-pdf pdf_url=""/]

This will produce a simple button that will print the pdf:

The optional attirbutes for the print-pdf shortcode are as follows:
The ID attribute will assign a custom ID to the button. If no ID is assigned a random id will be assigned.

The title attribute will assign the text of the print button. If no title is assigned, the button will have the tex of: ‘Print PDF’

The class attribute will assign the button a custom class.

The tag attribute will change the trigger element from the default button to, say a div. For example:

[print-pdf pdf_url="url_to_pdf" tag="div"/]

The img_url attribute is used to define the image URL to use as a trigger. Using a trigger image will override standard print trigger, replacing it with the chosen image.

[print-pdf img_url="url_to_trigger_image"/]

Use the width attribute along with the img_url to define the image width.

Use the height attribute along with the img_url to define the image height.

Use the alt attribute along with the img_url to define the image alt value.

Demo of Trigger Image:

[print-pdf img_url="" alt="" width="600" height="447" pdf_url=""]

Full url to redirect the user to after either a) the print dialogue closes or b) the pdf is loaded into a new tab (depending on which browser is being used)

[print-pdf pdf_url="url_to_pdf" redirect_url=""/]

Putting it all Together

Here we will have a trigger image that redirects on print close:

[print-pdf img_url="" alt="" width="600" height="447" pdf_url="" redirect_url="" title="Ninja Power"]

Leave a Reply

Your email address will not be published. Required fields are marked *