Skip to content

Commit

Permalink
Merge pull request #289 from rstudio/imagemagick-pdf
Browse files Browse the repository at this point in the history
Enable image magick ghostscript features
  • Loading branch information
samperman authored Apr 13, 2021
2 parents 122711e + 0e09f95 commit 3a85e9d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ touch packages/[r_package_name]/test.R

```bash
make test-xenial-[r_package_name]
make test-bionic-[r_package_name]
make test-focal-[r_package_name]
```
9 changes: 9 additions & 0 deletions packages/magick/install
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ if [ ${OS_CODENAME} == "xenial" ]; then
fi

apt-get install -y libmagick++-dev


if [ ${OS_CODENAME} == "focal" ]; then
# Enable imagemagick ghostscript features
# See https://www.kb.cert.org/vuls/id/332928/
# focal has a new enough version of ghostscript
sed -i "\$i \ \ <policy domain=\"coder\" rights=\"read | write\" pattern=\"{PS,PS2,PS3,EPS,PDF,XPS}\" />" /etc/ImageMagick-6/policy.xml
fi

8 changes: 8 additions & 0 deletions packages/magick/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ install.packages("magick", repos = "https://cran.rstudio.com")
library(magick)
docdir <- Sys.getenv("R_DOC_DIR", R.home("doc"))
img <- magick::image_read(file.path(docdir, "html", "logo.jpg"))

# Create a pdf
image_write(wizard,
tempfile(pattern = "pdftemp", fileext = '.pdf'),
density = 55,
format = 'pdf',
comment = "Edit PDFs and Images"
)

0 comments on commit 3a85e9d

Please sign in to comment.