Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Different margins for the cover page #3635

Open
andkorsh opened this issue Sep 7, 2017 · 22 comments · May be fixed by #5193
Open

Different margins for the cover page #3635

andkorsh opened this issue Sep 7, 2017 · 22 comments · May be fixed by #5193

Comments

@andkorsh
Copy link

andkorsh commented Sep 7, 2017

Hi wkhtml team!

First of all, thank you for the great product! I don't know how can I thank you enough - this product is really great! Thanks again - you're doing the great job.

My question actually has been asked multiple times at different forums but unfortunately there were no answer for that. And I think it is not possible within the current wkhtml API - probably you guys can advice if there is an ability to at least patch/build the custom version. We really need that..

The thing is that we don't want margin-top and margin-bottom to be applied to the COVER page. That's fine that it is applied to the TOC and to the main pages, but we don't really want it to be applied to the cover page. We'd like to have an ability either to apply different margins for a cover page or not to apply margins for cover page at all.

If it is possible to patch the wkhtml library and build the custom version for us - I'd appreciate your help guys.

The version I'm running is "wkhtmltopdf 0.12.3.2 (with patched qt)".

Thanks,
Andrew K.

@andkorsh andkorsh changed the title Margin for the cover page Different margins for the cover page Sep 7, 2017
@andkorsh
Copy link
Author

andkorsh commented Sep 8, 2017

OK, 1 day and done :)
andkorsh@c09862d

I can make a pull request if needed, please let me know.

Thanks again!

@bitbonk
Copy link

bitbonk commented Sep 25, 2017

I want this feature! 👍

@akerouanton
Copy link
Contributor

@andkorsh You should submit a PR for that :)

@eliiik
Copy link

eliiik commented Oct 23, 2017

I want this, too!

@katesowles
Copy link

PR, please!

@andkorsh
Copy link
Author

@bitbonk @NiR- @eliiik @katesowles here you go #3692 :)

@guicara
Copy link

guicara commented Jan 23, 2018

Thank you for the PR, it will be really great to have this feature

However, it will be really nice to set different margins for any page! Let's take for example a magazine with a cover page, a table of contents and articles in many categories (ordered by categories). I would like to have a kind of "cover" page per category.

  • Cover page *
  • Table of contents
  • Cover page for the category "A" *
  • 1st article of the category A
  • 2nd article of the cateogry A
  • Cover page for the category "B" *
  • 1st article of the category B
  • 2nd article of the cateogry B

(* without any margin to display a full background image)

@hakimio
Copy link

hakimio commented Jan 23, 2018

@guicara good luck implementing your suggestion ;)

@guicara
Copy link

guicara commented Jan 24, 2018

@hakimio Is it really different from the PR request of @andkorsh?

@hakimio
Copy link

hakimio commented Jan 24, 2018

@guicara He just removed top and bottom margins from the cover page. Nothing more.

@PhilterPaper
Copy link

To remove or change margins on an arbitrary interior page would probably better be done with embedded directives (special HTML comments), although I suppose with sufficient pain and suffering you could find a way to specify margins from the command line for a given absolute page number. While you're at it, the ability to control most command line settings (not just margins) would probably be helpful.

With the current code + above PR, if you want "interior covers", perhaps you could build a series of documents, each with its own cover, and then use a separate utility to merge all the PDFs into one document. You would probably want to control the printed page numbering when you do that, so that it's continuous and not starting over each time.

@guicara
Copy link

guicara commented Jan 24, 2018

Thank you for your reply @PhilterPaper.

To remove or change margins on an arbitrary interior page would probably better be done with embedded directives (special HTML comments)

👍

(...) if you want "interior covers", perhaps you could build a series of documents, each with its own cover, and then use a separate utility to merge all the PDFs into one document

This is indeed maybe the best solution in the meantime. I have end up doing that on my project : I use the PHP wrapper phpwkhtmltopdf to generate multiple temporary PDF files, then php-pdftk to merge all the files.

Two major drawbacks:

  • like you said, it is a pain to handle page numbering
  • the wkhtmltopdf table of contents does not work well with multiple pages and merged files

This issue is out of my scope... (C++).
It would be greatly appreciated if someone have time to implementing that :-)

@Arvin-He
Copy link

It will be very nice to have this feature.

@stuartcusackie
Copy link

I agree. This would be good for my needs too. I'm aiming for a coloured cover page with no margins, and the rest of the document to have margins.

I tried to merge two separate pdfs but it's a pain and it doesn't work well. Also you lose your page numbering.

@jfcartier
Copy link

Any news about this feature? Thanks

@hakimio
Copy link

hakimio commented Aug 7, 2018

@jfcartier Andrew made a simple proof of concept which you can find here. If you really want this feature, you'll have to put some effort to make it ready for merging as at this point it's nowhere near that stage.

@darmawan01
Copy link

is there any solution for this ? to set different margin each page

@hakimio
Copy link

hakimio commented Apr 6, 2021

@darmawan01 No, you can track progress here.

@enisn
Copy link

enisn commented Jan 25, 2022

Any update?

@hakimio
Copy link

hakimio commented Jan 25, 2022

@enisn No, you will have to work on PR #3692 yourself if you want this functionality. See my comments (1 & 2) about what needs to be fixed and possible solution to some of the issues.

@t0byman
Copy link

t0byman commented Mar 1, 2022

Need this!

@iceway iceway linked a pull request May 4, 2022 that will close this issue
@cristinabardas
Copy link

Need this feature as well!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.