[R] Inserting an image into a PDF file

Marc Schwartz marc_schwartz at me.com
Sun Jul 11 18:33:56 CEST 2010

On Jul 11, 2010, at 10:51 AM, David Winsemius wrote:

> On Jul 11, 2010, at 11:06 AM, Dennis Fisher wrote:
>> Colleagues,
>> I am creating a PDF document from R using pdf(), the document contains text / images created with R.  I also have an image in either PDF / TIFF / JPEG format (in this case, a scanned image saved as a file).
>> I would like to insert the image into the PDF file.  Any ideas on how to accomplish this?
> http://www.stat.auckland.ac.nz/~paul/Talks/import.pdf
>> (OS X, R 2.11.1)

Just to offer an additional option since Dennis is on OSX, if you are on 10.6.x (Snow Leopard), you can view this YouTube video:


which describes how to combine/insert pages from multiple document types that OSX' Preview can open. 

If you are on Leopard (10.5.x), the drag and drop behavior, as noted in the above video, is somewhat different and you may wish to view this page:


This presumes that you want the scanned image on a separate page, rather than combined on the same page as your pdf() output. Since PDF is a native format on OSX, you can take advantage of built-in functionality to manipulate these files.

Of course using Sweave is yet another option.


Marc Schwartz

More information about the R-help mailing list