Auto escape html tags while creating pdf from html using xhtml2pdf

414 views Asked by At

I have successfully converted a html page to pdf. Thanks for this cool module. But now problem is....I have a Download link for the generated file in the same html page, which too gets printed... :D

<nav><a href='/static/pdf/xyz.pdf'>Download</a><nav>

Is there a way to escape the anchor tag or anything that can be done to ignore certain html elements.

2

There are 2 answers

3
Kevin London On

It looks like the quotes aren't closed in your example. I bet if you close them, it will resolve the issue.

<a href='/static/pdf/xyz.pdf'>Download</a>
0
beebek On

Here is the Solution...A CSS trick solved it.. :D

<style>
    @media print {
        nav { display: none;}
    }
</style>