You are here

interface PdfGeneratorInterface in PDF generator API 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/PdfGeneratorInterface.php \Drupal\pdf_api\Plugin\PdfGeneratorInterface

Defines an interface for PDF generator plugins.

Hierarchy

Expanded class hierarchy of PdfGeneratorInterface

All classes that implement PdfGeneratorInterface

1 file declares its use of PdfGeneratorInterface
MpdfGenerator.php in src/Plugin/PdfGenerator/MpdfGenerator.php
Contains \Drupal\pdf_api\Plugin\MpdfGenerator.

File

src/Plugin/PdfGeneratorInterface.php, line 13
Contains \Drupal\pdf_api\Plugin\PdfGeneratorInterface.

Namespace

Drupal\pdf_api\Plugin
View source
interface PdfGeneratorInterface {

  /**
   * Landscape paper orientation.
   */
  const LANDSCAPE = 'landscape';

  /**
   * Portrait paper orientation.
   */
  const PORTRAIT = 'portrait';

  /**
   * Set the various options for PDF.
   *
   * @param string $pdf_content
   *   The HTML content of PDF.
   * @param string $pdf_location
   *   The location where PDF needs to be saved.
   * @param bool $save_pdf
   *   Stores the configuration whether PDF needs to be saved or shown inline.
   * @param string $paper_orientation
   *   The orientation of PDF pages (portrait or landscape).
   * @param string $paper_size
   *   The size of PDF paper (e.g. A4, B4, Letter).
   * @param string $footer_content
   *   The text to be rendered as footer.
   * @param string $header_content
   *   The text to be rendered as header.
   * @param string $path_to_binary
   *   The path to binary file.
   */
  public function setter($pdf_content, $pdf_location, $save_pdf, $paper_orientation, $paper_size, $footer_content, $header_content, $path_to_binary = '');

  /**
   * Returns the administrative id for this generator plugin.
   *
   * @return string
   *   The id of the plugin.
   */
  public function getId();

  /**
   * Returns the administrative label for this generator plugin.
   *
   * @return string
   *   The label of the plugin.
   */
  public function getLabel();

  /**
   * Returns the administrative description for this generator plugin.
   *
   * @return string
   *   The description about the plugin.
   */
  public function getDescription();

  /**
   * Returns instances of PDF libraries.
   *
   * @return object
   *   The object of PDF generating libraries.
   */
  public function getObject();

  /**
   * Sets the header in the PDF.
   *
   * @param string $html
   *   The text to be rendered as header.
   */
  public function setHeader($html);

  /**
   * Set the paper orientation of the generated PDF pages.
   *
   * @param PdfGeneratorInterface::PORTRAIT|PdfGeneratorInterface::LANDSCAPE $orientation
   *   The orientation of the PDF pages.
   */
  public function setPageOrientation($orientation = PdfGeneratorInterface::PORTRAIT);

  /**
   * Set the page size of the generated PDF pages.
   *
   * @param string $page_size
   *   The page size (e.g. A4, B2, Letter).
   */
  public function setPageSize($page_size);

  /**
   * Add a page to the generated PDF.
   *
   * @param string $html
   *   The HTML of the page to be added.
   */
  public function addPage($html);

  /**
   * Generate and save the PDF at a specific location.
   *
   * @param string $location
   *   The location (both absolute/relative) path to save the generated PDF to.
   */
  public function save($location);

  /**
   * The name of the file to be downloaded.
   */
  public function send();

  /**
   * Stream the PDF to the browser.
   */
  public function stream($filelocation);

  /**
   * Sets the footer in the PDF.
   *
   * @param string $html
   *   The text to be rendered as footer.
   */
  public function setFooter($html);

  /**
   * Get stderr from the command that was run.
   *
   * @param string $string
   *   The output sent to stderr.
   */
  public function getStderr();

  /**
   * Get stdout from the command that was run.
   *
   * @param string $html
   *   The text to be rendered as footer.
   */
  public function getStdout();

  /**
   * Display error messages.
   *
   * @return boolean
   *   Whether any errors occurred and were not ignored.
   */
  public function displayErrors();

}

Members

Namesort descending Modifiers Type Description Overrides
PdfGeneratorInterface::addPage public function Add a page to the generated PDF. 4
PdfGeneratorInterface::displayErrors public function Display error messages. 1
PdfGeneratorInterface::getDescription public function Returns the administrative description for this generator plugin. 1
PdfGeneratorInterface::getId public function Returns the administrative id for this generator plugin. 1
PdfGeneratorInterface::getLabel public function Returns the administrative label for this generator plugin. 1
PdfGeneratorInterface::getObject public function Returns instances of PDF libraries. 4
PdfGeneratorInterface::getStderr public function Get stderr from the command that was run. 1
PdfGeneratorInterface::getStdout public function Get stdout from the command that was run. 1
PdfGeneratorInterface::LANDSCAPE constant Landscape paper orientation.
PdfGeneratorInterface::PORTRAIT constant Portrait paper orientation.
PdfGeneratorInterface::save public function Generate and save the PDF at a specific location. 4
PdfGeneratorInterface::send public function The name of the file to be downloaded. 4
PdfGeneratorInterface::setFooter public function Sets the footer in the PDF. 4
PdfGeneratorInterface::setHeader public function Sets the header in the PDF. 4
PdfGeneratorInterface::setPageOrientation public function Set the paper orientation of the generated PDF pages. 4
PdfGeneratorInterface::setPageSize public function Set the page size of the generated PDF pages. 4
PdfGeneratorInterface::setter public function Set the various options for PDF. 4
PdfGeneratorInterface::stream public function Stream the PDF to the browser. 4