navjotdhanawat / dynamic-html-pdf

Create dynamic PDF from HTML template using handlebars
MIT License
34 stars 10 forks source link

Any way to add an additional page that loads the same html file that I have used? #1

Open sinisbad123 opened 6 years ago

sinisbad123 commented 6 years ago

I am planning to generate a series of pages using the same html file, hoping you could show me how I can do that using your package. 📦

navjotdhanawat commented 6 years ago

@sinisbad123 I am not getting you, What exactly you want?

Please confirm. Do you want same page multiple time in single pdf?

sinisbad123 commented 6 years ago

@navjotdhanawat yes, exactly. Thank you :)

navjotdhanawat commented 6 years ago

You have to use handlebars loop to iterate it. For eg:

<ul class="people_list">
  {{#each people}}
    <YOUR HTML TEMPLATE>
  {{/each}}
</ul>

You can use Handlebars Syntax to manipulate data as you want. Handlebars

sinisbad123 commented 6 years ago

@navjotdhanawat i'm sorry, what I mean is, I have an HTML file and I want to produce a pdf file with 10 pages. And I want to iterate the HTML file 10 times also..

sinisbad123 commented 6 years ago

payslip (1).pdf This is a perfect example of what I needed to do, I want to loop the HTML file multiple times to produce 10 pages with different data

navjotdhanawat commented 6 years ago

@sinisbad123 Don't iterate whole html file 10 times. Only iterate content of it 10 times using handlebars for loop syntax as shown in above comment and break page after each iteration. Page Break HTML PDF

This will give exact output you want.