当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::getWeb2PrintConfig方法代码示例

本文整理汇总了PHP中Pimcore\Config::getWeb2PrintConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getWeb2PrintConfig方法的具体用法?PHP Config::getWeb2PrintConfig怎么用?PHP Config::getWeb2PrintConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pimcore\Config的用法示例。


在下文中一共展示了Config::getWeb2PrintConfig方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInstance

 /**
  * @return PdfReactor8|WkHtmlToPdf
  * @throws \Exception
  */
 public static function getInstance()
 {
     $config = Config::getWeb2PrintConfig();
     if ($config->generalTool == "pdfreactor") {
         return new PdfReactor8();
     } elseif ($config->generalTool == "wkhtmltopdf") {
         return new WkHtmlToPdf();
     } else {
         throw new \Exception("Invalid Configuation - " . $config->generalTool);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:15,代码来源:Processor.php

示例2: getProcessingOptions

 public function getProcessingOptions()
 {
     include_once 'Pimcore/Web2Print/Processor/api/v' . Config::getWeb2PrintConfig()->get('pdfreactorVersion', '8.0') . '/PDFreactor.class.php';
     $options = [];
     $options[] = ["name" => "author", "type" => "text", "default" => ""];
     $options[] = ["name" => "title", "type" => "text", "default" => ""];
     $options[] = ["name" => "printermarks", "type" => "bool", "default" => ""];
     $options[] = ["name" => "links", "type" => "bool", "default" => true];
     $options[] = ["name" => "bookmarks", "type" => "bool", "default" => true];
     $options[] = ["name" => "tags", "type" => "bool", "default" => true];
     $options[] = ["name" => "javaScriptMode", "type" => "select", "values" => [\JavaScriptMode::ENABLED, \JavaScriptMode::DISABLED, \JavaScriptMode::ENABLED_NO_LAYOUT], "default" => \JavaScriptMode::ENABLED];
     $options[] = ["name" => "viewerPreference", "type" => "select", "values" => [\ViewerPreferences::PAGE_LAYOUT_SINGLE_PAGE, \ViewerPreferences::PAGE_LAYOUT_TWO_COLUMN_LEFT, \ViewerPreferences::PAGE_LAYOUT_TWO_COLUMN_RIGHT], "default" => \ViewerPreferences::PAGE_LAYOUT_SINGLE_PAGE];
     $options[] = ["name" => "colorspace", "type" => "select", "values" => [\ColorSpace::CMYK, \ColorSpace::RGB], "default" => \ColorSpace::CMYK];
     $options[] = ["name" => "encryption", "type" => "select", "values" => [\Encryption::NONE, \Encryption::TYPE_40, \Encryption::TYPE_128], "default" => \Encryption::NONE];
     $options[] = ["name" => "loglevel", "type" => "select", "values" => [\LogLevel::FATAL, \LogLevel::WARN, \LogLevel::INFO, \LogLevel::DEBUG, \LogLevel::PERFORMANCE], "default" => \LogLevel::FATAL];
     return $options;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:17,代码来源:PdfReactor8.php

示例3: saveAction

 public function saveAction()
 {
     if ($this->getParam("id")) {
         $page = Document\Printpage::getById($this->getParam("id"));
         $page = $this->getLatestVersion($page);
         $page->setUserModification($this->getUser()->getId());
         // save to session
         $key = "document_" . $this->getParam("id");
         $session = new \Zend_Session_Namespace("pimcore_documents");
         $session->{$key} = $page;
         if ($this->getParam("task") == "unpublish") {
             $page->setPublished(false);
         }
         if ($this->getParam("task") == "publish") {
             $page->setPublished(true);
         }
         // only save when publish or unpublish
         if ($this->getParam("task") == "publish" && $page->isAllowed("publish") or $this->getParam("task") == "unpublish" && $page->isAllowed("unpublish")) {
             //check, if to cleanup existing elements of document
             $config = Config::getWeb2PrintConfig();
             if ($config->generalDocumentSaveMode == "cleanup") {
                 $page->setElements([]);
             }
             $this->setValuesToDocument($page);
             try {
                 $page->save();
                 $this->_helper->json(["success" => true]);
             } catch (\Exception $e) {
                 Logger::err($e);
                 $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
             }
         } else {
             if ($page->isAllowed("save")) {
                 $this->setValuesToDocument($page);
                 try {
                     $page->saveVersion();
                     $this->_helper->json(["success" => true]);
                 } catch (\Exception $e) {
                     Logger::err($e);
                     $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
                 }
             }
         }
     }
     $this->_helper->json(false);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:46,代码来源:Printpage.php

示例4: buildPdf

 protected function buildPdf(Document\PrintAbstract $document, $config)
 {
     $web2PrintConfig = Config::getWeb2PrintConfig();
     $params = [];
     $params['printermarks'] = $config->printermarks == "true";
     $params['screenResolutionImages'] = $config->screenResolutionImages == "true";
     $this->updateStatus($document->getId(), 10, "start_html_rendering");
     $html = $document->renderDocument($params);
     $this->updateStatus($document->getId(), 40, "finished_html_rendering");
     $filePath = PIMCORE_TEMPORARY_DIRECTORY . DIRECTORY_SEPARATOR . "pdf-reactor-input-" . $document->getId() . ".html";
     file_put_contents($filePath, $html);
     $html = null;
     $this->updateStatus($document->getId(), 45, "saved_html_file");
     ini_set("default_socket_timeout", 3000);
     ini_set('max_input_time', -1);
     include_once 'Pimcore/Web2Print/Processor/api/PDFreactor.class.php';
     $port = (string) $web2PrintConfig->pdfreactorServerPort ? (string) $web2PrintConfig->pdfreactorServerPort : "9423";
     $pdfreactor = new \PDFreactor("http://" . $web2PrintConfig->pdfreactorServer . ":" . $port . "/service/rest");
     $filePath = str_replace(PIMCORE_DOCUMENT_ROOT, "", $filePath);
     $reactorConfig = ["document" => (string) $web2PrintConfig->pdfreactorBaseUrl . $filePath, "baseURL" => (string) $web2PrintConfig->pdfreactorBaseUrl, "author" => $config->author ? $config->author : "", "title" => $config->title ? $config->title : "", "addLinks" => $config->links == "true", "addBookmarks" => $config->bookmarks == "true", "javaScriptMode" => $config->javaScriptMode, "viewerPreferences" => [$config->viewerPreference], "defaultColorSpace" => $config->colorspace, "encryption" => $config->encryption, "addTags" => $config->tags == "true", "logLevel" => $config->loglevel];
     if (trim($web2PrintConfig->pdfreactorLicence)) {
         $reactorConfig["licenseKey"] = trim($web2PrintConfig->pdfreactorLicence);
     }
     try {
         $progress = new \stdClass();
         $progress->finished = false;
         $processId = $pdfreactor->convertAsync($reactorConfig);
         while (!$progress->finished) {
             $progress = $pdfreactor->getProgress($processId);
             $this->updateStatus($document->getId(), 50 + $progress->progress / 2, "pdf_conversion");
             \Logger::info("PDF converting progress: " . $progress->progress . "%");
             sleep(2);
         }
         $this->updateStatus($document->getId(), 100, "saving_pdf_document");
         $result = $pdfreactor->getDocument($processId);
         $pdf = base64_decode($result->document);
     } catch (\Exception $e) {
         \Logger::error($e);
         $document->setLastGenerateMessage($e->getMessage());
         throw new \Exception("Error during REST-Request:" . $e->getMessage());
     }
     $document->setLastGenerateMessage("");
     return $pdf;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:44,代码来源:PdfReactor8.php

示例5: getWeb2printAction

 public function getWeb2printAction()
 {
     $this->checkPermission("web2print_settings");
     $values = Config::getWeb2PrintConfig();
     $valueArray = $values->toArray();
     $optionsString = [];
     if ($valueArray['wkhtml2pdfOptions']) {
         foreach ($valueArray['wkhtml2pdfOptions'] as $key => $value) {
             $tmpStr = "--" . $key;
             if ($value !== null && $value !== "") {
                 $tmpStr .= " " . $value;
             }
             $optionsString[] = $tmpStr;
         }
     }
     $valueArray['wkhtml2pdfOptions'] = implode("\n", $optionsString);
     $response = ["values" => $valueArray];
     $this->_helper->json($response);
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:19,代码来源:SettingsController.php

示例6: getTempFileUrl

 public static function getTempFileUrl()
 {
     $web2printConfig = Config::getWeb2PrintConfig();
     if ($web2printConfig->wkhtml2pdfHostname) {
         return $web2printConfig->wkhtml2pdfHostname . "/website/var/tmp/";
     } elseif (\Pimcore\Config::getSystemConfig()->general->domain) {
         $hostname = \Pimcore\Config::getSystemConfig()->general->domain;
     } else {
         $hostname = $_SERVER["HTTP_HOST"];
     }
     $protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
     return $protocol . "://" . $hostname . "/website/var/tmp/";
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:13,代码来源:WkHtmlToPdf.php


注:本文中的Pimcore\Config::getWeb2PrintConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。