Page margin from second page in wkhtmltopdf? - wkhtmltopdf

First page
In my pdf the header on the first page should have no offset. So the margin from the top is zero.
Second and following pages
I want to set a top margin for the second page and the following pages.
So for this i have created header which is hide on first page but after showing header body content get cut.

I have the same problem while putting header and footer.
I just set footer-spacing and header-spacing in the options before generate PDF.
That works fine for me.

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

Joomla main page header length maxmizing

Unable to adjust main page header length of the Joomla template(v 3.9.1). Tried changing the template.jss but failed. Great to know the correct way of adjusting the main page header length.
Below is the current and expected format. As you can see in "As-is" Downloads menu is appearing in the bottom which suppose to be next to "Contact us" in same line.
As is:
To be :

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...

footer-html and footer-right should be shown together - wkhtmltopdf

I want a footer which is defined in the html page and page number in the footer-right.
Footer-html and footer-right both are shown. But footer-right is in invisible font.
Is there anything like, when footer-html is shown, other footer attributes are not taken into consideration?

how to know when page breaks in DOMPDF

I am using DOMPDF library to generate invoices dynamically. My use-case scenario is to leave around 3 inches of space on top of each page. On the first page i created it using a blank div with appropriate height.
Now on second page, it doesn't take the required height from very beginning for obvious reasons. any suggestions?
Instead of spacer divs just set the page margins in css with:
#page { margin-top: 3in; }

Resources