You are here

public function ConvertToPdf::convert in PDF using mPDF 8

Same name and namespace in other branches
  1. 8.2 src/Conversion/ConvertToPdf.php \Drupal\pdf_using_mpdf\Conversion\ConvertToPdf::convert()

Converts HTML to PDF.

Point of call to instantiate the mPDF library and call the generator functions for creating a PDF file.

Parameters

string $html: The html that will be converted into PDF content.

Return value

mixed Generated output or empty.

Overrides ConvertToPdfInterface::convert

File

src/Conversion/ConvertToPdf.php, line 112

Class

ConvertToPdf
Class ConvertToPdf.

Namespace

Drupal\pdf_using_mpdf\Conversion

Code

public function convert($html) {
  $this->settings = $this
    ->getConfigValues();
  if (empty($html)) {
    drupal_get_messages('error');
    drupal_set_message(t('No content. PDF cannot be generated for this path.'), 'error');
    return;
  }
  $this
    ->generator($html);
  $this
    ->showPdf();
}