Answer the question
In order to leave comments, you need to log in
How to start Arbitrary PHP code execution in a business process?
Good afternoon!
Tell me, I uploaded the tcpdf library to generate the file (so far in the root of the site) and created the tcpdf.php file, where I registered php for generating the document, the document is being created.
But how can I place it in the business process: "Execution of arbitrary PHP code", so that it would work when starting the BP from the live feed?
Tried in php_interface but doesn't work. Please help with the power supply, I have been working not so long ago and I don’t understand how to do it right, I can’t find it on the Internet either.
Task: using the code to add additional files to a previously downloaded PDF file. picture if the document is approved. (as a resolution)
The code of the PDF generation file itself in the root of the site:
require_once("tcpdf/tcpdf.php");
// Создаем шапку и футер
class MYPDF extends TCPDF {
//Шапка
public function Header() {
// Логотип
$image_file = $_SERVER['DOCUMENT_ROOT'] .'/img/logo.png';
$this->Image($image_file, 10, 10, 15, '', 'PNG', '', 'T', false, 400, '', false, false, 0, false, false, false);
// Шрифт и цвет текста
$this->SetFont('segoeui', '', 8);
$this->SetTextColor(101, 101, 101);
// Контакты
$contacts = 'Здесь будут контакты';
$this->writeHTML($contacts, true, 0, true, 0);
}
// Футер
public function Footer() {
// Устанавливаем отступ от нижнего края страницы
$this->SetY(-15);
// Шрифт и цвет текста
$this->SetFont('segoeui', 'I', 8);
$this->SetTextColor(101, 101, 101);
//Дополнительная информация
$info = '<span style="text-align:center;">Информация актуальна на '.date("d.m.Y").'.</span>';
$this->writeHTML($info, true, 0, true, 0);
// Номер страницы
$this->Cell(0, 10, 'Страница '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M');
}
}
//Если мы использовали класс MYPDF для создания шапки и футера
$pdf = new MYPDF('P', 'mm', 'A4', true, 'UTF-8');
//Если шапка и футер нам не нужны
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8');
//Устанавливаем отступы от края для всех страниц (слева, сверху, справа, снизу)
$pdf->SetMargins(10, 40, 10, 10);
$pdf->AddPage(); // Добавляем страницу
$pdf->SetDrawColor(210, 100, 0); // Установка цвета (RGB)
$pdf->SetTextColor(71, 71, 71); // Установка цвета текста (RGB)
$pdf->Output($_SERVER['DOCUMENT_ROOT'] .'/file.pdf', 'FI'); // Сохранить и вывести в браузер
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question