Add PyMuPDF engine #113

Closed
opened 2021-08-02 17:43:07 +00:00 by mara0004 · 5 comments
Contributor

PyMuPDF is a fast, powerful and well-maintained PDF library for Python. Could it be added as an additional engine for img2pdf, or is the AGPL license a problem?
In case PyMuPDF gets added, I would suggest to remove pdfrw support, as the latter is not maintained anymore since a longer time (see also #108).

[PyMuPDF](https://github.com/pymupdf/PyMuPDF) is a fast, powerful and well-maintained PDF library for Python. Could it be added as an additional engine for img2pdf, or is the AGPL license a problem? In case PyMuPDF gets added, I would suggest to remove pdfrw support, as the latter is not maintained anymore since a longer time (see also https://gitlab.mister-muffin.de/josch/img2pdf/issues/108).
Owner

I don't see how it can be possible to add mupdf as another engine option, because as far as I understand its API, one cannot control precisely the PDF objects. Instead PyMuPDF is a high-level library that is doing the fiddling with PDF objects for you.

I don't see how it can be possible to add mupdf as another engine option, because as far as I understand its API, one cannot control precisely the PDF objects. Instead PyMuPDF is a high-level library that is doing the fiddling with PDF objects for you.
Author
Contributor

Oh, okay, I didn't know that.

Oh, okay, I didn't know that.
Author
Contributor

I think PyMuPDF even has its own means to add images to PDFs, so img2pdf would not be necessary anyway.

I think PyMuPDF even has [its own means](https://pymupdf.readthedocs.io/en/latest/faq.html#how-to-add-images-to-a-pdf-page) to add images to PDFs, ~~so img2pdf would not be necessary anyway~~.
Owner

I think PyMuPDF even has its own means to add images to PDFs, so img2pdf would not be necessary anyway.

It is, because that API function is not able to insert some of the images that img2pdf can insert into a PDF.

> I think PyMuPDF even has [its own means](https://pymupdf.readthedocs.io/en/latest/faq.html#how-to-add-images-to-a-pdf-page) to add images to PDFs, so img2pdf would not be necessary anyway. It is, because that API function is not able to insert some of the images that img2pdf can insert into a PDF.
Author
Contributor

Right, I expressed myself awkwardly. I didn't mean this method would be equivalent to img2pdf, but it would at least cover the basic functionality of adding images to PDFs.
It's just that if I were to develop an application with PyMuPDF, I would probably not use img2pdf and accept that some image types are not supported, rather than add an additional dependency and so on.

Right, I expressed myself awkwardly. I didn't mean this method would be equivalent to img2pdf, but it would at least cover the basic functionality of adding images to PDFs. It's just that if I were to develop an application with PyMuPDF, I would probably not use img2pdf and accept that some image types are not supported, rather than add an additional dependency and so on.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#113
No description provided.