renozao / FAQR

Frequently Asked Questions on R: my personal Ask Just Once system for my friends' R problems...
0 stars 0 forks source link

Add text to existing PDF files #13

Open Rachelly opened 8 years ago

Rachelly commented 8 years ago

I have an existing PDF file and want to add to each page a title taken from a character vector. Any idea how to do this?

I used the unix command "gs" to create the original PDF, which is a merge of specific pages from different PDF files, but couldn't find a way to add a stampq title using this command...: args = paste0(" -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=2 -dLastPage=2 -sOutputFile=summary_adj_GS.pdf ", files) system2("gs", args)

Rachelly commented 8 years ago

Another question regarding PDF manipulation - I would like to take every 2 pages in a PDF document and put the two plots in one page (one above the other one). How can this be done?

renozao commented 8 years ago

You could use knitr to generate a LaTeX document, including each pair of PDF files with the title before that. If you want to generate a slideshow, I would try using rmarkdown and render with output=beamer_presentation.