You are here

interface PdfBuilderInterface in Entity Print 8

Interface for the PDF builder service.

Hierarchy

Expanded class hierarchy of PdfBuilderInterface

All classes that implement PdfBuilderInterface

2 files declare their use of PdfBuilderInterface
EntityPrintController.php in src/Controller/EntityPrintController.php
PdfDownload.php in src/Plugin/Action/PdfDownload.php

File

src/PdfBuilderInterface.php, line 11

Namespace

Drupal\entity_print
View source
interface PdfBuilderInterface {

  /**
   * Render any content entity as a PDF.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The content entity to render.
   * @param \Drupal\entity_print\Plugin\PdfEngineInterface $pdf_engine
   *   The plugin id of the PDF engine to use.
   * @param bool $force_download
   *   (optional) TRUE to try and force the PDF to be downloaded rather than opened.
   * @param bool $use_default_css
   *   (optional) TRUE if you want the default CSS included, otherwise FALSE.
   *
   * @return string
   *   FALSE or the PDF content will be sent to the browser.
   */
  public function getEntityRenderedAsPdf(EntityInterface $entity, PdfEngineInterface $pdf_engine, $force_download = FALSE, $use_default_css = TRUE);

  /**
   * Render any content entity as a PDF.
   *
   * @param array $entities
   *   An array of content entities to render, 1 per page.
   * @param \Drupal\entity_print\Plugin\PdfEngineInterface $pdf_engine
   *   The plugin id of the PDF engine to use.
   * @param bool $force_download
   *   (optional) TRUE to try and force the PDF to be downloaded rather than opened.
   * @param bool $use_default_css
   *   (optional) TRUE if you want the default CSS included, otherwise FALSE.
   *
   * @return string
   *   FALSE or the PDF content will be sent to the browser.
   */
  public function getMultipleEntitiesRenderedAsPdf(array $entities, PdfEngineInterface $pdf_engine, $force_download = FALSE, $use_default_css = TRUE);

  /**
   * Get a HTML version of the entity as used for the PDF rendering.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The content entity to render.
   * @param bool $use_default_css
   *   TRUE if you want the default CSS included, otherwise FALSE.
   * @param bool $optimize_css
   *   TRUE if you the CSS should be compressed otherwise FALSE.
   *
   * @return string
   *   The rendered HTML for this entity, the same as what is used for the PDF.
   */
  public function getEntityRenderedAsHtml(EntityInterface $entity, $use_default_css = TRUE, $optimize_css = TRUE);

}

Members

Namesort descending Modifiers Type Description Overrides
PdfBuilderInterface::getEntityRenderedAsHtml public function Get a HTML version of the entity as used for the PDF rendering. 1
PdfBuilderInterface::getEntityRenderedAsPdf public function Render any content entity as a PDF. 1
PdfBuilderInterface::getMultipleEntitiesRenderedAsPdf public function Render any content entity as a PDF. 1