% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/graph2pdf.R
\name{graph2pdf}
\alias{graph2pdf}
\title{Output the Graphics to PDF Device}
\usage{
graph2pdf(
  outpdf,
  close = 0,
  paper = "a4r",
  height = 0,
  width = 0,
  onefile = TRUE,
  ...
)
}
\arguments{
\item{outpdf}{The output pdf file name.
When onefie=FALSE, give a C integer format such as "Rplot\%03d.pdf".}

\item{close}{= 1 to close the pdf device.}

\item{paper}{Size of the pdf paper: "a4", "letter", "legal"
and "executive", or "a4r" and "USr" for rotated (landscape.)}

\item{height}{Height of the pdf paper in mm (not inches)}

\item{width}{Width of the pdf paper  in mm (not inches)}

\item{onefile}{= FLASE to create many files.}

\item{...}{Other arguments to native pdf function.}
}
\description{
Output the Graphics to PDF Device
}
\details{
This function calls native pdf function as:\cr
\code{pdf(outpdf, paper=paper, height=height, width=width}
\code{, onefile=onefile, ... )} \cr
When paper=NULL or "special", the paper size will be determined by
width and hight.
\cr
The defalt paper size is "a4r" which is equivalent to: \cr
\code{paper="special", height=210, width=297}
}
\examples{
\dontrun{
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")

# put everything in one pdf file
graph2pdf("testestestest.pdf")
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")
graph2pdf(close=1)

# create one pdf file for each graph with automatic naming
graph2pdf("testestestest\%03d.pdf", onefile=FALSE)
plot(-5:5,(-5:5)^2, type="l", main="square")
plot(-5:5,(-5:5)^3, type="l", main="cubic")
graph2pdf(close=1)

# create one pdf file for each graph with specific name
for( i in 1:3 ){
 fname=paste("f", i, ".pdf", sep="")
 graph2pdf(fname)
 plot(-5:5,(-5:5)^i, type="l", main=i)
}
graph2pdf(close=1)

# default paper size: paper="a4r"
graph2pdf("test0.pdf")
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)

# ??
graph2pdf("test00.pdf", paper="a4")
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)


# paper size with width and height
graph2pdf("test1.pdf", paper="a4r", width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)

# Below two produces the same pdfs.
graph2pdf("test2.pdf", paper=NULL, width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)

graph2pdf("test3.pdf", paper="special", width=197, height=120)
plot(-5:5,(-5:5)^2, type="l", main="test")
graph2pdf(close=1)

}

}
