From Poppler to PDFluent

Poppler is a GPL-licensed C++ library. PDFluent is MIT/commercial Rust. No C++ compilation step, no GPL licensing constraints, and a higher-level API.

Migrating from Poppler to PDFluent. Install with cargo add pdfluent

Migration steps

1

Remove the C++ Poppler dependency

Poppler is a system library installed via apt, brew, or built from source. It requires C++ headers and a linker step in your build. PDFluent is a Rust crate — add it to Cargo.toml and Cargo handles everything. No system package required, no pkg-config, no build.rs linking.

Poppler (before)
# Install system dependency
apt-get install -y libpoppler-cpp-dev

# CMakeLists.txt
find_package(PkgConfig REQUIRED)
pkg_check_modules(POPPLER REQUIRED poppler-cpp)
target_link_libraries(myapp ${POPPLER_LIBRARIES})
PDFluent (after)
# Cargo.toml — no system package needed
[dependencies]
pdfluent = "0.9"
2

Replace Poppler document loading with Document::open

Poppler's C++ API returns raw pointers from load_from_file. You must check for null and remember to delete the document when done. PDFluent returns a Result. The ? operator handles errors, and the document is freed when it goes out of scope.

Poppler (before)
#include <poppler/cpp/poppler-document.h>
#include <poppler/cpp/poppler-page.h>

poppler::document* doc =
    poppler::document::load_from_file("input.pdf");
if (!doc) {
    std::cerr << "Failed to open" << std::endl;
    return 1;
}

poppler::page* p = doc->create_page(0);
std::vector<poppler::text_box> boxes = p->text_list();

delete p;
delete doc;
PDFluent (after)
use pdfluent::Document;

fn process() -> pdfluent::Result<()> {
    let doc = Document::open("input.pdf")?;
    let text = doc.page(0)?.extract_text()?;
    println!("{}", text);
    Ok(())
}
3

Verify your GPL licensing obligations are resolved

Poppler is licensed under GPL-2.0. Any software that links against it as a library must also be GPL-licensed or obtain a separate commercial exception. PDFluent is available under MIT for open-source projects and a commercial license for proprietary software, with no GPL propagation.

Poppler (before)
# Poppler GPL-2.0:
# Your application must be GPL-licensed if it links
# against Poppler directly as a library.
# Commercial use requires legal review or a separate
# arrangement with each downstream user.
PDFluent (after)
# PDFluent MIT / commercial:
# MIT for open-source projects — no restrictions.
# Commercial license available at published prices.
# No GPL propagation, no legal grey area.

Things to watch out for

  • !Poppler focuses on rendering and text extraction. If your primary use case is pixel-accurate PDF rendering, review PDFluent's current rendering capabilities before migrating.
  • !Poppler does not support creating or editing PDFs — it is read-only. If you use additional tools (like libqpdf or Cairo) alongside Poppler for writing, PDFluent handles both reading and writing in a single crate.
  • !Poppler uses 0-based page indexing, matching PDFluent's 0-based indexing. Page number references do not need adjustment.
  • !Poppler has no form-filling API. AcroForm and XFA support require a separate library when using Poppler.

Frequently asked questions