{"record":{"id":"3cd5fcf4029ebe08","repo":"tonhowtf/omniget","slug":"esse-pdf-n-o-tem-formul-rio-acroform","errorCode":null,"errorMessage":"esse PDF não tem formulário (AcroForm)","messagePattern":"esse PDF não tem formulário \\(AcroForm\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/pdf_form.rs","lineNumber":590,"sourceCode":"        if opts.flatten {\n            \"-preenchido\"\n        } else {\n            \"-form\"\n        }\n    } else {\n        opts.suffix.trim()\n    };\n    Ok(dir.join(format!(\"{}{}.pdf\", stem, suffix)))\n}\n\npub fn fill(opts: &Options, progress: &super::ProgressFn) -> anyhow::Result<FillResult> {\n    if opts.input.trim().is_empty() {\n        return Err(anyhow!(\"escolha o PDF\"));\n    }\n    let mut doc = load(&opts.input, &opts.password)?;\n    let known = fields_of(&doc);\n    if known.is_empty() {\n        return Err(anyhow!(\"esse PDF não tem formulário (AcroForm)\"));\n    }\n    let index = field_ids(&doc);\n    let pages = page_index(&doc);\n    let total = opts.values.len().max(1) as u64;\n\n    let mut filled = 0usize;\n    let mut missing: Vec<String> = Vec::new();\n    // O que desenhar quando achatar: (página, retângulo, texto, multilinha).\n    let mut stamps: Vec<(usize, [f32; 4], String, bool)> = Vec::new();\n\n    for (i, v) in opts.values.iter().enumerate() {\n        super::report(\n            progress,\n            ID,\n            \"progress\",\n            i as u64,\n            Some(total),\n            Some(v.name.clone()),","sourceCodeStart":572,"sourceCodeEnd":608,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/pdf_form.rs#L572-L608","documentation":"After successfully loading the PDF, fill() enumerates the document's form fields via fields_of and aborts when the list is empty, meaning the PDF has no AcroForm dictionary and therefore no fillable fields. The library treats 'nothing to fill' as an error rather than silently producing a copy of the input.","triggerScenarios":"Calling fill on a PDF that was never form-enabled (plain scanned or text-only PDF); a PDF whose AcroForm was removed by flattening in a previous run; passing values for a document that only looks like a form (fields are drawn text, not widgets); a corrupt or stripped AcroForm after round-tripping through another tool.","commonSituations":"Re-running fill on an already-flattened output PDF; downloading a printable (non-interactive) version of a government form instead of the interactive one; OCR'd scanned documents that have no field widgets at all.","solutions":["Verify the PDF actually has an interactive form (AcroForm) — open it in a viewer and check fields are clickable","If the file was already flattened, re-fill starting from the original unflattened PDF","Obtain the fillable version of the form (e.g. the interactive PDF, not the print-only one)","If the form is genuinely absent, draw text onto pages with a text/annotation tool instead of fill"],"exampleFix":"// before\nfill(&opts_flattened_output, progress)?; // esse PDF não tem formulário (AcroForm)\n// after\nlet mut opts = opts.clone();\nopts.input = original_fillable_pdf; // not the previously flattened output\nfill(&opts, progress)?;","handlingStrategy":"validation","validationCode":"let fields = read_fields(&opts.input, &opts.password)?;\nif fields.is_empty() {\n    return Err(anyhow!(\"input PDF has no AcroForm fields\"));\n}","typeGuard":null,"tryCatchPattern":"match fill(&opts, progress) {\n    Err(e) if e.to_string().contains(\"não tem formulário\") => {\n        eprintln!(\"{} is not a fillable form; use the interactive version\", opts.input);\n    }\n    Ok(result) => { /* use result */ }\n    Err(e) => return Err(e),\n}","preventionTips":["Confirm the PDF has interactive fields (AcroForm) before planning a fill","Never feed a previously flattened output back into fill; keep the original","Detect scanned/print-only forms early and route them to a text-overlay workflow instead","Test with a known fillable PDF when wiring up the integration"],"tags":["pdf","acroform","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}