ILIAS
release_7 Revision v7.30-3-g800a261c036
◀ ilDoc Overview
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
l
m
p
r
s
t
w
+
Functions
_
a
b
c
f
g
h
i
r
s
t
w
+
Variables
$
c
d
e
f
g
h
j
l
m
p
s
t
+
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
+
Data Fields
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
+
Files
File List
+
Globals
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
+
Variables
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Modules
Pages
class.ilCountPDFPagesPreProcessors.php
Go to the documentation of this file.
1
<?php
2
3
use
ILIAS\Filesystem\Stream\FileStream
;
4
use
ILIAS\FileUpload\DTO\Metadata
;
5
use
ILIAS\FileUpload\DTO\ProcessingStatus
;
6
use
ILIAS\FileUpload\Processor\PreProcessor
;
7
13
class
ilCountPDFPagesPreProcessors
implements
PreProcessor
14
{
15
const
PAGE_COUNT
=
'page_count'
;
16
17
21
public
function
process
(
FileStream
$stream,
Metadata
$metadata)
22
{
23
if
($metadata->
getMimeType
() ==
ilMimeTypeUtil::APPLICATION__PDF
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
}
ilCountPDFPagesPreProcessors\process
process(FileStream $stream, Metadata $metadata)
This method gets invoked by the file upload service to process the file with the help of the processo...
Definition:
class.ilCountPDFPagesPreProcessors.php:21
ILIAS\FileUpload\Processor\PreProcessor
Class PreProcessor.
Definition:
PreProcessor.php:22
ILIAS\FileUpload\DTO\ProcessingStatus
Class ProcessingStatus.
Definition:
ProcessingStatus.php:36
ilCountPDFPagesPreProcessors\PAGE_COUNT
const PAGE_COUNT
Definition:
class.ilCountPDFPagesPreProcessors.php:15
ILIAS\FileUpload\DTO\Metadata\getMimeType
getMimeType()
Client supplied mime type of the uploaded.
Definition:
Metadata.php:118
ILIAS\FileUpload\DTO\Metadata\additionalMetaData
additionalMetaData()
Provides a string map implementation which allows the processors to store additional values...
Definition:
Metadata.php:149
ProcessingStatus
ILIAS\FileUpload\DTO\Metadata
Class Metadata.
Definition:
Metadata.php:21
ilUtil\execQuoted
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
Definition:
class.ilUtil.php:3434
Metadata
ilMimeTypeUtil\APPLICATION__PDF
const APPLICATION__PDF
Definition:
class.ilMimeTypeUtil.php:64
FileStream
ilCountPDFPagesPreProcessors
Class ilCountPDFPagesPreProcessors.
Definition:
class.ilCountPDFPagesPreProcessors.php:13
ILIAS\Filesystem\Stream\FileStream
Interface FileStream The base interface for all filesystem streams.
Definition:
FileStream.php:17
PreProcessor
Modules
File
classes
PreProcessors
class.ilCountPDFPagesPreProcessors.php
Generated on Mon Apr 7 2025 21:01:00 for ILIAS by
1.8.13 (using
Doxyfile
)