Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891497
PhabricatorPDFDocumentEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorPDFDocumentEngine.php
View Options
<?php
final
class
PhabricatorPDFDocumentEngine
extends
PhabricatorDocumentEngine
{
const
ENGINEKEY
=
'pdf'
;
public
function
getViewAsLabel
(
PhabricatorDocumentRef
$ref
)
{
return
pht
(
'View as PDF'
)
;
}
protected
function
getDocumentIconIcon
(
PhabricatorDocumentRef
$ref
)
{
return
'fa-file-pdf-o'
;
}
protected
function
canRenderDocumentType
(
PhabricatorDocumentRef
$ref
)
{
$viewable_types
=
PhabricatorEnv
::
getEnvConfig
(
'files.viewable-mime-types'
)
;
$viewable_types
=
array_keys
(
$viewable_types
)
;
$pdf_types
=
array
(
'application/pdf'
,
)
;
return
$ref
->
hasAnyMimeType
(
$viewable_types
)
&&
$ref
->
hasAnyMimeType
(
$pdf_types
)
;
}
protected
function
newDocumentContent
(
PhabricatorDocumentRef
$ref
)
{
$viewer
=
$this
->
getViewer
(
)
;
$file
=
$ref
->
getFile
(
)
;
if
(
$file
)
{
$source_uri
=
$file
->
getViewURI
(
)
;
}
else
{
throw
new
PhutilMethodNotImplementedException
(
)
;
}
$name
=
$ref
->
getName
(
)
;
$length
=
$ref
->
getByteLength
(
)
;
$link
=
id
(
new
PhabricatorFileLinkView
(
)
)
->
setViewer
(
$viewer
)
->
setFileName
(
$name
)
->
setFileViewURI
(
$source_uri
)
->
setFileViewable
(
true
)
->
setFileSize
(
phutil_format_bytes
(
$length
)
)
;
$container
=
phutil_tag
(
'div'
,
array
(
'class'
=>
'document-engine-pdf'
,
)
,
$link
)
;
return
$container
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 15:17 (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125898
Default Alt Text
PhabricatorPDFDocumentEngine.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment