You are here

public function DompdfGenerator::save in PDF generator API 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/PdfGenerator/DompdfGenerator.php \Drupal\pdf_api\Plugin\PdfGenerator\DompdfGenerator::save()

Generate and save the PDF at a specific location.

Parameters

string $location: The location (both absolute/relative) path to save the generated PDF to.

Overrides PdfGeneratorInterface::save

File

src/Plugin/PdfGenerator/DompdfGenerator.php, line 119
Contains \Drupal\pdf_api\Plugin\DompdfGenerator.

Class

DompdfGenerator
A PDF generator plugin for the dompdf library.

Namespace

Drupal\pdf_api\Plugin\PdfGenerator

Code

public function save($location) {
  $content = $this->generator
    ->output([]);
  file_put_contents($location, $content);
}