pdf                package:grDevices                R Documentation

_P_D_F _G_r_a_p_h_i_c_s _D_e_v_i_c_e

_D_e_s_c_r_i_p_t_i_o_n:

     'pdf' starts the graphics device driver for producing PDF
     graphics.

_U_s_a_g_e:

     pdf(file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"),
         width = 6, height = 6, onefile = TRUE, family = "Helvetica",
         title = "R Graphics Output", fonts = NULL, version = "1.1",
         paper, encoding, bg, fg, pointsize)

_A_r_g_u_m_e_n_t_s:

    file: a character string giving the name of the file.

width, height: the width and height of the graphics region in inches.

 onefile: logical: if true (the default) allow multiple figures in one
          file.  If false, generate a file name containing the page
          number.

  family: the font family to be used, one of '"AvantGarde"',
          '"Bookman"', '"Courier"', '"Helvetica"',
          '"Helvetica-Narrow"', '"NewCenturySchoolbook"', '"Palatino"'
          or '"Times"'.  *Note* the other specifications allowed for
          'postscript' are *not* available.

   title: title string to embed in the file.

   paper: the size of paper in the printer.  The choices are '"a4"',
          '"letter"', '"legal"' and '"executive"' (and these can be
          capitalized). The default is '"special"', which means that
          the 'width' and 'height' specify the paper size.  A further
          choice is '"default"'; if this is selected, the papersize is
          taken from the option '"papersize"' if that is set and to
          '"a4"' if it is unset or empty.

encoding: the name of an encoding file.  Defaults to '"ISOLatin1.enc"'
          in the 'R_HOME/afm' directory, which is used if the path does
          not contain a path separator.  An extension '".enc"' can be
          omitted. In a UTF-8 locale only '"ISOLatin1.enc"' is allowed. 

pointsize: the default point size to be used.

      bg: the default background color to be used.

      fg: the default foreground color to be used.

   fonts: a character vector specifying device-independent R graphics
          font family names for fonts which will be included in the PDF
          file.

 version: a string describing the PDF version that will be used to
          produce output.

_D_e_t_a_i_l_s:

     'pdf()' opens the file 'file' and the PDF commands needed to plot
     any graphics requested are sent to that file.

     The 'family' argument can be used to specify either a
     device-independent R graphics font family (see 'postscriptFonts')
     or a PDF-specific font family as the initial/default font for the
     device.

     If a device-independent R graphics font family is specified (e.g.,
     via 'par(family=)' in the graphics package), the PDF device makes
     use of the PostScript font mappings to convert the R graphics font
     family to a PDF-specific font family description.  R does _not_
     embed fonts in the PDF file though, so it is only possible to use
     mappings to the font families that are assumed to be available in
     a PDF viewer: '"Times"' or '"Times New Roman"', '"Helvetica"' or
     '"Arial"', '"Courier"', '"Symbol"', and '"ZapfDingbats"'.

     See 'postscript' for details of encodings, as the internal code is
     shared between the drivers.  The native PDF encoding is given in
     file 'PDFDoc.enc'.

     'pdf' writes uncompressed PDF.  It is primarily intended for
     producing PDF graphics for inclusion in other documents, and
     PDF-includers such as 'pdftex' are usually able to handle
     compression.

     At present the PDF is fairly simple, with each page being
     represented as a single stream.  The R graphics model does not
     distinguish graphics objects at the level of the driver interface.

     The 'version' argument modifies the sort of PDF code that gets
     produced.  At the moment this only concerns the production of
     transparent output.  The version must be greater than 1.4 for
     transparent output to be produced.  Specifying a lower version
     number may be useful if you want to produce PDF output that can be
     viewed on older PDF viewers.

     Line widths as controlled by 'par(lwd=)' are in multiples of
     1/96inch.  Multiples less than 1 are allowed.  'pch="."' with 'cex
     = 1' corresponds to a square of side 1/72 inch.

_N_o_t_e:

     Acrobat Reader does not use the fonts specified but rather
     emulates them from multiple-master fonts.  This can be seen in
     imprecise centering of characters, for example the multiply and
     divide signs in Helvetica.

_S_e_e _A_l_s_o:

     'postscriptFonts', 'Devices', 'postscript'

_E_x_a_m_p_l_e_s:

     ## Not run: 
     ## Test function for encodings
     TestChars <- function(encoding="ISOLatin1", ...)
     {
         pdf(encoding=encoding, ...)
         par(pty="s")
         plot(c(-1,16), c(-1,16), type="n", xlab="", ylab="", xaxs="i", yaxs="i")
         title(paste("Centred chars in encoding", encoding))
         grid(17, 17, lty=1)
         for(i in c(32:255)) {
             x <- i 
             y <- i 
             points(x, y, pch=i)
         }
         dev.off()
     }
     ## there will be many warnings.
     TestChars("ISOLatin2")
     ## doesn't view properly in US-spec Acrobat 5.05, but gs7.04 works.
     ## Lots of characters are not centred.
     ## End(Not run)

