table of contents with reference to page when converting html to pdf

828 Views Asked by At

I'm using html-pdf library to convert html to pdf in nodejs. But I have problem with table of contents, for example: when I click title 1______________ 5 on table of contents, it should auto go to page 5 of pdf file. I tried to add a tag a with href="#id_of_page_5" but not working for now. So please help me with a resolution for this issue.

Example code:

<div class="plan-items-content">
    <h1>Table of Contents</h1>
      <ul>
        <% datas.forEach(function (field) { %>
            <li><a href="#tof<%=field.page%>"><span class="title"><%=field.title%></span><span class="dotline"></span><span class="pagenumber"><%=field.page%></span></a></li>
        <% }) %>
    </ul>
  </div>

and in html-pdf I don't add more any options when creating pdf file.

Thanks in advance

0

There are 0 best solutions below