Plugin / GS Only PDF Preview

gitlost

Frequently Asked Questions (FAQ)

Install the plugin in the standard way via the ‘Plugins’ menu in WordPress and then activate. To install Ghostscript, see How to install Ghostscript on the official Ghostscript site. For Ubuntu users, there’s a package: sudo apt-get install ghostscript For Windows, there’s an installer available at the Ghostscript download page.
Three plugin-specific filters are available: gopp_editor_set_resolution sets the resolution of the PDF preview. gopp_editor_set_page sets the page to render for the PDF preview. gopp_image_gs_cmd_path short-circuits the determination of the path of the Ghostscript executable on your server. The gopp_editor_set_resolution filter is an analogue of the standard wp_editor_set_quality filter mentioned above, and allows one to override the default resolution of 128 DPI used for the PDF preview. For instance, in your theme’s “functions.php”: function mytheme_gopp_editor_set_resolution( $resolution, $filename ) { return 100; } add_filter( 'gopp_editor_set_resolution', 'mytheme_gopp_editor_set_resolution', 10, 2 ); Similarly the gopp_editor_set_page filter allows one to override the default of rendering the first page: function mytheme_gopp_editor_set_page( $page, $filename ) { return 2; // Render the second page instead. } add_filter( 'gopp_editor_set_page', 'mytheme_gopp_editor_set_page', 10, 2 ); The gopp_image_gs_cmd_path filter is necessary if your Ghostscript installation is in a non-standard location and the plugin fails to determine where it is (if this happens you’ll get a Warning: no Ghostscript! notice on activation): function mytheme_gopp_image_gs_cmd_path( $gs_cmd_path, $is_win ) { return $is_win ? 'D:\\My Ghostscript Location\\bin\\gswin32c.exe' : '/my ghostscript location/gs'; } add_filter( 'gopp_image_gs_cmd_path', 'mytheme_gopp_image_gs_cmd_path', 10, 2 ); The filter can also be used just for performance reasons, especially on Windows servers to save searching the registry and directories. Note that the value of gs_cmd_path is cached as a transient by the plugin for performance reasons, with a lifetime of one day. You can clear it by de-activating and re-activating the plugin, or by manually calling the clear method of the Ghostscript Image Editor: function mytheme_gopp_init() { if ( class_exists( 'GOPP_Image_Editor_GS' ) ) { GOPP_Image_Editor_GS::clear(); } } add_filter( 'init', 'mytheme_gopp_init' ); or for WP-CLI users: wp transient delete gopp_image_gs_cmd_path

Ratings

5
2 reviews

Rating breakdown

Details Information

Version

1.0.7

First Released

19 Jan, 2017

Total Downloads

5,126

Wordpress Version

4.7.0 or higher

Tested up to:

4.8.0

Require PHP Version:

-

Tags

There is no tag found

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.