Is there a way to build go binary with C file e.g pdftotext from popper-utils?

Viewed 29

My goal is to use pdftotext without the need to install $ sudo apt-get install poppler-utils.

The code:

   package main

   import (
    "fmt"
    "os/exec"
   )

   func main() {
    body, err := exec.Command("pdftotext", "-layout", "-q", "-nopgbrk", "-enc", "UTF-8", "-eol", "unix", "/Volumes/T7Touch/Learn/e-statement-to-t-account/5725299769Jul2022.pdf", "-").Output()
    if err != nil {
        panic(err)
    }
    fmt.Println(string(body))
   }

What I've tried:

  1. I use pdftotext which require installation and only available (without package manager like Homebrew) for linux by doing $ sudo apt-get install poppler-utils.

The problem:

  1. If I run this go binary in my Mac, it won't work because I have not installed poppler-utils. I am only able to use this on Visual Studio Code's dev container.
0 Answers
Related