extract_pdf_image {inlpubs}R Documentation

Extract Image from a PDF Document

Description

Extract an image from any PDF document. Requires that the pdftools and magick packages are available.

Usage

extract_pdf_image(
  input,
  output = tempfile(fileext = ".jpg"),
  page = 1,
  width = 300,
  depth = 8,
  quality = 70
)

Arguments

input

'character' string. File path to PDF document.

output

'character' string. Location to write the JPEG image file.

page

'integer' number. Page number in the document. Defaults to page 1.

width

'integer' number. Image width in pixels.

depth

'integer' number. Image color depth (either 8 or 16). Defaults to 8.

quality

'integer' number. JPEG quality, a number between 0 and 100. Defaults to 70.

Value

Returns the path to the image file.

Author(s)

J.C. Fisher, U.S. Geological Survey, Idaho Water Science Center

See Also

add_content function to add cover images to the inlpubs package.

Examples

input <- system.file("extdata", "test.pdf", package = "inlpubs")
path <- extract_pdf_image(input)

unlink(path)

[Package inlpubs version 1.1.3 Index]