KnpLabs / snappy

PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage

Home Page:https://knplabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HELP! Any option to set different cover page margins.

mohsinalandsterling opened this issue · comments

Is there any way to set the different (from other pages) margin on the cover page?

Something like:

 $pdf_report->setOption('cover-margin-bottom', '0mm');

or

 $pdf_report->setCoverOption('margin-bottom', '0mm');

I'm afraid wkhtmltopdf does not support that.
If I remember correctly it supports global margin options only (see https://wkhtmltopdf.org/usage/wkhtmltopdf.txt).
In order to achieve what you want to do you might have to generate two different PDFs (cover and content) and merge them after with utilities like Ghostscript.

Its mentions in here (https://wkhtmltopdf.org/usage/wkhtmltopdf.txt) in docs.

  cover <input url/file name> [PAGE OPTION]...
  All options that can be specified for a page object can also be specified for
  a cover.

So, it means the margin option should be available as well.

Margins are part of the global options not page options and if I remember correctly you can't assign global options to a specific page.
By the way Snappy doesn't support multiple page options yet, at the moment you can just specify global page options.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.