public function createBarcode( $isbn_number ) {

		if ( ! $this->validateIsbnNumber( $isbn_number ) ) {
			\Pressbooks\add_error( __( 'There was a problem creating the barcode: Invalid ISBN number.', 'pressbooks' ) );
			return false;
		}

		$this->isbnNumber = $this->fixIsbnNumber( $isbn_number );

		$ps = \Pressbooks\Utility\create_tmp_file();
		$png = \Pressbooks\Utility\create_tmp_file();

		$this->compile( $ps );
		$this->gs( $ps, $png, $this->dpi );
		$this->crop( $png );

		$old_id = \Pressbooks\Image\attachment_id_from_url( get_option( 'pressbooks_cg_isbn' ) );
		if ( $old_id ) {
			wp_delete_attachment( $old_id, true );
		}

		if ( ! function_exists( 'media_handle_sideload' ) ) {
			require_once( ABSPATH . 'wp-admin/includes/image.php' );
			require_once( ABSPATH . 'wp-admin/includes/file.php' );
			require_once( ABSPATH . 'wp-admin/includes/media.php' );
		}

		$pid = media_handle_sideload(
			[
				'name' => "{$this->isbnNumber}.png",
				'tmp_name' => $png,
			], 0
		);
		if ( is_wp_error( $pid ) ) {
			throw new \Exception(
				$pid->get_error_message()
			);
		}

		$src = wp_get_attachment_url( $pid );

		if ( false === $src ) {
			throw new \Exception( 'No attachment url.' );
		}

		update_option( 'pressbooks_cg_isbn', $src );

		return $src;
	}