identifying if pdf content is in the last page

333 views Asked by At

knowing that

<pdf:pagenumber />

gives the current page number, while

<pdf:pagecount />

gives the total page count.

I want to acquire these values and be able to compare it using django if/else like this

{% ifequal "<pdf:pagenumber />"  "<pdf:pagecount />" %}
    last page content
{% endifequal %}

how would I be able to compare these two?

also tried

<pdf:nexttemplate name="lastpage"/>

but it's not appropriate to my dynamic setup if only there is "lasttemplate" though

1

There are 1 answers

0
Tarik On

Can create variable for current page and last page. You can compare later.

{% with CurrentPage="<pdf:pagenumber />" LastPage="<pdf:pagecount />" %}     
    {% if CurrentPage.value == LastPage.value %}
        You are on the last page
    {% endif %}
{% endwith %}