ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCountPDFPagesPreProcessors Class Reference

Class ilCountPDFPagesPreProcessors. More...

+ Inheritance diagram for ilCountPDFPagesPreProcessors:
+ Collaboration diagram for ilCountPDFPagesPreProcessors:

Public Member Functions

 process (FileStream $stream, Metadata $metadata)
 This method gets invoked by the file upload service to process the file with the help of the processor.If the return value is REJECTED, no further invocations of processors are done for the rejected file.If the processor fails or returns an unexpected value, the file gets automatically rejected because the file could be dangerous to ILIAS.
Parameters
FileStream$streamThe stream of the file.
Metadata$metadataThe meta data of the uploaded file.
Returns
ProcessingStatus The new status of the file.
More...
 
 process (FileStream $stream, Metadata $metadata)
 This method gets invoked by the file upload service to process the file with the help of the processor. More...
 

Data Fields

const PAGE_COUNT = 'page_count'
 

Detailed Description

Member Function Documentation

◆ process()

ilCountPDFPagesPreProcessors::process ( FileStream  $stream,
Metadata  $metadata 
)

This method gets invoked by the file upload service to process the file with the help of the processor.If the return value is REJECTED, no further invocations of processors are done for the rejected file.If the processor fails or returns an unexpected value, the file gets automatically rejected because the file could be dangerous to ILIAS.

Parameters
FileStream$streamThe stream of the file.
Metadata$metadataThe meta data of the uploaded file.
Returns
ProcessingStatus The new status of the file.

Implements ILIAS\FileUpload\Processor\PreProcessor.

Definition at line 21 of file class.ilCountPDFPagesPreProcessors.php.

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 }
$metadata['__DYNAMIC:1__']
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
$stream
PHP stream implementation.

References $metadata, GuzzleHttp\Psr7\$stream, ilMimeTypeUtil\APPLICATION__PDF, and ilUtil\execQuoted().

+ Here is the call graph for this function:

Field Documentation

◆ PAGE_COUNT

const ilCountPDFPagesPreProcessors::PAGE_COUNT = 'page_count'

Definition at line 15 of file class.ilCountPDFPagesPreProcessors.php.


The documentation for this class was generated from the following file: