Rotativa.AspNetCore page break half of line goes next page - asp.net-core-mvc

I have a very big view which needs to be converted to PDF. I have used Rotativa but it is not properly page breaking, half of the line goes to next page and I don't know where needs to use page break because my view model generate dynamically.

Rotativa is built on top of wkhtmltopdf library, so this means that the same solutions from this post should also be a good for you: Wkhtmltopdf Characters in single line partially cut between pages

Related

How to do page numbering in footer htmls with wkhtmltopdf?

i m using snappypdf and i managed to add an html footer to my file with this code in my Laravel controller:
->setOption('footer-html', view('front.mail_templates.layouts.emailFooter'))->setOption('margin-bottom',17)
but now i want to add page numbering to it, and after looking i found this solution:
->setOption('footer-right', "Page [page] of [toPage]")
The problem is i want these two to appear in my pdf but i can't make them work together they work separately but if together only html footer show and page numbering is invisible , I hovered over an empty space by chance and after copying and pasting it elsewhere, i found out it was the page number printed transparently. so is it possible to make them apear both in my footer? or any other suggestions?
EDIT
here is my footer html code :
every thing worked fine untill i added the javascript code, now it generates the following error : he exit status code '-1073741819' says something went wrong

Set minimal pages count in pdf using flying saucer

Is there any way to set minimal count of pages to pdf? So my current need looks like:
I have an header on second page that should be shown
First page has content that can overflow to second page
It is not acceptable to have 3 pages
So I need 2 pages in both cases:
First page fits to single page (so I should create second page manually)
First page overflows (at create second page by its content)
Single workaround that I found - overflow by empty (<br/>s) content. But I wanna do it with css.
I've tried to use #page:first but it wouldn't work in common css manner (like #page:first .break-page{...})
I've tried to use #page:first {break-page-after:always} - it wouldn't work...

wkhtmltopdf - Even number of pages as output

I'm looking for a way to make sure that the output from wkhtmltopdf always consists of an even number of pages, i.e. adding a blank page at the end of the pdf if the number of pages is uneven. If anyone has a good solutions for this I would be really happy
/J
A simple solution would be to create the pdf, then check the page count and add one empty page with for example itext / itextsharp if necessary. Guessing page counts or lengths is very difficult.

MathJax renders strange in my post-edit page with AJAX post-preview functionality

I have something like the StackOverflow's "Ask Question" page, where a text-box is used to put source markup code and, below, another text-box (non-editable) is used to render a preview of the post/question being typed.
Consider that my application not only lets me use a simple tiny markup language for my posts' content; it also provides me with the possibility to type math in it using MathJax. But the syntax is simple Latex syntax (however this is not the problem, so do not let this thing bother you too much).
The problem
The problem is the following. The page is a little different from the StackOverflow's one because it uses ASP.NET with AJAX in order to call a server-side procedure that performs the markup language translation in HTML (this is my choice, I have the code server-side, there is no implementation in javascript of the markup translation code).
When the asynchronous script runs (every 10 secs), the non-editable text-box is re-filled with the translated markup. The Latex code as well is put there (no translation performed on it) and MathJax script is called everytime the AJAX procedure returns (so the latex code will be rendered after the markup language, this latex rendering happens client-side).
The problem is that, sometimes, rendered math is strange especially considering equation numberings. Numbers do increase every new AJAX call. I guess there must be a way to reset, completely, the status of the MathJax object instantiated in the page or whatever... Is there a way to reset MathJax?
I assume that AJAX here is the problem... Thankyou for your help, hope I was clear.
If you have loaded a configuration file that includes the AMSmath extension, you can use
MathJax.InputJax.TeX.resetEquationNumbers()
to reset the equation numbering and the labels used for \ref and \eqref. If you want to start the numbering at a particular equation number, use
MathJax.InputJax.TeX.resetEquationNumbers(n)
where n is the starting number minus 1 (the default is 0).

FPDI, how to remove automatic page counter

I'm using FPDI together with TCPDF to add a page to a already existing PDF-file. This works great, but I have one problem. When I output the new PDF I get an automatic page counter in the lower right corner, "112/299" for example. I find no documentation in FPDI or TCPDF about this automaticly generated page counter.
This problem only occurs when I put the file through FPDI, which narrows it down to FPDI I suppose.
My question is: How do I remove this god awful page counter in the bottom right corner of every page in my FPDI-generated PDF-file.
Thankful for answers.
I solved it, finally. The thing was, TCPDF puts default headers and footers on every page it generates, you can disable this with;
$object->setPrintHeader(false);
$object->setPrintFooter(false);
The thing was, I use FPDI to concatenate two PDF-files into one. To do this, you have to iterate over every page in both of the files you want to put together, and then finally add all these pages to a new PDF-file and output it.
So the solution was disabling the header and footer in every page sent to the new PDF-file, in the object it self who iterates over this. Just use;
$this->setPrintHeader(false);
$this->setPrintFooter(false);
If you're using PHP of course, otherwise you'll figure it out!

Resources