blob: b5cadb4c2dab5bab0a6f0fb41341923a8887edea [file] [log] [blame]
/* PDF Rasterizer Package
This package provides the Pdfium and Poppler rasterizers. Pdfium
requires the `pdfium_test` executable be located in the PATH. Poppler
requires `pdftoppm` (provided by poppler-utils) and `pnmtopng`
(provided by netpbm). */
package pdf
type Rasterizer interface {
// Rasterize will take the path to a PDF file and rasterize the
// file. If the file has multiple pages, discard all but the first
// page. The output file will be in PNG format.
Rasterize(pdfInputPath, pngOutputPath string) error
// Return the name of this rasterizer.
String() string
// Return false if the rasterizer is found.
Enabled() bool
// GetEnabledRasterizers returns the list of enabled rasterizers based on
// the executables installed on the host machine.
func GetEnabledRasterizers() []Rasterizer {
ret := []Rasterizer{}
for _, raster := range []Rasterizer{Pdfium{}, Poppler{}} {
if raster.Enabled() {
ret = append(ret, raster)
return ret