module Render.CG.Minus.Poppler where

import Control.Monad {- base -}
import System.FilePath {- filepath -}
import System.Process {- process -}

type Cmd = (String,[String])

run_cmd :: Cmd -> IO ()
run_cmd (c,a) = void (rawSystem c a)

pdf_to_svg_cmd :: FilePath -> Cmd
pdf_to_svg_cmd fn = ("pdftocairo",["-svg",fn,replaceExtension fn ".svg"])

-- | Run pdftocairo to translate a PDF file to an SVG file.
--
-- > pdf_to_svg "/tmp/t.0.pdf"
pdf_to_svg :: FilePath -> IO ()
pdf_to_svg = run_cmd . pdf_to_svg_cmd