{"record":{"id":"796b8693c1a997e7","repo":"tonhowtf/omniget","slug":"este-pdfium-nao-expoe-fpdftext-getfontsize-atualize-em","errorCode":null,"errorMessage":"este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajustes → Dependencias","messagePattern":"este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajustes → Dependencias","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/pdf.rs","lineNumber":1556,"sourceCode":"            }\n        }\n    }\n    out\n}\n\n/// Lê as páginas pedidas com posição, corpo de fonte e estilo de cada\n/// caractere — a matéria-prima do PDF → Markdown. `on_page` recebe\n/// `(feitas, total)` antes de cada página, para o progresso.\npub fn read_pages(\n    input: &str,\n    password: Option<&str>,\n    pages_spec: &str,\n    want_images: bool,\n    mut on_page: impl FnMut(usize, usize),\n) -> anyhow::Result<Vec<PageText>> {\n    let api = api()?;\n    let font_size = api.text_fontsize.ok_or_else(|| {\n        anyhow!(\"este PDFium nao expoe FPDFText_GetFontSize; atualize em Ajustes → Dependencias\")\n    })?;\n    let _g = OPS.lock().unwrap_or_else(|p| p.into_inner());\n    let path = Path::new(input.trim());\n    let doc = Document::open(api, path, password)?;\n    let wanted = parse_ranges(pages_spec, doc.pages())?;\n    let total = wanted.len();\n    let mut out = Vec::with_capacity(total);\n    for (done, no) in wanted.iter().enumerate() {\n        on_page(done, total);\n        let page = doc.page(no - 1)?;\n        let (width, height) = page.size_pt();\n        let mut chars = Vec::new();\n        unsafe {\n            let tp = (api.text_load)(page.page);\n            if !tp.is_null() {\n                let count = (api.text_count)(tp).max(0);\n                chars.reserve(count as usize);\n                // Alguns glifos (hífen de fim de linha, por exemplo) voltam sem","sourceCodeStart":1538,"sourceCodeEnd":1574,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/pdf.rs#L1538-L1574","documentation":"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.","triggerScenarios":"Calling PDF text extraction that requests font-size metadata against an outdated/limited PDFium binary where `api.text_fontsize` is None.","commonSituations":"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.","solutions":["Update PDFium via Ajustes → Dependências to a full recent build","Download the latest official PDFium release and point the app at it","Extract text without font-size metadata, or skip font-size collection","Check the loaded library version/exports at startup and warn early"],"exampleFix":"// before\nlet sizes = extract_text_with_fontsize(&pdf, None, \"1-5\", false).await?;\n// after\nlet sizes = match extract_text_with_fontsize(&pdf, None, \"1-5\", false).await {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"FPDFText_GetFontSize\") => Vec::new(),\n    Err(e) => return Err(e),\n};","handlingStrategy":"fallback","validationCode":"// Rust: check symbol availability before extraction\nif api().text_fontsize.is_none() {\n    eprintln!(\"PDFium sem FPDFText_GetFontSize; extraindo sem metadados de fonte\");\n}","typeGuard":null,"tryCatchPattern":"match extract_pages_text(&pdf, None, \"1-5\", false).await {\n    Ok(pages) => pages,\n    Err(e) if e.to_string().contains(\"FPDFText_GetFontSize\") => extract_pages_text_no_fonts(&pdf).await,\n    Err(e) => return Err(e),\n}","preventionTips":["Ship a full, recent PDFium build with the app instead of relying on system copies","Probe required PDFium symbols at startup and warn before use","Catch the missing-symbol path and degrade gracefully (skip font-size data)","Document the minimum PDFium version required for font metadata features"],"tags":["pdfium","missing-symbol","native-dependency"],"backgroundTag":"missing-dependency","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}