pdfcrop: Interface to the 'pdfcrop' tool shipped with LaTeX

Description Usage Arguments Value Author(s) See Also Examples

Description

Cropping of PDF files using the pdfcrop comand line tool by Heiko Oberdiek.

Usage

1
2
pdfcrop(fileName, outFileName = paste(stringr::str_sub(fileName, 1L, -5L),
  "_cr.pdf", sep = ""), margins = NULL)

Arguments

fileName

character string denoting the path/ name of the input PDF file

outFileName

character string denoting the name of the output PDF file. If not specified, "_cr.pdf" is appended to fileName.

margins

numeric vector defining how many points of all four white margins are cropped away (left, top, right, bottom) in addition to the automatic cropping. Negative values mean that white space is added instead of cropped away. If NULL, the default, the underlying pdfcrop tool tries to automatically crop all margins.

Value

Returns nothing, but as a side effect saves the cropped .pdf file.

Author(s)

Christoph Schmidt <schmidtchristoph@users.noreply.github.com>

See Also

knitr plot_crop, pdfcrop https://www.ctan.org/pkg/pdfcrop?lang=en

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(networkD3)
data(MisLinks)
data(MisNodes)
p <- forceNetwork(Links = MisLinks, Nodes = MisNodes,
             Source = "source", Target = "target",
             Value = "value", NodeID = "name",
             Group = "group", opacity = 0.9,
             height = 900, width = 900)

# generated pdf needs a serious cropping
jsGraphic2Pdf(p, c(900, 900, 20, 20), slow = TRUE)

# in this case, automatic results (no margins given) are not good enough
pdfcrop("JSgraphic.pdf", "JSgraphicCr.pdf")

# manually setting margin produces a better result
pdfcrop("JSgraphic.pdf", "JSgraphicCr2.pdf", margins = c(2, 1, 93, 2))

file.remove(c("JSgraphic.pdf", "JSgraphicCr.pdf", "JSgraphicCr2.pdf"))

schmidtchristoph/js2graphic documentation built on May 21, 2019, 10:08 a.m.