You are here

private function WkhtmltopdfController::validateArgument in wkhtmltopdf 2.0.x

1 call to WkhtmltopdfController::validateArgument()
WkhtmltopdfController::validateArguments in src/Controller/WkhtmltopdfController.php
Validates the command line arguments are valid

File

src/Controller/WkhtmltopdfController.php, line 232

Class

WkhtmltopdfController
A Controller to generate PDFs and return them as a binary reponse.

Namespace

Drupal\wkhtmltopdf\Controller

Code

private function validateArgument($argument_name, $argument_value) {
  $validArguments = [
    'allow',
    'background',
    'bypass-proxy-for',
    'cache-dir',
    'checkbox-checked-svg',
    'checkbox-svg',
    'collate',
    'cookie',
    'cookie-jar',
    'copies',
    'custom-header',
    'custom-header-propagation',
    'debug-javascript',
    'default-header',
    'disable-dotted-lines',
    'disable-external-links',
    'disable-forms',
    'disable-internal-links',
    'disable-javascript',
    'disable-local-file-access',
    'disable-plugins',
    'disable-smart-shrinking',
    'disable-toc-back-links',
    'disable-toc-links',
    'dpi',
    'dump-default-toc-xsl',
    'dump-outline',
    'enable-external-links',
    'enable-forms',
    'enable-internal-links',
    'enable-javascript',
    'enable-local-file-access',
    'enable-plugins',
    'enable-smart-shrinking',
    'enable-toc-back-links',
    'encoding',
    'exclude-from-outline',
    'extended-help',
    'footer-center',
    'footer-font-name',
    'footer-font-size',
    'footer-html',
    'footer-left',
    'footer-line',
    'footer-right',
    'footer-spacing',
    'grayscale',
    'header-center',
    'header-font-name',
    'header-font-size',
    'header-html',
    'header-left',
    'header-line',
    'header-right',
    'header-spacing',
    'help',
    'htmldoc',
    'image-dpi',
    'image-quality',
    'images',
    'include-in-outline',
    'javascript-delay',
    'keep-relative-links',
    'license',
    'load-error-handling',
    'load-media-error-handling',
    'log-level',
    'lowquality',
    'manpage',
    'margin-bottom',
    'margin-left',
    'margin-right',
    'margin-top',
    'minimum-font-size',
    'no-background',
    'no-collate',
    'no-custom-header-propagation',
    'no-debug-javascript',
    'no-footer-line',
    'no-header-line',
    'no-images',
    'no-outline',
    'no-pdf-compression',
    'no-print-media-type',
    'no-stop-slow-scripts',
    'orientation',
    'outline',
    'outline-depth',
    'page-height',
    'page-offset',
    'page-size',
    'page-width',
    'password',
    'post',
    'post-file',
    'print-media-type',
    'proxy',
    'proxy-hostname-lookup',
    'quiet',
    'radiobutton-checked-svg',
    'radiobutton-svg',
    'read-args-from-stdin',
    'readme',
    'replace',
    'resolve-relative-links',
    'run-script',
    'ssl-crt-path',
    'ssl-key-password',
    'ssl-key-path',
    'stop-slow-scripts',
    'title',
    'toc-header-text',
    'toc-level-indentation',
    'toc-text-size-shrink',
    'top',
    'username',
    'user-style-sheet',
    'use-xserver',
    'version',
    'viewport-size',
    'window-status',
    'xsl-style-sheet',
    'zoom',
  ];
  if (!in_array($argument_name, $validArguments, TRUE)) {
    $this->logger
      ->error('An invalid argument was passed to the wkhtmltopdf binary: %argument_name', [
      '%argument_name' => $argument_name,
    ]);
    throw new HttpException(500, 'An error occurred generating the pdf.');
  }
}