내 prestashop에 대한 .pdf 송장을 사용자 정의해야합니다.
문제는 그렇게하기에는 너무 지루하다는 것입니다.
(그동안) 인보이스를 HTML로 출력하고 개발자 도구를 사용하여 요소를 검사 할 수 있기를 바랍니다.
해결 방법이 있습니까? 재정의를 사용하는 것이 가능할 것 같지만 Google에서 아무것도 찾지 못했습니다 ..
classes / pdf / PDF.php의 render 함수를 다음과 같이 재정 의하여 pdf 렌더링 전에 html의 근사치를 얻을 수 있습니다.
public function render($display = true)
{
$render = false;
$this->pdf_renderer->setFontForLang(Context::getContext()->language->iso_code);
foreach ($this->objects as $object) {
$this->pdf_renderer->startPageGroup();
$template = $this->getTemplateObject($object);
if (!$template) {
continue;
}
if (empty($this->filename)) {
$this->filename = $template->getFilename();
if (count($this->objects) > 1) {
$this->filename = $template->getBulkFilename();
}
}
$template->assignHookData($object);
// for previewing html
echo $template->getHeader();
echo $template->getContent();
echo $template->getFooter();
exit;
$this->pdf_renderer->createHeader($template->getHeader());
$this->pdf_renderer->createFooter($template->getFooter());
$this->pdf_renderer->createPagination($template->getPagination());
$this->pdf_renderer->createContent($template->getContent());
$this->pdf_renderer->writePage();
$render = true;
unset($template);
}
if ($render) {
// clean the output buffer
if (ob_get_level() && ob_get_length() > 0) {
ob_clean();
}
return $this->pdf_renderer->render($this->filename, $display);
}
}
머리글, 내용 및 바닥 글에 에코를 추가했습니다. 페이지 매김의 경우 어떻게 작동하는지 잘 모르겠지만 테스트하지 않았습니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다