Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100491120
PhabricatorPDFDocumentEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 31, 05:31
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 2, 05:31 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23979354
Attached To
rPH Phabricator
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
)
{
// Since we just render a link to the document anyway, we don't need to
// check anything fancy in config to see if the MIME type is actually
// viewable.
return
$ref
->
hasAnyMimeType
(
array
(
'application/pdf'
,
));
}
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
;
}
}
Event Timeline
Log In to Comment