I am currently rewriting my "old" Python-based Chatbots into golang. One issue I came across was that I can´t convert a PDF into jpeg. Which I´d like to do so I can send it into a chat easily.
Already tried this with bimg (did not work at all) and imagemagick (gopkg.in/gographics/imagick.v3/imagick) as provided in this answer to another thread: "https://stackoverflow.com/a/47520596/7502507"
imagick.Initialize()
defer imagick.Terminate()
mw := imagick.NewMagickWand()
defer mw.Destroy()
mw.ReadImage(pdf)
mw.SetIteratorIndex(0) // This being the page offset
mw.SetImageFormat("jpg")
mw.WriteImage(image)
It does not produce a jpg at all, it just gives me the error
ERROR_POLICY: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408
How can I make this work? I can´t seem to edit the security settings for this.
Any help is appreciated!