ph_with_img {officer} | R Documentation |
add an image as a new shape in the current slide.
This function will be deprecated in favor of ph_with
in the next release.
ph_with_img(x, src, type = "body", index = 1, width = NULL, height = NULL, location = NULL) ph_with_img_at(x, src, left, top, width, height, rot = 0)
x |
a pptx device |
src |
image filename, the basename of the file must not contain any blank. |
type |
placeholder type (i.e. 'body', 'title') |
index |
placeholder index (integer). This is to be used when a placeholder type
is not unique in the current slide, e.g. two placeholders with type 'body', the first
one will be added with index 1 and the second one with index 2.
It is recommanded to use argument |
width, height |
image size in inches |
location |
a placeholder location object. This is a convenient
argument that can replace usage of arguments |
left, top |
location of the new shape on the slide |
rot |
rotation angle |
fileout <- tempfile(fileext = ".pptx") doc <- read_pptx() doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") img.file <- file.path( R.home("doc"), "html", "logo.jpg" ) if( file.exists(img.file) ){ doc <- ph_with_img(x = doc, type = "body", src = img.file, height = 1.06, width = 1.39 ) } print(doc, target = fileout ) fileout <- tempfile(fileext = ".pptx") doc <- read_pptx() doc <- add_slide(doc, layout = "Title and Content", master = "Office Theme") img.file <- file.path( R.home("doc"), "html", "logo.jpg" ) if( file.exists(img.file) ){ doc <- ph_with_img_at(x = doc, src = img.file, height = 1.06, width = 1.39, left = 4, top = 4, rot = 45 ) } print(doc, target = fileout )