The answer in the post
https://forum.jsreport.net/topic/1940/how-to-get-current-page-number-in-content-html-page
helped me
No, I can't determine if the final pdf rendered is going to have one o two pages.
I've check every sample and threads in StackOverflow but I'm not able to figure out how to get the number of the page in the view that render the content (and not being header or footer)
Don't not if I'm explaining myself right, my fault.
Hi everyone, again! :)
I'm using a razor view to render PDF, I've enabled header and footer and everything works right but....I need to show a div only if there's more than one page.
In my footer I have the classic 1 of 2 pages but I'm not able to get that value in the main view.
Is it only possible in headers and footers?
Thanks in advance
It works like a charm, thank you very much!
I hope it helps.
I assumed that the 'Observaciones' field should not be cut off as the container div has a 'page-break-inside: avoid', but it is nevertheless cut off.
https://playground.jsreport.net/w/rosunad/e6wdngwm
Thanks
After reading a lot of different topics and forum I'm realized that the problem have to be me.
The issue is simple, I'm trying to avoid a page break in a certain position of my report. There's two possible points when a page break can came up so I've added a div container with a 'page-break-inside: avoid' statement, but you can see next the result:
An this is the code:
report.html
@if (Model.Comission != 0)
{
<div class="fullWidth avoidPageBreak" style="display: flex;">
<div class="contractTitleItem textRight">
<strong>ComisiĆ³n:</strong>
</div>
<div class="contractTextItem textLeft">
<div>@Model.ComissionStr</div>
</div>
</div>
}
<div class="fullWidth avoidPageBreak" style="display: flex; border: 1px solid black">
<div class="contractTitleItem textRight">
<strong>Observaciones:</strong>
</div>
<div class="contractTextItem textLeft">
<div>@Model.FreeText</div>
</div>
</div>
.........
report.css
.avoidPageBreak {
-webkit-column-break-inside: avoid;
-webkit-break-inside: avoid;
page-break-inside: avoid;
break-inside: avoid;
}
Thanks in advance