Rendering with matrix: missing features

141 views
Skip to first unread message

geisserml

unread,
Oct 5, 2022, 9:52:30 AM10/5/22
to pdfium
I would like to switch my rendering code from `FPDF_RenderPageBitmap()` to `FPDF_RenderPageBitmapWithMatrix()` because it is more feature-rich in terms of transformations (e. g. mirrored rendering, skew, rotating by an angle that is not a multiple of 90°, concatenated transformations, ...).

However, some functionality seems to be unavailable with matrix rendering:
* Form fields: It looks like it is not possible to render form fields with a custom transform matrix. I can only find `FPDF_FFLDraw()` but no matrix equivalent.
* Colour scheme: I can't find a function that can render with both custom colour scheme and matrix.
(* Progressive rendering: I can't find a function that can render both progressively and with matrix.)

In pypdfium2's rendering helper method, I'm publicly exposing the parameters `colour_scheme` and `draw_forms` already and would like to preserve this functionality, but still switch to matrix rendering.

Would it be possible to add methods like `FPDF_FFLDrawWithMatrix()` and `FPDF_RenderPageBitmapWithMatrixAndColorScheme()` to be able to profit from the full functionality, or is there some internal reason why these features can't be combined?

geisserml

unread,
Oct 5, 2022, 12:20:38 PM10/5/22
to pdfium
> Would it be possible to add methods like `FPDF_FFLDrawWithMatrix()` and `FPDF_RenderPageBitmapWithMatrixAndColorScheme()` to be able to profit from the full functionality, or is there some internal reason why these features can't be combined?

Alternatively, perhaps some `FPDF_RenderPageBitmapWithConfig()` function taking a rendering configuration interface might be better? To avoid the necessity of adding a new function each time a new rendering parameter is introduced.

Danis

unread,
Oct 9, 2022, 7:06:20 PM10/9/22
to pdfium
I've been using the code in the  attached patch in my local PDFium build.

The patch is against rev 5200 or so.

YMMV.

ffl_draw_with_matrix.patch

geisserml

unread,
Oct 10, 2022, 12:22:10 AM10/10/22
to pdfium
Thanks, I'll check out the patch. Have you considered submitting this on https://pdfium-review.googlesource.com/ ?
Message has been deleted
Message has been deleted
Message has been deleted

geisserml

unread,
Apr 26, 2023, 11:47:37 AM4/26/23
to pdfium
Linking an independently reported issue on this topic:
On Thursday, October 13, 2022 at 7:45:04 PM UTC+2 geisserml wrote:
Do PDFium developers have any comments on this?

geisserml

unread,
Apr 25, 2025, 9:24:52 AMApr 25
to pdfium
Getting back to this, this commit/patch from android's branch of pdfium seems related:
https://android.googlesource.com/platform/external/pdfium/+/8a5b0525467050ce19c01822cc2d785df946c084%5E%21
The linked issue is non-public at this time, though.

Lei Zhang

unread,
Apr 25, 2025, 3:00:36 PMApr 25
to geisserml, pdfium
Filed crbug.com/413572037
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/pdfium/673727b9-6fba-4473-a1fa-852932798617n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages