WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

support for svg mix-blend-mode: multiply

Open danfitz36 opened this issue 4 years ago • 4 comments

it's now supported in chrome, but it's new. any chance it can be supported here?

chrome: multiplied in chrome pdf: not in pdf

danfitz36 avatar Jun 04 '21 16:06 danfitz36

Hello!

Thank you for this feature request. As many blend modes are supported in PDF (including multiply), we can imagine that this feature could be implemented. Of course, having the feature in PDF doesn’t mean that it’s easy to implement :smile:, but at least it’s a good start!

liZe avatar Jun 04 '21 19:06 liZe

I'm mostly a designer who codes some. is there anything else I can do to be helpful on something like this?

danfitz36 avatar Jun 04 '21 19:06 danfitz36

I'm mostly a designer who codes some. is there anything else I can do to be helpful on something like this?

Thanks a lot for your help!

The first steps are not really fun and require some ability to focus on a specification, but that where I’d start:

  • download the PDF specification,
  • be sure that Blend modes (chapter 11.3.5) are what we want,
  • find where the blend mode key has to be inserted in the PDF,
  • find where the key has to be inserted in WeasyPrint (maybe somewhere here?),
  • insert the Multiply key in the code and check that it works (no need to get the mix-blend-mode value from the SVG, that’s just a test),
  • get the real mix-blend-mode value from the SVG and make it find its way to the place where it has to be inserted in WeasyPrint.

TL;DR: find a PDF sample in the spec where the Multiply (or any other) blend mode is set, try it in WeasyPrint’s code. If it works, make WeasyPrint use the real mix-blend-mode value instead of forcing Multiply. The first step could be complicated, but doesn’t require any coding abilities.

liZe avatar Jun 04 '21 20:06 liZe

Note that SVG’s feBlend is supported. Having mix-blend-mode supported in SVG (and actually even in CSS) could actually be quite easy. If anyone is interested in contributing, just ask, we’ll help you!

liZe avatar Aug 17 '21 18:08 liZe