TwisterMc / pdfjs-viewer-shortcode

A Wordpress plugin for embedding PDFs using Mozilla's Excellent PDF.js
https://wordpress.org/plugins/pdfjs-viewer-shortcode/
Apache License 2.0
7 stars 5 forks source link

add option display_pdf #25

Open ajoffre opened 1 year ago

ajoffre commented 1 year ago

Hello, For my need, I need to have an option to display only the full screen link . Example of implementation: option: display_pdf (true by default) Thank

ajoffre commented 1 year ago

exemple: filr: pdfjs-viewer-shortcode/inc/shortcode.php

    $incoming_from_post = shortcode_atts(
        array(
            'url'               => plugin_dir_url( __DIR__ ) . '/pdf-loading-error.pdf',
            'viewer_height'     => '800px',
            'viewer_width'      => '100%',
            'fullscreen'        => 'true',
            'fullscreen_text'   => 'View Fullscreen',
            'fullscreen_target' => 'false',
            'download'          => 'true',
            'print'             => 'true',
            'openfile'          => 'false',
            'zoom'              => 'auto',
            'attachment_id'     => '',
            'display_pdf'       => 'true',
        ),

file:pdfjs-viewer-shortcode/inc/embed.php line 86:

 $display_pdf      = pdfjs_validate_zoom( $incoming_from_handler['display_pdf'] );

line 142:

 $iframe_code='';
   if ('true' === $display_pdf){
    $iframe_code = '<div><iframe width="' . $viewer_width . '" height="' . $viewer_height . '" src="' . esc_url( $final_url ) . '" title="Embedded PDF" class="pdfjs-iframe"></iframe></div>';
    }