Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support page marks and bleed #471

Closed
deathowl opened this issue May 23, 2017 · 5 comments
Closed

Support page marks and bleed #471

deathowl opened this issue May 23, 2017 · 5 comments
Labels
feature New feature that should be supported
Milestone

Comments

@deathowl
Copy link

deathowl commented May 23, 2017

@page {
  size: 159mm 237mm;
  margin: 3mm 3mm 3mm 3mm;
  marks: crop;
}

WARNING: Ignored marks: crop at 4:5, unknown property.

@liZe liZe changed the title marks: crop; property ignored Support page marks May 23, 2017
@liZe liZe added the feature New feature that should be supported label May 23, 2017
@liZe liZe changed the title Support page marks Support page marks and bleed May 23, 2017
@liZe
Copy link
Member

liZe commented May 23, 2017

These features should be quite easy to add, using a SVG file for crop marks and another one for crosses, and applying them to the bleed area box.

@liZe liZe added this to the v0.41 milestone Sep 5, 2017
@dark-light-cz
Copy link
Contributor

Hello!
I know it's nor in standard nor in any draft but can you extend support of bleedbox to be available in 4 sizes. I expect it's not problem and is only extension and does't bkeak anything functional.
Th reason is that i use weasyprint to generate pages for printer working with SRA4(225x320 mm) paper an i need bleed mark to paper A4(210mmx297mm)
I tried to extend the functionality myself but I was unable to find out how adding validators and computers works.

@liZe
Copy link
Member

liZe commented Sep 19, 2017

Hi @dark-light-cz!

You want bleed to behave like padding. Good news: it's not that hard 😄.

In validation.py, you can add a decorator for bleed around the expand_four_sides function, and 4 for bleed-left/right/top/bottom around the bleed function.

In properties.py, you can add bleed-left/right/top/bottom where bleed was added in 71d5409.

In css/__init__.py, you can replace bleed by bleed(_(left|right|top|bottom))? (not tested) in RE_INITIAL_NOT_COMPUTED (bleed's initial value is 'auto' where the calculated value depends on the value of marks).

You can then use a list where bleed is used as a single value (for example in document.py), and report these values when creating the bleed box (in pdf.py).

I think that's all! If you have any questions, you can fork and push what you've done even if it doesn't work, I'll help you to solve the problems you meet!

@dark-light-cz
Copy link
Contributor

dark-light-cz commented Sep 21, 2017

Hi @liZe

I re-wrote your implementation of bleed as you suggest in my fork in dark-light-cz@05446f5

If you like it I can create pull request.

Only thing I'm not sure with is changes in weasyprint/pdf.py. Can you please take a look at it and tell me whether it is right. I'm not sure why there is dividing by 2 in create of self.BleedBox and I'm not sure if there should be used left or right on x axis and top or bottom on y axis.

If you want my patch to included we propably need some tests. If so, please suggest me how to do it.

@liZe
Copy link
Member

liZe commented Oct 4, 2017

@dark-light-cz Sorry for the delay.

Yes, that's cool, thank you, you can create a pull request! I'll merge it and clean a couple of little things later.

@liZe liZe closed this as completed in 71d5409 Oct 5, 2017
netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Oct 9, 2017
Version 0.41
------------

Released on 2017-10-05.

WeasyPrint now depends on pdfrw >= 0.4.

New features:

* `#471 <https://github.com/Kozea/WeasyPrint/issues/471>`_:
  Support page marks and bleed.

Bug fixes:

* `#513 <https://github.com/Kozea/WeasyPrint/issues/513>`_:
  Don't crash on unsupported image-resolution values.
* `#506 <https://github.com/Kozea/WeasyPrint/issues/506>`_:
  Fix @font-face use with write_* methods.
* `#500 <https://github.com/Kozea/WeasyPrint/pull/500>`_:
  Improve readability of _select_source function.
* `#498 <https://github.com/Kozea/WeasyPrint/issues/498>`_:
  Use CSS prefixes as recommanded by the CSSWG.
* `#441 <https://github.com/Kozea/WeasyPrint/issues/441>`_:
  Fix rendering problems and crashes when using @font-face.
* `bb3a4db <https://github.com/Kozea/WeasyPrint/commit/bb3a4db>`_:
  Try to break pages after a block before trying to break inside it.
* `1d1654c <https://github.com/Kozea/WeasyPrint/commit/1d1654c>`_:
  Fix and test corner cases about named pages.

Documentation:

* `#508 <https://github.com/Kozea/WeasyPrint/pull/508>`_:
  Add missing libpangocairo dependency for Debian and Ubuntu.
* `a7b17fb <https://github.com/Kozea/WeasyPrint/commit/a7b17fb>`_:
  Add documentation on logged rendering steps.
netbsd-srcmastr referenced this issue in NetBSD/pkgsrc Oct 22, 2017
Version 0.41
------------

Released on 2017-10-05.

WeasyPrint now depends on pdfrw >= 0.4.

New features:

* `#471 <https://github.com/Kozea/WeasyPrint/issues/471>`_:
  Support page marks and bleed.

Bug fixes:

* `#513 <https://github.com/Kozea/WeasyPrint/issues/513>`_:
  Don't crash on unsupported image-resolution values.
* `#506 <https://github.com/Kozea/WeasyPrint/issues/506>`_:
  Fix @font-face use with write_* methods.
* `#500 <https://github.com/Kozea/WeasyPrint/pull/500>`_:
  Improve readability of _select_source function.
* `#498 <https://github.com/Kozea/WeasyPrint/issues/498>`_:
  Use CSS prefixes as recommanded by the CSSWG.
* `#441 <https://github.com/Kozea/WeasyPrint/issues/441>`_:
  Fix rendering problems and crashes when using @font-face.
* `bb3a4db <https://github.com/Kozea/WeasyPrint/commit/bb3a4db>`_:
  Try to break pages after a block before trying to break inside it.
* `1d1654c <https://github.com/Kozea/WeasyPrint/commit/1d1654c>`_:
  Fix and test corner cases about named pages.

Documentation:

* `#508 <https://github.com/Kozea/WeasyPrint/pull/508>`_:
  Add missing libpangocairo dependency for Debian and Ubuntu.
* `a7b17fb <https://github.com/Kozea/WeasyPrint/commit/a7b17fb>`_:
  Add documentation on logged rendering steps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported
Projects
None yet
Development

No branches or pull requests

3 participants