-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace mPDF ImageProcessor with DW2PDF one
- Loading branch information
1 parent
f6b6ef8
commit bd07ae4
Showing
4 changed files
with
6 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's the proper way. The mpdf source code should not be modified.
bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I know, but that's actually how it's currently implemented, as discussed in #476 and as you can see on DW2PDF source code: https://github.com/splitbrain/dokuwiki-plugin-dw2pdf/blob/master/vendor/mpdf/mpdf/src/ServiceFactory.php#L12
bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far I know there is not an alternative at the moment.
If I remember it right it has also an issue at the mpdf library (but not completely sure about that).
edit: mpdf/mpdf#460 the not accepted approach.
bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current mpdf master accepts a Dependency Injection container: https://github.com/mpdf/mpdf/blob/73f0511e15f6b76c5c2f947128ae676754cbd7ee/src/Mpdf.php#L1049 I don't know from which version onward this is available.
With this container it should be possible to set the HTTPClient and a LocalContentLoader:
https://github.com/mpdf/mpdf/blob/73f0511e15f6b76c5c2f947128ae676754cbd7ee/src/ServiceFactory.php#L72-L82
It seems not possible to override the ImageProcessor:
https://github.com/mpdf/mpdf/blob/73f0511e15f6b76c5c2f947128ae676754cbd7ee/src/ServiceFactory.php#L102-L114
However, I think we could completely avoid the need for the ImageProcessor, by registering our own PHP stream wrapper for the
dw2pdf://
protocol.bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That became available for mpdf version 8.1, so further this fine to merge?
bd07ae4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time the adoption to 8.1 wasn't accepted because it would break compatibility with PHP 7.4 which DokuWiki relies for, as discussed in #476. So I believe it's fine to merge this PR as it fixes known mPDF issues like mpdf/mpdf@5b19fb6 and DW2PDF is currently using a mPDF version that is unsupported by mPDF team by now. When I opened an issue there they requested me to update it first, so I don't see any reason for DW2PDF to be stuck in a version that it have no support for.