3 final class PhabricatorPDFDocumentEngine
4 extends PhabricatorDocumentEngine
{
6 const ENGINEKEY
= 'pdf';
8 public function getViewAsLabel(PhabricatorDocumentRef
$ref) {
9 return pht('View as PDF');
12 protected function getDocumentIconIcon(PhabricatorDocumentRef
$ref) {
13 return 'fa-file-pdf-o';
16 protected function canRenderDocumentType(PhabricatorDocumentRef
$ref) {
17 // Since we just render a link to the document anyway, we don't need to
18 // check anything fancy in config to see if the MIME type is actually
21 return $ref->hasAnyMimeType(
27 protected function newDocumentContent(PhabricatorDocumentRef
$ref) {
28 $viewer = $this->getViewer();
30 $file = $ref->getFile();
32 $source_uri = $file->getViewURI();
34 throw new PhutilMethodNotImplementedException();
37 $name = $ref->getName();
38 $length = $ref->getByteLength();
40 $link = id(new PhabricatorFileLinkView())
43 ->setFileViewURI($source_uri)
44 ->setFileViewable(true)
45 ->setFileSize(phutil_format_bytes($length));
47 $container = phutil_tag(
50 'class' => 'document-engine-pdf',