3

I am trying to save a table created in the Kable package in R Markdown. This has always worked for me in the past, but today when I try, using 'save_kable("X.pdf")' on any of my tables, I get the following error message:

Error in magick_image_readpath(enc2native(path), density, depth, strip) : rsession: FailedToExecuteCommand `'gs' -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r72x72' '-sOutputFile=/var/folders/qc/xs3g8dsx4g11rjbt0rf35dj00000gq/T//RtmpaRzbJq/magick-43640eHHAxmi4Z6n5%d' '-f/var/folders/qc/xs3g8dsx4g11rjbt0rf35dj00000gq/T//RtmpaRzbJq/magick-436404K7X59eUrjJR' '-f/var/folders/qc/xs3g8dsx4g11rjbt0rf35dj00000gq/T//RtmpaRzbJq/magick-43640Xy025Mi88F3t'' (1) @ error/pdf.c/InvokePDFDelegate/292

I have restarted R Studio and tried again but it doesn't change anything. Does anyone know what this error message means or how to solve it?

J_F
  • 9,956
  • 2
  • 31
  • 55
JRB
  • 233
  • 1
  • 9
  • 1
    Check to be sure that ImageMagick convert -version shows that you have Ghostscript installed. If it is there, then it may be that you need to edit your ImageMagick policy.xml file to permit the reading and writing of PDF. See https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image/52863413#52863413 – fmw42 Mar 01 '20 at 19:27
  • Thank you. Please could you advise on how I would check this in R? – JRB Mar 02 '20 at 09:01
  • Sorry, I do not know R. – fmw42 Mar 02 '20 at 22:51
  • 1
    Did you resolve this problem? I am facing the same error. would love any suggestions or hints. – Abhishek Sourabh Dec 03 '21 at 11:28

1 Answers1

0

I had the same problem. I resolved it by installing GhostScript on the machine.