Unwanted `<![CDATA[YII-BLOCK-BODY-BEGIN]]>` in PDF
Closed this issue · 3 comments
tmjoen commented
amici-infotech commented
Hey,
It happens due to craft’s head tag
I got the same support request a month ago. It randomly happens and i am
not able to reproduce it. As a solution, you can try either of given
solution.
Solution 1 would be to replace that data from html
{% set html = '_pdf/_devotionArticlePDF' %}
{% set data %}
{% include html %}
{% endset %}
{% set data = data|replace({
"![CDATA[YII-BLOCK-HEAD]]>" : "",
"<![CDATA[YII-BLOCK-HEAD]]>" : "",
"<![CDATA[YII-BLOCK-BODY-BEGIN]]>" : "",
"<![CDATA[YII-BLOCK-BODY-END]]>" : ""
}) %}
{{ craft.superpdf.html(data, settings) }}
Solution 2 would be to manually add head and comment it
<div style=“display: none;”>{{ head() }}</div>
fermincreative commented
I ran into this as well when using a Twig template for the PDF. Turns out that if you include , and tags that they'll get rendered like in the issue above. Hope this helps!
amici-infotech commented
This issue is now solved in both Craft v3 and v4 pdf plugin. Let me know if it still the case for you. Thanks.