pdfPageExtract: Interface to 'gs' to extract a range of pages from a PDF file

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/pdfPageExtract.R

Description

Extract a range of pages from a PDF file. Preserves hyperlinks that fall within the selected page range.

Usage

1
pdfPageExtract(fileName, firstP = NULL, lastP = NULL, outFileName = NULL)

Arguments

fileName

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

firstP

integer denoting the first extracted page

lastP

integer denoting the last extracted page

outFileName

character string denoting the name of the output PDF file. If not specified, it is "[fileName]_pages[firstP]_[lastP].pdf".

Value

Returns nothing, but as a side effect saves the extracted pages as a new .pdf file.

Note

This function is based on Ghostscript.

Author(s)

Christoph Schmidt <[email protected]com>

See Also

GPL Ghostscript https://www.ghostscript.com

Examples

1
2
3
4
5
6
7
8
library(d3heatmap)
p <- d3heatmap(mtcars, scale = "column", colors = "Blues")
# pdf contains three pages (1 plot, 2 empty ones)
jsGraphic2Pdf(p, c(2500, 2000, 50, 50))
pdfPageExtract("JSgraphic.pdf", 1, 1)
pdfPageExtract("JSgraphic.pdf", 1, 1, "JSgraphic.pdf")

file.remove("JSgraphic.pdf", "JSgraphic_pages1_1.pdf", "JSgraphic_extr.pdf")

schmidtchristoph/js2graphic documentation built on July 8, 2018, 4:10 p.m.