PDFium build

45 views
Skip to first unread message

Bojan Lovrovic

unread,
Aug 22, 2025, 11:33:37 AMAug 22
to pdfium
Hello everyone, I hope you are well.

The company I work for used to link PDFium binaries from the pdfium-binaries project on GitHub:
https://github.com/bblanchon/pdfium-binaries

But due to certain limitations, we are now building our own version of PDFium.

We've been successful at this, but we were unable to build a DLL where there are no dependencies on other project-based DLLs. The DLL we end up with has these dependencies that then also have to be copied:
icuuc.dll
libc++.dll
third_party_abseil-cpp_absl.dll
third_party_zlib.dll

This is inconvenient, and we know that it should be possible to build it like the aforementioned GitHub project is building it, so that it is a self-contained pdfium.dll and nothing else.

I shared my ninja build arguments (attached).

All help and advice is welcome.

Kind regards,
Bojan Lovrovic
args.gn

geisserml

unread,
Aug 23, 2025, 6:25:28 AMAug 23
to pdfium
I think the declaration in //BUILD.gn is key here: component("pdfium")
component() resolves to shared_library() if is_component_build is true, static_library() otherwise.
pdfium-binaries patch the root component("pdfium") to shared_library("pdfium") while setting is_component_build = false so pdfium's dependencies will be statically linked (bundled), but pdfium itself is built as shared library.
Also the #if defined(COMPONENT_BUILD) check is taken out from fpdfview.h so the public APIs are always exported.
and https://github.com/bblanchon/pdfium-binaries/blob/dc6252a5d1553be8400c1720d4746064f4e9f3d0/patches/public_headers.patch#L43-L66

Actually I'd say just is_component_build = true is better though, as it allows you to access APIs from the dependency libraries if needed.
I'm considering to ask the author of pdfium-binaries if he could change to separate DLLs, as I'd like to use libjpeg and libpng for image writing directly, instead of depending on an external meta-library that also includes libjpeg and libpng.
These are not mentioned in your list though, so I'm guessing you are setting use_system_libjpeg, use_system_libpng etc. to true?

BTW, may I ask what are the limitations that made you move away from pdfium-binaries to building pdfium on your own?

geisserml

unread,
Aug 23, 2025, 6:38:53 AMAug 23
to pdfium
> These are not mentioned in your list though, so I'm guessing you are setting use_system_libjpeg, use_system_libpng etc. to true?

Ah, no, I checked with your GN args and an own component build of pdfium, and it doesn't produce separate libjpeg and libpng DLLs.
So it seems like these are not actually managed as component()s... I'm pretty sure they are included though, as pdfium need image decoding capabilities at the least.
Reply all
Reply to author
Forward
0 new messages