如何查看发票的 html 而不是 .pdf?

How to view invoice's html instead of .pdf?

我需要为我的 prestashop 定制 .pdf 发票,

问题是太繁琐了:

我想(与此同时)将发票输出为 HTML 并能够使用开发人员工具检查元素..

有什么解决方法吗?我想覆盖是可能的,但我在 google..

中没有找到任何东西

我找到了这个:https://github.com/itext/rups/.
If you want more details we've got a post in Whosebug :
Best tool tool for inspecting PDF files?

您可以通过将 classes/pdf/PDF.php 中的渲染函数重写为:

在 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);
        }
    }

添加了页眉、内容和页脚的回显。对于分页,我不确定它是如何工作的,还没有测试过。