public function actionPageSvgThumb()
    {
        // $pid = pcntl_fork();
        $settingForm = new SettingForm();
        $photobook_thumb_as_object = $settingForm->getValue('photobook_thumb_as_object', false);
        if ($photobook_thumb_as_object) {
            header('Content-type: image/svg+xml');
        }
        $ref = Yii::$app->request->get('ref');
        $id = Yii::$app->request->get('id');
        $page_index = Yii::$app->request->get('page');
        $this->layout = 'empty';
        if (!empty($ref) && !empty($id)) {
            $user_id = AlphaId::id($ref, true);
            $pb_id = AlphaId::id($id, true);
            $model = new PhotobookForm();
            if ($model->loadById($pb_id)) {
                $styleForm = new StyleForm();
                $style_background_image_base64 = '';
                if ($styleForm->loadById($model->style_id)) {
                    $padded_padded_passepartout_path = UserUrl::stylePaddedPassepartout(false, $styleForm->id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($styleForm->padded_passepartout_key, UserUrl::IMAGE_THUMB);
                    $padded_padded_passepartout_data = file_get_contents($padded_padded_passepartout_path);
                    $type = 'jpg';
                    $style_background_image_base64 = 'data:image/' . $type . ';base64,' . base64_encode($padded_padded_passepartout_data);
                }
                $coverForm = new CoverForm();
                $coverForm->loadById($model->cover_id);
                $padded_cover_image_path = UserUrl::coverPadded(false, $coverForm->id) . DIRECTORY_SEPARATOR . UserUrl::imageFile($coverForm->padded_cover, UserUrl::IMAGE_THUMB, 'png');
                $padded_cover_data = file_get_contents($padded_cover_image_path);
                $type = 'png';
                $padded_cover_base64 = 'data:image/' . $type . ';base64,' . base64_encode($padded_cover_data);
                if (!empty($model->data['pages'][$page_index])) {
                    $page = $model->data['pages'][$page_index];
                    $svg = '<svg version="1.1"
             xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
             x="0" y="0" width="710"  height="260"  preserveAspectRatio="none"
             overflow="visible"  xml:space="preserve" viewBox="0 0 710 260">

    <svg width="100%" height="100%" x="0" y="0" viewBox="0 0 710 260" >

        <image xlink:href="' . $padded_cover_base64 . '" x="0" y="0" height="260px" width="710px"/>

        <image xlink:href="' . $style_background_image_base64 . '" x="5" y="5" height="250px" width="700px"/>
    </svg>





    <svg width="700" height="250" x="5" y="5" viewBox="0 0 700 250">
        ' . str_replace('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">', '', str_replace('<' . '?xml version="1.0" encoding="UTF-8" standalone="no"?' . '>', '', $page['svg_thumb'])) . '
    </svg>
</svg>';
                    if ($photobook_thumb_as_object) {
                        echo $svg;
                    } else {
                        $file_id = md5($svg);
                        $thumb_path = UserUrl::photobookPageThumb(false, $model->id, $model->user_id);
                        //UserUrl::imageFile($file_id, UserUrl::IMAGE_THUMB);
                        $thumb_path_file = $thumb_path . DIRECTORY_SEPARATOR . $file_id . '.jpg';
                        $svg_path_file = $thumb_path . DIRECTORY_SEPARATOR . $file_id . '.svg';
                        $headers = Yii::$app->response->headers;
                        if (file_exists($thumb_path_file)) {
                            $headers->add('Content-type', 'image/jpeg');
                            $headers->add('Cache-Control', "max-age=" . 60 * 60 * 24);
                            $values = $headers->remove('Pragma');
                            // Yii::$app->response->headers=$values;
                            $content = file_get_contents($thumb_path_file);
                            Yii::$app->response->content = $content;
                            //Yii::$app->response->
                            Yii::$app->response->send();
                        } else {
                            $svg = str_replace('fill: transparent;', 'fill-opacity:0;', $svg);
                            $svg = str_replace('fill="transparent"', 'style="fill-opacity:0;"', $svg);
                            $svg = str_replace('<rect/>', '', $svg);
                            file_put_contents($svg_path_file, $svg);
                            $batik_path = Yii::getAlias('@app') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'batik' . DIRECTORY_SEPARATOR;
                            // $cmds[]="java -d64 -Xms512m -Xmx4g -jar ".$batik_path."batik-rasterizer.jar -m image/jpg -w 350 -h 125 -q 0.99 -dpi 72 -d ".$png_path." ".$svg_path;
                            Yii::getLogger()->log('batik:' . "java -d64 -Xms512m -Xmx4g -jar " . $batik_path . "batik-rasterizer-1.8.jar -m image/jpg -w 350 -h 125 -q 0.65 -dpi 72 -d " . $thumb_path . " " . $svg_path_file, YII_DEBUG);
                            exec("java -d64 -Xms512m -Xmx4g -jar " . $batik_path . "batik-rasterizer-1.8.jar -m image/jpg -w 350 -h 125 -q 0.65 -dpi 72 -d " . $thumb_path . " " . $svg_path_file);
                            $headers->add('Content-type', 'image/jpeg');
                            $headers->add('Cache-Control', "max-age=" . 60 * 60 * 24);
                            $values = $headers->remove('Pragma');
                            //Yii::$app->response->headers=$values;
                            $content = file_get_contents($thumb_path_file);
                            Yii::$app->response->content = $content;
                            Yii::$app->response->send();
                        }
                    }
                } else {
                    //throw new \yii\web\HttpException(404, 'Not found', 404);
                }
            } else {
                //throw new \yii\web\HttpException(404, 'Not found', 404);
            }
        } else {
            //throw new \yii\web\HttpException(404, 'Not found', 404);
        }
    }