ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCountPDFPagesPreProcessors.php
Go to the documentation of this file.
1 <?php
2 
7 
14 {
15  const PAGE_COUNT = 'page_count';
16 
17 
22  {
24  && PATH_TO_GHOSTSCRIPT != ""
25  ) {
26  $PATH_TO_PDF = $stream->getMetadata('uri');
27  $arg = "-q -dNODISPLAY -c \"($PATH_TO_PDF) (r) file runpdfbegin pdfpagecount = quit\";";
28  $return = ilUtil::execQuoted(PATH_TO_GHOSTSCRIPT, $arg);
29 
30  $metadata->additionalMetaData()->put(self::PAGE_COUNT, (string) $return[0]);
31  }
32 
33  return new ProcessingStatus(ProcessingStatus::OK, 'ilCountPDFPagesPreProcessors');
34  }
35 }
process(FileStream $stream, Metadata $metadata)
This method gets invoked by the file upload service to process the file with the help of the processo...
getMimeType()
Client supplied mime type of the uploaded.
Definition: Metadata.php:118
$metadata['__DYNAMIC:1__']
$stream
PHP stream implementation.
additionalMetaData()
Provides a string map implementation which allows the processors to store additional values...
Definition: Metadata.php:149
getMetadata($key=null)
Get stream metadata as an associative array or retrieve a specific key.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
Class ilCountPDFPagesPreProcessors.
Interface FileStream.
Definition: FileStream.php:20