Save as Image WordPress Plugin

The plugin adds the "Save as Image" button to your WordPress web site. The button allows to save a web page as an image or send it by email in one click.

Installation

  • You can install the plugin using one of the following options:
  • Activate the plugin in the dashboard.

You can also directly use our HTML to Image API for PHP which offers greater control over conversion.

License

The plugin runs in a demo mode by default, you do not need to register to try it out. The demo mode is fully functional, it just adds a watermark to the output image.

If you want to remove the watermark, you can purchase our API license.

A single API license can be used for both our plugins on multiple WordPress web sites. The API license also allows you to use our Conversion API directly.

How to Use

There are three ways to add the button to your web site.

Automatic

The button is added to your pages automatically after the plugin is installed. The Appearance tab in the plugin settings allows you to select the pages to which you want to add the button.

Shortcode

The button can be added to your pages with a plain or block shortcode.

  • [save_as_image_pdfcrowd] - Saves the entire web page as Image.
  • [block_save_as_image_pdfcrowd] - Saves the enclosed code block as Image.

The examples below show how to use the shortcodes and override the defaults set in the plugin settings.

<h3>Save the print version of the page</h3>

The button is put in the middle
[save_as_image_pdfcrowd \
    use_print_media=1 \
    output_format='png' \
    output_name='inline.png' \
    button_text='Save printable version to PNG']
of this sentence.


<h3>Save the screen version of the page</h3>

[save_as_image_pdfcrowd \
    use_print_media=0 \
    output_name='browser.png' \
    button_text='Save browser page to PNG' ]


<h3>Save only a code block</h3>

[block_save_as_image_pdfcrowd \
    output_name='just_div.png' \
    button_text='Save just a part of the page' \
    screenshot_width='800' \
    button_background_color='green' \
    button_alignment='left']
<style>
 .invoice {
     font-size: 150%;
 }
</style>
<div class="invoice">
 Save this div and its descendants only.
</div>
[/block_save_as_image_pdfcrowd]


<h3>Convert any web page</h3>

[save_as_image_pdfcrowd \
    url='https://wikipedia.org' \
    output_name='wikipedia.png' \
    button_text='Save Wikipedia as PNG']

Function

The conversion button can be added directly from your PHP code with this helper function:

create_save_as_image_pdfcrowd_button($options = array())

The $options argument is an array containing settings which override the defaults set in the plugin settings. An example:

echo create_save_as_image_pdfcrowd_button(array(
         'screenshot_width' => '800',
         'button_text' => 'Save as Image'
));

Footnote

The plugin offers a PHP function that runs a conversion synchronously. This may be useful if your want to initiate a conversion based on an event other than a plugin button click.

pdfcrowd_save_as_image($options = array())

The $options argument is an array containing conversion settings independent of the settings set on the plugin settings page. It must contain at least your Pdfcrowd username and the API key. An example:

<?php
    $output = pdfcrowd_save_as_image(array(
        'username' => '',
        'api_key' => '',
        'output_format' => 'png',
        'screenshot_width' => '800',
        'url' => 'https://www.example.com/'
    ));
    if(!is_wp_error($output)) {
        echo $output;
    }
?>