tonhowtf/omniget · error
Ghostscript nao encontrado
Error message
Ghostscript nao encontrado
What it means
When compression mode is "gs" but the ghostscript executable cannot be located on the system, the tool throws "Ghostscript nao encontrado" ("Ghostscript not found") instead of attempting compression. Raster-based compression can proceed, but explicit gs mode cannot without the binary.
Solutions
- Install ghostscript (apt install ghostscript / brew install ghostscript / choco install ghostscript).
- Ensure the gs binary's directory is on PATH for the app process.
- Use a different compression mode that doesn't require ghostscript.
- In Docker, add ghostscript to the image packages.
Example fix
// Dockerfile before FROM ubuntu:24.04 // after FROM ubuntu:24.04 RUN apt-get update && apt-get install -y ghostscript
Defensive patterns
Strategy: fallback
Validate before calling
fn ghostscript_available() -> bool {
std::process::Command::new("gs").arg("--version").output()
.map(|o| o.status.success()).unwrap_or(false)
}
// choose mode: if !ghostscript_available() && opts.mode == "gs" { opts.mode = "raster".into(); } Try / catch
let result = compress(&opts, &progress).await;
match result {
Err(e) if e.to_string().contains("Ghostscript nao encontrado") => {
let mut fallback_opts = opts.clone();
fallback_opts.mode = "raster".into(); // path that does not need gs
compress(&fallback_opts, &progress).await
}
other => other,
} Prevention
- Install ghostscript in every environment the app runs in (dev, CI, Docker, user machines).
- Probe for `gs --version` at app startup and degrade features gracefully.
- Add ghostscript to installers/package dependencies.
- On Windows, ship or detect the gswin64c binary and map PATH accordingly.
When it happens
Trigger: Calling compress with opts.mode == "gs" on a machine where the gs/ghostscript binary is not installed or is absent from PATH.
Common situations: Fresh OS installs without ghostscript; Windows users without gs in PATH; Docker/CI images stripped of ghostscript; sandboxed Tauri environments with a minimal PATH.
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
- ghostscript falhou
- tesseract nao esta instalado
- ghostscript não gerou nada
- Ghostscript não encontrado nesta máquina
- aria2c binary not found after extraction
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/74c484f1d7ed5359.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/pdf.rs:1183
.unwrap_or(0);
report(&progress, "done", 1, Some(1), None);
return Ok(CompressResult {
output: output.to_string_lossy().to_string(),
before,
after,
method: "ghostscript".into(),
pages,
});
}
if opts.mode == "gs" {
return Err(anyhow!(
"ghostscript falhou: {}",
String::from_utf8_lossy(&o.stderr).trim()
));
}
let _ = std::fs::remove_file(&output);
} else if opts.mode == "gs" {
return Err(anyhow!("Ghostscript nao encontrado"));
}
let dpi = if opts.dpi == 0 { 110 } else { opts.dpi };
let quality = if opts.quality == 0 { 60 } else { opts.quality };
let out =
tokio::task::spawn_blocking(move || rasterize(&input, &output, dpi, quality, &progress))
.await??;
Ok(CompressResult {
output: out.output,
before,
after: out.bytes,
method: "raster".into(),
pages: out.pages,
})
}
/// Dangerzone sem contêiner: cada página vira pixels e o PDF é remontado
/// só com imagens. Scripts, formulários, links e anexos não sobrevivem.
pub fn sanitize(View on GitHub (pinned to 8600b91f42)