BP_GOPP_Image_Editor_GS::set_page( int $page = null )

Sets the page to render for the preview.

Description

Parameters

$page

(Optional) Page number to render.

Default value: null

Return

(true|WP_Error) True if set successful; WP_Error on failure.

Source

File: bp-document/classes/class-bp-gopp-image-editor-gs.php

676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
public function set_page( $page = null ) {
    if ( null === $page ) {
        /**
         * Filters the default PDF preview page setting.
         *
         * Applies only during initial editor instantiation, or when set_page() is run
         * manually without the `$page` argument.
         *
         * set_page() has priority over the filter.
         *
         * @since BuddyBoss 1.4.0
         *
         * @param int    $page     The page to render.
         * @param string $filename The PDF file name.
         */
        $page = apply_filters( 'gopp_editor_set_page', $this->default_page, $this->file );
        if ( ( $page = intval( $page ) ) <= 0 ) {
            $page = $this->default_page;
        }
    } else {
        $page = intval( $page );
    }
    if ( $page > 0 ) {
        $this->page = $page;
        return true;
    }
    return new WP_Error( 'invalid_image_page', __( 'Attempted to set PDF preview page to an invalid value.', 'buddyboss' ) );
}

Changelog

Changelog
Version Description
BuddyBoss 1.4.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.