harupdf {harupdf} R Documentation

Haru PDF Graphics Device

Description

harupdf starts the graphics device driver for producing PDF graphics.

Usage

harupdf(file = ifelse(onefile, "Rplots.pdf", "Rplot%03d.pdf"),
    width, height, onefile, family, title, fonts, version,
    paper, encoding, bg, fg, pointsize, pagecentre, colormodel,
    useDingbats, useKerning, fillOddEven, maxRasters)

Arguments

file a character string giving the name of the file. For use with onefile=FALSE give a C integer format such as "Rplot%03d.pdf" (the default in that case). (See postscript for further details.)
width, height the width and height of the graphics region in inches. The default values are 7.
onefile logical: if true (the default) allow multiple figures in one file. If false, generate a file with name containing the page number for each page. Defaults to TRUE.
family the font family to be used, see postscript. Defaults to "Helvetica".
title title string to embed as the /Title field in the file. Defaults to "R Graphics Output".
fonts a character vector specifying R graphics font family names for fonts which will be included in the PDF file. Defaults to NULL.
version a string describing the PDF version that will be required to view the output. This is a minimum, and will be increased (with a warning) if necessary. Defaults to "1.4", but see ‘Details’.
paper the target paper size. The choices are "a4", "letter", "legal" (or "us") and "executive" (and these can be capitalized), or "a4r" and "USr" for rotated (‘landscape’). 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 as "a4" if it is unset or empty. Defaults "special".
encoding the name of an encoding file. See postscript for details. Defaults to "default".
bg the initial background color to be used. Defaults to "transparent".
fg the initial foreground color to be used. Defaults to "black".
pointsize the default point size to be used. Strictly speaking, in bp, that is 1/72 of an inch, but approximately in points. Defaults to 12.
pagecentre logical: should the device region be centred on the page? – is only relevant for paper != "special". Defaults to true.
colormodel a character string describing the color model: currently allowed values are "rgb", "gray" and "cmyk". Defaults to "rgb".
useDingbats logical. Should small circles be rendered via the Dingbats font? Defaults to TRUE, which produces smaller and better output. Setting this to FALSE can work around font display problems in broken PDF viewers.
useKerning logical. Should kerning corrections be included in setting text and calculating string widths? Defaults to TRUE.
fillOddEven logical controlling the polygon fill mode: see polygon for details. Default FALSE.
maxRasters integer. The maximum number of raster images that can be stored in this PDF document.

Details

All arguments are same as pdf() function. maxRasters is igorned by harupdf device. Harupdf device use Haru Library to manage a raster array, so this parameter is not necessary.

pdf writes uncompressed PDF. but harupdf can write PDF file with compressed images. So two functions for image drawing are provided in harupdf, drawPng and drawJpeg.

harupdf can append an outline(or inner bookmark) for PDF document. In the procedure of page drawing, addOutline can set outline(or bookmark) into PDF document.

Haru PDF library: http://libharu.org/

Conventions

This section describes the implementation of the conventions for graphics devices set out in the “R Internals Manual”.

Actually, these default values are same as pdf().

Note

The following points you should know before you use harupdf function.

If you have any questions on using this package, please send a mail to zzw2@psu.edu

See Also

drawPng, drawJpeg, addOutline

Examples

require(harupdf);

#Create a PDF file
harupdf(file="c:\temp\haru_test.pdf", paper="letter", width=7, height=9.5);

plot(100:800, 100:800, type="l", xlim=c(0, 700), ylim=c(-100, +850), col="blue", lwd=0.25 );

#append a root outline(or bookmark)
addOutline(".", "X", "Main Title");

#draw a JPEG image inside this plot
drawJpeg("C:\temp\huge_jpg.jpg",100,100,900,300,0);

#close device and output file
dev.off();


[Package harupdf version 2.12.0 Index]