spipu/html2pdf

The html tag [figure] is not known by Html2Pdf. You can create it and push it on the Html2Pdf GitHub project.

Opened this issue · 1 comments

djoo commented

Hey guys,

I have a script who generate PDF from WordPress post.
From the last version WordPress include

tags for nothing...
Exemple :

<figure class="wp-block-table"><table><tbody><tr><td>Text.</td></tr><tr><td>Diagnose: Text</td></tr></tbody></table></figure>

When i try to PDF this, i have the error : The html tag [figure] is not known by Html2Pdf. You can create it and push it on the Html2Pdf GitHub project.

So i try to figure out. Creating a tag in /vendor/spipu/html2pdf/src/Tag/Html/Figure.php

<?php
/**
 * Html2Pdf Library - Tag class
 *
 * HTML => PDF converter
 * distributed under the OSL-3.0 License
 *
 * @package   Html2pdf
 * @author    Laurent MINGUET <webmaster@html2pdf.fr>
 * @copyright 2017 Laurent MINGUET
 */
namespace Spipu\Html2Pdf\Tag\Html;

/**
 * Tag Figure
 */
class Figure extends Span
{
    /**
     * @inheritdoc
     */
    public function getName()
    {
        return 'figure';
    }
}

But it still doesn't work.
What can i do to make it works ?
(I don't want to change the behaviour of Wordpress.)

Thanks

I added this

protected function initTags() { return array( new Html\Address(), new Html\B(), new Html\Big(), new Html\Bookmark(), new Html\Cite(), new Html\Del(), new Html\Em(), new Html\Font(), new Html\I(), new Html\Ins(), new Html\Label(), new Html\S(), new Html\Samp(), new Html\Small(), new Html\Span(), new Html\Strong(), new Html\Sub(), new Html\Sup(), new Html\U(), new Html\Figure(), ); }

To the src/Extension/Core/HtmlExtension.php file