import "gopkg.in/gographics/imagick.v3/imagick"
func LoadParsePdf(lessonName string, validPageNos []int, localFolder string, pdfName string, imgPrefix string, imgSuffix string) (int, error) {
support.Debug("begin convert pdf %s to img ", pdfName)
imagick.Initialize()
defer imagick.Terminate()
mw := imagick.NewMagickWand()
defer mw.Destroy()
if err := mw.SetResourceLimit(imagick.RESOURCE_MEMORY, 50*1024*1024); err != nil {
return 0, err
}
if err := mw.SetResolution(50, 50); err != nil {
return 0, err
}
support.Debug("lesson %s , begin read pdf ", lessonName)
if err := mw.ReadImage(util.JoinPath(localFolder, pdfName)); err != nil {
return 0, err
}
support.Debug("end read pdf ")
....
...
}
我尝试使用“mw.SetResourceLimit(imagick.RESOURCE_MEMORY, xxx)”来解决这个内存。在windows中,没关系,使用50M。但在 lunix 中,它失败了。谁能帮我解决?谢谢