Skip to content
Discussion options

You must be logged in to vote

Unfortunately pdfium's public API is rather limited when it comes to images.

It works fine for JPEG, but otherwise it only provides the FPDF_BITMAP entrypoint, which does not support binary or CMYK images, or images with higher bit-depth. If you're using PdfBitmap.from_pil() and PdfImage.set_bitmap(), these will be transcoded to grayscale, RGB, or 8-bit respectively.1 Also you can't choose the encoding (IIRC pdfium will just flate compress the bitmap data).

The wrappers are just there to expose what pdfium can do, but again, I agree they're limited, so you may be better off with img2pdf or similar, especially when working with binary images (which seems to be your use case).

Footnotes

  1. T…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@BartMiki
Comment options

@mara004
Comment options

Answer selected by mara004
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants