fix #519, change from 'class' comparison to 'inherits'
diff --git a/R/kable_as_image.R b/R/kable_as_image.R
index ffe18be..6a0098d 100644
--- a/R/kable_as_image.R
+++ b/R/kable_as_image.R
@@ -67,7 +67,7 @@
     table_img_pdf <- try(magick::image_read(paste0(temp_file, ".pdf"),
                                             density = density),
                          silent = T)
-    if (class(table_img_pdf) == "try-error") {
+    if (inherits(table_img_pdf, "try-error")) {
       stop("Ghostscript is required to read PDF on windows. ",
            "Please download it here: https://ghostscript.com/")
     }