use Cubist\Util\Graphics\Image;
use Cubist\PDF\PDFTools;
-class PDFFormPopupLink extends NormalLink {
- public function getDefaultTooltip() {
+class PDFFormPopupLink extends PDFPopupLink
+{
+ protected $_baseURL = 'pdfform';
+
+ public function getDefaultTooltip()
+ {
return 'click to fill the form';
}
- /**
- * @throws \Exception
- */
- public function getURL() {
- $this->compiler->addPDFJS(true);
- $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to);
- $this->compiler->config->set('pdfLinks.' . $this->uid, ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs]);
- $this->copyExternalFile($this->to);
- return '#/pdfform/' . $this->uid;
+ protected function _getPDFInfos()
+ {
+ $res = parent::_getPDFInfos();
+ $res['recipient'] = $this->target;
+ $res['name'] = $this->name;
+
+ return $res;
}
}
use Cubist\Util\Graphics\Image;
use Cubist\PDF\PDFTools;
-class PDFPopupLink extends NormalLink {
- public function getDefaultTooltip() {
+class PDFPopupLink extends NormalLink
+{
+ protected $_baseURL='pdf';
+ public function getDefaultTooltip()
+ {
return 'click to open the document';
}
/**
* @throws \Exception
*/
- public function getURL() {
+ public function getURL()
+ {
$this->compiler->addPDFJS(true);
- $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to);
- $this->compiler->config->set('pdfLinks.' . $this->uid, ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs]);
+ $this->compiler->config->set('pdfLinks.' . $this->uid, $this->_getPDFInfos());
$this->copyExternalFile($this->to);
- return '#/pdf/' . $this->uid;
+ return '#/'.$this->_baseURL.'/' . $this->uid;
+ }
+
+ protected function _getPDFInfos()
+ {
+ $dim = PDFTools::getDimensions($this->compiler->getWorkingDir() . $this->to);
+ return ['width' => $dim['size'][0], 'height' => $dim['size'][1], 'totalHeight' => $dim['totalHeight'], 'file' => $this->to, 'interface' => $this->pdfjs];
}
}