Skip to content

append to PDF file

6 messages · Kenneth Takagi, jim holtman, Christof Kluß +2 more

#
Hi

is there a way to append a plot as PDF to an existing PDF file?
savePlot seems not to have this possibility.

Christof
#
PDF files contain information at the end of them and so you cannot append without altering the file (universally true for PDF). Perhaps pdf() your plots and use external tools to convert the PDFs to .ps then re-merge. Might not be the best way, but an effective one. 
     Ken Hutchison
On Nov 26, 2554 BE, at 5:38 PM, Christof Klu? <ckluss at email.uni-kiel.de> wrote:

            
#
There is the 'pdftk' (PDF tool kit) that you will find on the web that
will do the job.  I have used it to both combine and split out the
pages in the PDF file.
On Sat, Nov 26, 2011 at 5:51 PM, Ken <vicvoncastle at gmail.com> wrote:

  
    
2 days later
#
Hi Jim, Hi Ken

Am 27-11-2011 00:00, schrieb jim holtman:
yes, thx. GUI tools like www.pdfsam.org do the job too. But is there a 
possibility to append files directly in R. That is to invoke "pdftk" 
inside R with a "shellandwait"?

perhaps something like

for (i in ...) {
   ...
   savePlot(filename="temp.pdf", type="pdf")
   exec pdftk temp.pdf final.pdf cat output final.pdf
}

greetings
Christof
#
I think you are looking for the system() command.

Michael
On Tue, Nov 29, 2011 at 7:11 AM, Christof Klu? <ckluss at email.uni-kiel.de> wrote:
#
On 29.11.2011 13:15, R. Michael Weylandt wrote:
... and you certainly do not want to use savePlot but rather use the 
pdf() device directly.

Uwe Ligges