1+ # Tesseract ----
2+
13if (! file.exists(" ../windows/tesseract/include/tesseract/baseapi.h" )){
24 unlink(" ../windows" , recursive = TRUE )
35 url <- if (grepl(" aarch" , R.version $ platform )){
4- " https://github.com/r-windows/bundles /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-aarch64.tar.xz"
6+ " https://github.com/pachadotdev/cpp11tesseract /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-aarch64.tar.xz"
57 } else if (grepl(" clang" , Sys.getenv(' R_COMPILED_BY' ))){
6- " https://github.com/r-windows/bundles /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-x86_64.tar.xz"
8+ " https://github.com/pachadotdev/cpp11tesseract /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-clang-x86_64.tar.xz"
79 } else if (getRversion() > = " 4.3" ) {
8- " https://github.com/r-windows/bundles /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-ucrt-x86_64.tar.xz"
10+ " https://github.com/pachadotdev/cpp11tesseract /releases/download/tesseract-5.3.2/tesseract-ocr-5.3.2-ucrt-x86_64.tar.xz"
911 } else {
1012 " https://github.com/rwinlib/tesseract/archive/v5.3.2.tar.gz"
1113 }
@@ -17,17 +19,36 @@ if(!file.exists("../windows/tesseract/include/tesseract/baseapi.h")){
1719 file.rename(list.files(), ' tesseract' )
1820}
1921
20- # Also download the english training data
2122dir.create(" ../windows/tessdata" , showWarnings = FALSE )
2223if (! file.exists(" ../windows/tessdata/eng.traineddata" )){
2324 message(" Downloading eng.traineddata..." )
2425 download.file(" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/eng.traineddata" ,
2526 " ../windows/tessdata/eng.traineddata" , mode = " wb" , quiet = TRUE )
2627}
2728
28- # This is base training data for Orientation and Script Detection
2929if (! file.exists(" ../windows/tessdata/osd.traineddata" )){
3030 message(" Downloading osd.traineddata..." )
3131 download.file(" https://github.com/tesseract-ocr/tessdata_fast/raw/4.1.0/osd.traineddata" ,
3232 " ../windows/tessdata/osd.traineddata" , mode = " wb" , quiet = TRUE )
3333}
34+
35+ # Poppler ----
36+
37+ if (! file.exists(" ../windows/poppler/include/poppler/cpp/poppler-document.h" )) {
38+ unlink(" ../windows" , recursive = TRUE )
39+ url <- if (grepl(" aarch" , R.version $ platform )) {
40+ " https://github.com/pachadotdev/cpp11tesseract/releases/download/poppler-23.08.0/poppler-23.08.0-clang-aarch64.tar.xz"
41+ } else if (grepl(" clang" , Sys.getenv(" R_COMPILED_BY" ))) {
42+ " https://github.com/pachadotdev/cpp11tesseract/releases/download/poppler-23.08.0/poppler-23.08.0-clang-x86_64.tar.xz"
43+ } else if (getRversion() > = " 4.3" ) {
44+ " https://github.com/pachadotdev/cpp11tesseract/releases/download/poppler-23.08.0/poppler-23.08.0-ucrt-x86_64.tar.xz"
45+ } else {
46+ " https://github.com/rwinlib/poppler/archive/v22.04.0-2.tar.gz"
47+ }
48+ download.file(url , basename(url ), quiet = TRUE )
49+ dir.create(" ../windows" , showWarnings = FALSE )
50+ untar(basename(url ), exdir = " ../windows" , tar = " internal" )
51+ unlink(basename(url ))
52+ setwd(" ../windows" )
53+ file.rename(list.files(), " poppler" )
54+ }
0 commit comments