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...
Related
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
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
In my application, i need create a document pdf in wkhtmltopdf.
There are more than one pages in my document pdf. I generate dynamicly a file html static for header_html specified to the first page and another header_html specified for the rest of page.
My question is the two headers are not the same height:
How can i get margin_top value dynamicly for each page ?
Thank you for your answers.
If you want make your first page is different from the others pages. you can use cover page like:
wkhtmltopdf -H cover cover.html ...
doc
I have a template which I'm filling with text. There is a header page, and several content pages after the header. Each content pages has two columns, and some logos and things at the bottom. I'm filling in the content dynamically with images and formatted text.
The number of pages is variable. How can I either duplicate content pages as needed, or (if I create a template with many pre-duplicated content pages) delete empty pages after filling in the content?
Well, you can add a page with myDoc.pages.add(...) and then duplicate the content.
To remove pages: myPage.remove().
But the question is somewhat vague, so it's hard to be more specific.
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.