[R] Embedding PDF into RTF document via R language

Fisher Dennis fisher at plessthan.com
Fri Sep 22 19:21:59 CEST 2017


R 3.4.1
OS X and Windows

Colleagues

I have a complicated problem that includes several components:
	R
	RTF
	PDF

Using R (and a slew of RTF commands), I assemble a text document with an RTF extension.  The document contains text, tables, and images (JPEG format, previously created with R).  
To “import” the JPEG images into the document, I use the following R code:
	cat("\\pard\\qc {\\pict\\jpegblip\n", file=TEMPREPORT, append=T)
	cat(toupper(readBin(IMAGEFILE, "raw", 10000000)), fill=64, sep="",file=TEMPREPORT, append=T)
	cat("\n}\\par\\ql", file=TEMPREPORT, append=T)
The critical text is:
	jpegblip — which presumably informs the RTF reader that what follows is a JPEG 
	readBin — which reads the JPEG file

When the JPEG images are created, I also create identical PDF versions.  I would like, if possible, to “import” the PDF versions (instead of the JPEG versions) into the RTF document.
I see two issues:
1.  It is not obvious what should replace the jpegblip command
2.  Is readBin the appropriate command to embed the PDF

I realize that this is not strictly an R issue but support for R is far better than that for RTF.

Any help would be appreciated.

Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com



More information about the R-help mailing list