1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-28 06:29:27 +01:00
phorge-phorge/src/applications/phortune/pdf/PhabricatorPDFFragment.php
epriestley f5c380bfc9 Add very basic support for generating PDF documents
Summary: Ref T13358. This is very minimal, but technically works. The eventual goal is to generate PDF invoices to make my life easier when I have to interact with Enterprise Vendor Procurement.

Test Plan: {F6672439}

Maniphest Tasks: T13358

Differential Revision: https://secure.phabricator.com/D20692
2019-08-01 10:50:24 -07:00

38 lines
628 B
PHP

<?php
abstract class PhabricatorPDFFragment
extends Phobject {
private $rope;
public function getAsBytes() {
$this->rope = new PhutilRope();
$this->writeFragment();
$rope = $this->rope;
$this->rope = null;
return $rope->getAsString();
}
public function hasRefTableEntry() {
return false;
}
abstract protected function writeFragment();
final protected function writeLine($pattern) {
$pattern = $pattern."\n";
$argv = func_get_args();
$argv[0] = $pattern;
$line = call_user_func_array('sprintf', $argv);
$this->rope->append($line);
return $this;
}
}