Closed lodderig closed 6 years ago
I just came across this myself.
The solution seems to just be setting pdf_render_page()
's numeric=
argument to TRUE
so the output is the raw array.
bitmap <- pdf_render_page(news, dpi = 300,
numeric = TRUE) # the modification
tiff::writeTIFF(bitmap, "page.tiff")
@jeroen Here's a starting point when you get a chance to investigate. The error that tiff::writeTIFF()
throws is confusing, but a README and documentation fix is probably all it needs. I've been meaning to actually start contributing to packages where I can, but I don't know when I'll actually take the plunge. Cheers.
num_TRUE_bitmap <- pdf_render_page(news, dpi = 300,
numeric = TRUE)
tiff::writeTIFF(num_TRUE_bitmap, "page.tiff")
class(num_TRUE_bitmap)
# [1] "array"
num_FALSE_bitmap <- pdf_render_page(news, dpi = 300,
numeric = FALSE)
tiff::writeTIFF(num_FALSE_bitmap, "page.tiff")
# Error in tiff::writeTIFF(num_FALSE_bitmap, "page.tiff") :
# INTEGER() can only be applied to a 'integer', not a 'raw'
class(num_FALSE_bitmap)
# [1] "bitmap" "rgba"
updated the readme
I am unable to run the Tesseract example
tiff::writeTIFF
triggers an error