R officer powerpoint 抱怨外部图像是 pdf
R officer powerpoint complains with external image that is a pdf
我想将 pdf 格式的图形添加到官员创建的 powerpoint 文件中。从创建 powerpoint 并包含 pdf 的意义上讲,以下代码有效。但是要使用 powerpoint,您必须让它自行修复。这是一个例子
library(officer)
library(magrittr)
my_pres <- read_pptx()
testpdf <- "test.pdf"
extImgObs_pdf <- external_img(src = testpdf)
fp_3 <- fp_text(italic = TRUE, color = "black", font.size = 14)
my_pres <- add_slide(x = my_pres, layout = 'Title Only', master = 'Office Theme')
titleTextObserved <- "some text for the title field"
my_pres <- ph_with( x = my_pres, value = fpar(ftext(titleTextObserved, fp_3)), location = ph_location_type(type = "title") )
my_pres <- ph_with( x = my_pres, value = extImgObs_pdf, location = ph_location(left = 0, top = 1.2) )
print(my_pres, target = "presentations/cmip6/chillHours_Ensemble.pptx") %>% browseURL()
使用一些任意 test.pdf 文件(我用 R 中的 pdf 驱动程序生成它并用 linux pdfcrop
程序删除空格),上面的代码生成了一个 powerpoint .如果您单击“修复正常”消息,PowerPoint 会按预期显示。但是,当您单击“取消”而不是“修复”时,Powerpoint returns "Sorry, PowerPoint can't read ^O." 除了手动单击 Repair
?
之外,还有其他方法可以删除修复消息吗?
点击修复使pdf图像在本地可见,但ppt不显示其他人的图形。需要为图形使用 pdf 以外的东西。 png、tiff、bmp 和 jpeg 是选项。
我想将 pdf 格式的图形添加到官员创建的 powerpoint 文件中。从创建 powerpoint 并包含 pdf 的意义上讲,以下代码有效。但是要使用 powerpoint,您必须让它自行修复。这是一个例子
library(officer)
library(magrittr)
my_pres <- read_pptx()
testpdf <- "test.pdf"
extImgObs_pdf <- external_img(src = testpdf)
fp_3 <- fp_text(italic = TRUE, color = "black", font.size = 14)
my_pres <- add_slide(x = my_pres, layout = 'Title Only', master = 'Office Theme')
titleTextObserved <- "some text for the title field"
my_pres <- ph_with( x = my_pres, value = fpar(ftext(titleTextObserved, fp_3)), location = ph_location_type(type = "title") )
my_pres <- ph_with( x = my_pres, value = extImgObs_pdf, location = ph_location(left = 0, top = 1.2) )
print(my_pres, target = "presentations/cmip6/chillHours_Ensemble.pptx") %>% browseURL()
使用一些任意 test.pdf 文件(我用 R 中的 pdf 驱动程序生成它并用 linux pdfcrop
程序删除空格),上面的代码生成了一个 powerpoint .如果您单击“修复正常”消息,PowerPoint 会按预期显示。但是,当您单击“取消”而不是“修复”时,Powerpoint returns "Sorry, PowerPoint can't read ^O." 除了手动单击 Repair
?
点击修复使pdf图像在本地可见,但ppt不显示其他人的图形。需要为图形使用 pdf 以外的东西。 png、tiff、bmp 和 jpeg 是选项。