Multiple headers, How to get different margin_top value for different pages - wkhtmltopdf

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

Related

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

Create as many pages as necessary for dynamic content

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.

ABCpdf AddImageHtml two html in one page

Is it possible to add two html string in one page ?
When the pdf is rendered, I can only see the second html. It seems that the first one is overwritten
The only way I have found that you can do this is to add each HTML to its own document then merge both documents together
theDoc.AddImageUrl(Url1);
theDoc2.AddImageUrl(Url2);
theDoc.Append(theDoc2);

Retrieve the content of a section via MediaWiki API

I have a MediaWiki page set up in my company's intranet.
I would like to get the content of a section in a specific page using MediaWiki API (through AJAX).
I would like to refer to the section by its title like 'General' and refer to the page by its title as well, like 'Licenses'.
Is it possible somehow?
The only thing I could achieve is referring to the page by its title and refer to the section by a number like this:
http://mywiki.local/wiki/api.php?format=xml&action=parse&prop=text&page=Licenses&section=1
But let's say I create a new section before 'General' I would have to update all my AJAX URLs that queries this page. So this isn't good enough.
I couldn't find any working solution for this. Any ideas?
You can do this by first retrieving prop=sections to get the list of sections and their numbers:
http://en.wikipedia.org/w/api.php?format=xml&action=parse&prop=sections&page=License
Then make your original request, with the section number you figured out based on the previous request.
Keep in mind that two different sections can have the same name.

create a simple pdf report from html

I'm looking for a way to generate pdf files from html
In order to make simple tabular reports I would need the following features
table rendering
variable page size
repeating headers / footers on every page
calculated page number / total page
css support would be nice
I know there have been many similar questions in stackoverflow, but I don't know if there's a product that supports the aforementioned features...
Ideally, the source would be a plain and simple well built html with css, (I'm building the html files, so I can adapt to the products needs, that is, it won't have to render every piece of html crap you can throw at a browser) and with some custom tags to configure headings, footer, page size, etc...
then I would run a command line to convert it from html to pdf.
I think http://www.allcolor.org/YaHPConverter/ does something like that
Take a look at TCPDF
Check out the examples.

Resources