Giter VIP home page Giter VIP logo

Comments (17)

SimonSapin avatar SimonSapin commented on May 30, 2024

PDF embedding is not supported at the moment, so the output above is the expected result.

We could use Poppler to render PDF files to cairo surfaces and use that as images, then render them back to PDF. But that’s just silly, "real" PDF embedding like TeX does just copies low-level PDF objects. Unfortunately I don’t know if this is possible with cairo.

from weasyprint.

 avatar commented on May 30, 2024

Ideally, any selectable (i.e. copy-pastable) text in embedded PDFs should be remain selectable in the output PDF.

from weasyprint.

thmo avatar thmo commented on May 30, 2024

From https://www.cairographics.org/cookbook/renderpdf/ it actually doesn't sound like such a bad idea to use poppler. It says:

When using a vector backend, the vectors and text in the PDF file are preserved in the output as vectors. There is no unnecessary rasterization.

from weasyprint.

thmo avatar thmo commented on May 30, 2024

In a discussion on IRC it was just noted that poppler is GPL-licensed, so cannot be used by weasyprint.

from weasyprint.

 avatar commented on May 30, 2024

In a discussion on IRC it was just noted that poppler is GPL-licensed, so cannot be used by weasyprint.

This sounds like it could be FUD?

WeasyPrint is licensed under the modified BSD license (aka 3-clause BSD license), which is GPL-compatible.

It's entirely possible I'm missing something important, but please could you explain why you think Poppler's license means that Poppler "cannot be used by WeasyPrint"? Thanks!

from weasyprint.

liZe avatar liZe commented on May 30, 2024

This sounds like it could be FUD?

It may be.

Actually, it's really explicit in Poppler's README:

Please note that xpdf, and thus poppler, is licensed under the GPL, not the LGPL. Consequently, any application using poppler must also be licensed under the GPL.

from weasyprint.

 avatar commented on May 30, 2024

Actually, it's really explicit in Poppler's README:

Please note that xpdf, and thus poppler, is licensed under the GPL, not the LGPL. Consequently, any application using poppler must also be licensed under the GPL.

Interesting. Strictly speaking, this depends upon how the GPL-ed package would be "used". GPL packages and 3-clause BSD packages can be shipped together (e.g. in a distro like Debian) and can specify each other as dependencies in either direction (e.g. via a package manager like Apt).

I see these potential ways forward:

  1. Re-license future versions of WeasyPrint under the GPL (or better yet, the AGPLv3), and use Poppler. I am in favour of this.
  2. Call Poppler from WeasyPrint in a way that doesn't violate the GPL, if that is possible. I suspect it is possible, despite the Poppler README, but I may be wrong.
  3. Don't use Poppler for WeasyPrint.

from weasyprint.

SimonSapin avatar SimonSapin commented on May 30, 2024

This sounds like it could be FUD?

Let’s not accuse each other of ill intentions when there’s probably only a "logical shortcut" in a terse message.

https://www.gnu.org/licenses/gpl-faq.html#WhatDoesCompatMean says:

[To say a license is “compatible with the GPL”] means that the other license and the GNU GPL are compatible; you can combine code released under the other license with code released under the GNU GPL in one larger program.

All GNU GPL versions permit such combinations privately; they also permit distribution of such combinations provided the combination is released under the same GNU GPL version. The other license is compatible with the GPL if it permits this too.

Emphasis is mine. This means that Poppler (GPL-licensed) cannot be used in WeasyPrint without effectively changing the license of WeasyPrint to GPL.

Call Poppler from WeasyPrint in a way that doesn't violate the GPL, if that is possible.

As far as I know, whether that would be compliant with the GPL is very open to legal interpretation. So I’d rather not attempt it.

from weasyprint.

 avatar commented on May 30, 2024

Let’s not accuse each other of ill intentions when there’s probably only a "logical shortcut" in a terse message.

Agreed. I did not intend to impute ill intentions, and apologies if my reply came across that way.

Call Poppler from WeasyPrint in a way that doesn't violate the GPL, if that is possible.

As far as I know, whether that would be compliant with the GPL is very open to legal interpretation. So I’d rather not attempt it.

I understand your caution, but it really might be viable: https://www.gnu.org/licenses/gpl-faq.html#MereAggregation

Anyhow, I'm not an expert on this. The FSF Licensing & Compliance Team exists to help answer precisely this sort of question, so I'd suggest emailing them with your concerns, to see if they can suggest a low-friction, compliant solution. After all, while copyleft is important to the FSF, facilitating the creation, refinement and dissemination of free software (like WeasyPrint) is even more important to them, IIUC :)

(A case in point is that even the GNU project includes some code that is under non-copyleft free software licenses: see Appendix C.)

from weasyprint.

SimonSapin avatar SimonSapin commented on May 30, 2024

https://www.gnu.org/licenses/gpl-faq.html#MereAggregation

This sounds like a very grey area:

Where's the line between two separate programs, and one program with two parts? This is a legal question, which ultimately judges will decide.
[…]
But if the semantics of the communication are intimate enough, exchanging complex internal data structures, that too could be a basis to consider the two parts as combined into a larger program.

from weasyprint.

SimonSapin avatar SimonSapin commented on May 30, 2024

IMO a cairo surface containing vectors sounds like a "complex internal data structure".

from weasyprint.

 avatar commented on May 30, 2024

IMO a cairo surface containing vectors sounds like a "complex internal data structure".

I'd be interested to see if the FSF would confirm that. Alternatively, what about:

  1. Re-license future versions of WeasyPrint under the GPL (or better yet, the AGPLv3), and use Poppler.

It looks like WeasyPrint has 29 contributors. Of these, several seem to have made only trivial (i.e. non-copyrightable) commits. So the number of remaining contributors from whom you would need consent to re-license WeasyPrint isn't huge, and might be worth contacting if you're amenable to this option?

from weasyprint.

SimonSapin avatar SimonSapin commented on May 30, 2024

I am not interested in changing WeasyPrint’s license.

from weasyprint.

liZe avatar liZe commented on May 30, 2024

I am not interested in changing WeasyPrint’s license.

+1.

The poppler devs took the time to explicitely write that we should only use the lib in a GPL software. Legal, not legal, I don't care, I think that we can at least respect what they wrote.

Now, let's go back to our problem.

Another (far from ideal) solution is to convert the PDF to one (or more) SVG image(s). This can be done before calling WeasyPrint, with Inkscape for example. You can then use <img> and even take benefit from the size negociation algorithm. This solution doesn't add extra rasterisation but the text is not selectable (may be fixed by Kozea/CairoSVG#80 if anyone is interested).

from weasyprint.

SimonSapin avatar SimonSapin commented on May 30, 2024

Another solution (to this and many other things) would be to ditch cairo and write PDF files directly ourselves. I’ve long wanted WeasyPrint to do that but it would be a lot of work, especially around fonts.

from weasyprint.

khaledhosny avatar khaledhosny commented on May 30, 2024

You might find https://github.com/simoncozens/libtexpdf interesting.

from weasyprint.

khaledhosny avatar khaledhosny commented on May 30, 2024

Oh, you don’t want GPL. Sorry, nevermind.

from weasyprint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.