/**
* Get pdf banner preview for merchant
*
* @service banner read
* @param Gpf_Rpc_Params $params
*/
public function generatePdfFromHtml(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
if ($form->existsField('html')) {
$html = $form->getFieldValue('html');
} else {
throw new Gpf_Exception($this->_("Html data is not defined"));
}
if ($form->existsField('fileName')) {
$fileName = $this->correctFilename($form->getFieldValue('fileName'));
} else {
throw new Gpf_Exception($this->_("File name is not defined"));
}
if ($form->existsField('affiliate')) {
try {
$this->initAffiliate($form->getFieldValue('affiliate'));
} catch (Gpf_DbEngine_NoRowException $e) {
return $this->getFormResponse($this->_('Affiliate is not defined'));
}
}
$html = $this->decodeBanner($html, null, 0);
$html = htmlspecialchars_decode($html);
$this->generatePDF($html);
return new Pap_Common_Banner_PdfGeneratorResponse($fileName, $this->pdf);
}