tonhowtf/omniget · error

esse PDF não tem formulário (AcroForm)

Error message

esse PDF não tem formulário (AcroForm)

What it means

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.

Solutions

  1. Verify the PDF actually has an interactive form (AcroForm) — open it in a viewer and check fields are clickable
  2. If the file was already flattened, re-fill starting from the original unflattened PDF
  3. Obtain the fillable version of the form (e.g. the interactive PDF, not the print-only one)
  4. If the form is genuinely absent, draw text onto pages with a text/annotation tool instead of fill

Example fix

// before
fill(&opts_flattened_output, progress)?; // esse PDF não tem formulário (AcroForm)
// after
let mut opts = opts.clone();
opts.input = original_fillable_pdf; // not the previously flattened output
fill(&opts, progress)?;
Defensive patterns

Strategy: validation

Validate before calling

let fields = read_fields(&opts.input, &opts.password)?;
if fields.is_empty() {
    return Err(anyhow!("input PDF has no AcroForm fields"));
}

Try / catch

match fill(&opts, progress) {
    Err(e) if e.to_string().contains("não tem formulário") => {
        eprintln!("{} is not a fillable form; use the interactive version", opts.input);
    }
    Ok(result) => { /* use result */ }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/pdf_form.rs:590

        if opts.flatten {
            "-preenchido"
        } else {
            "-form"
        }
    } else {
        opts.suffix.trim()
    };
    Ok(dir.join(format!("{}{}.pdf", stem, suffix)))
}

pub fn fill(opts: &Options, progress: &super::ProgressFn) -> anyhow::Result<FillResult> {
    if opts.input.trim().is_empty() {
        return Err(anyhow!("escolha o PDF"));
    }
    let mut doc = load(&opts.input, &opts.password)?;
    let known = fields_of(&doc);
    if known.is_empty() {
        return Err(anyhow!("esse PDF não tem formulário (AcroForm)"));
    }
    let index = field_ids(&doc);
    let pages = page_index(&doc);
    let total = opts.values.len().max(1) as u64;

    let mut filled = 0usize;
    let mut missing: Vec<String> = Vec::new();
    // O que desenhar quando achatar: (página, retângulo, texto, multilinha).
    let mut stamps: Vec<(usize, [f32; 4], String, bool)> = Vec::new();

    for (i, v) in opts.values.iter().enumerate() {
        super::report(
            progress,
            ID,
            "progress",
            i as u64,
            Some(total),
            Some(v.name.clone()),

View on GitHub (pinned to 8600b91f42)