Skip to contents

Convert a PDF/SVG file to images of other formats with Inkscape.

Usage

pdf2png(
  infile,
  outfile = NULL,
  page = NULL,
  dpi = 400,
  white = FALSE,
  backend = c("mutool", "inkscape")
)

pdf2svg(
  infile,
  outfile = NULL,
  page = NULL,
  white = FALSE,
  backend = c("mutool", "inkscape")
)

svg2pdf(infile, outfile = NULL)

svg2png(infile, outfile = NULL, dpi = 1200)

Arguments

infile

String. Path to input PDF file.

outfile

String. By default, outfile is set to NULL, in which the input PDF file stem is used.

page

Integer vector. The pages (starting with 1) to extract from the PDF file, defaults to NULL, in which every page is converted to an image.

dpi

Integer. "Dots Per Inch" for PNG outputs with pdf2png().

backend

String. The tool for converting images from PDFs. Defaults to "mutool". Currently supported options: "mutool" and "inkscape"

Details

To use this function, mutool (v1.24.0) or inkscape (v1.2.2) has to be available from the command line. Alternatively, users can specify the absolute path to inkscape by the option stom.inkscape (e.g., options(stom.inkscape = "/home/stom/bin/inkscape")).

Examples

if (FALSE) { # \dontrun{
infile = system.file("inkscape", "dag.pdf", package = "stom")
pdf2svg( infile, outfile="dag.svg" )
pdf2png( infile, outfile="dag.png", dpi=800 )
svg2pdf( "dag.svg", "dag2.pdf" )
svg2png( "dag.svg", "dag2.png" )
} # }