tonhowtf/omniget · error

este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajus

Error message

este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajustes → Dependencias

What it means

Raised when the loaded PDFium shared library does not export the `FPDFText_GetFontSize` symbol, which the text-extraction API requires to compute font sizes per character. The API struct carries an optional function pointer (`text_fontsize`) that is `None` for older or partial PDFium builds. The message directs the user to update the PDFium dependency via the app settings.

Solutions

  1. Update PDFium via Ajustes → Dependências to a full recent build
  2. Download the latest official PDFium release and point the app at it
  3. Extract text without font-size metadata, or skip font-size collection
  4. Check the loaded library version/exports at startup and warn early

Example fix

// before
let sizes = extract_text_with_fontsize(&pdf, None, "1-5", false).await?;
// after
let sizes = match extract_text_with_fontsize(&pdf, None, "1-5", false).await {
    Ok(s) => s,
    Err(e) if e.to_string().contains("FPDFText_GetFontSize") => Vec::new(),
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: fallback

Validate before calling

// Rust: check symbol availability before extraction
if api().text_fontsize.is_none() {
    eprintln!("PDFium sem FPDFText_GetFontSize; extraindo sem metadados de fonte");
}

Try / catch

match extract_pages_text(&pdf, None, "1-5", false).await {
    Ok(pages) => pages,
    Err(e) if e.to_string().contains("FPDFText_GetFontSize") => extract_pages_text_no_fonts(&pdf).await,
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling PDF text extraction that requests font-size metadata against an outdated/limited PDFium binary where `api.text_fontsize` is None.

Common situations: Bundling an old pdfium.dll/libpdfium.so, a distro-packaged PDFium missing non-core symbols, or a user overriding the dependency path with a minimal build.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/796b8693c1a997e7. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/pdf.rs:1556

            }
        }
    }
    out
}

/// Lê as páginas pedidas com posição, corpo de fonte e estilo de cada
/// caractere — a matéria-prima do PDF → Markdown. `on_page` recebe
/// `(feitas, total)` antes de cada página, para o progresso.
pub fn read_pages(
    input: &str,
    password: Option<&str>,
    pages_spec: &str,
    want_images: bool,
    mut on_page: impl FnMut(usize, usize),
) -> anyhow::Result<Vec<PageText>> {
    let api = api()?;
    let font_size = api.text_fontsize.ok_or_else(|| {
        anyhow!("este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajustes → Dependencias")
    })?;
    let _g = OPS.lock().unwrap_or_else(|p| p.into_inner());
    let path = Path::new(input.trim());
    let doc = Document::open(api, path, password)?;
    let wanted = parse_ranges(pages_spec, doc.pages())?;
    let total = wanted.len();
    let mut out = Vec::with_capacity(total);
    for (done, no) in wanted.iter().enumerate() {
        on_page(done, total);
        let page = doc.page(no - 1)?;
        let (width, height) = page.size_pt();
        let mut chars = Vec::new();
        unsafe {
            let tp = (api.text_load)(page.page);
            if !tp.is_null() {
                let count = (api.text_count)(tp).max(0);
                chars.reserve(count as usize);
                // Alguns glifos (hífen de fim de linha, por exemplo) voltam sem

View on GitHub (pinned to 8600b91f42)