k2pdfopt: remove package
* We've never shipped this package, the build was always broken. * Build fail continously * Even the successful build will crash because stack smashed.
This commit is contained in:
parent
d4398a745f
commit
7190a28ddd
|
@ -1,87 +0,0 @@
|
||||||
diff --git CMakeLists.txt CMakeLists.txt
|
|
||||||
index 4a2378b5e9..2ed0ccca4b 100644
|
|
||||||
--- CMakeLists.txt
|
|
||||||
+++ CMakeLists.txt
|
|
||||||
@@ -54,0 +55 @@
|
|
||||||
+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${JASPER_LIBRARY})
|
|
||||||
@@ -57,11 +58 @@
|
|
||||||
-# paths from willuslib/wgs.c
|
|
||||||
-find_program(GHOSTSCRIPT_EXECUTABLE gs
|
|
||||||
-# PATHS /usr/bin /usr/share/gs /usr/local/gs /opt/gs
|
|
||||||
-# /usr/share/gs* /usr/local/gs* /opt/gs*
|
|
||||||
-)
|
|
||||||
-if(GHOSTSCRIPT_EXECUTABLE)
|
|
||||||
- set(HAVE_GHOSTSCRIPT 1)
|
|
||||||
- message(STATUS "Found ghostscript executable")
|
|
||||||
-else()
|
|
||||||
- message(STATUS "Could NOT find ghostscript executable")
|
|
||||||
-endif(GHOSTSCRIPT_EXECUTABLE)
|
|
||||||
+set(HAVE_GHOSTSCRIPT 1)
|
|
||||||
@@ -70 +60,0 @@
|
|
||||||
-# HAVE_GSL_LIB
|
|
||||||
@@ -71,0 +62,6 @@
|
|
||||||
+pkg_check_modules(GSL gsl)
|
|
||||||
+if(GSL_FOUND)
|
|
||||||
+ set(HAVE_GSL_LIB 1)
|
|
||||||
+ include_directories(SYSTEM ${GSL_INCLUDEDIR})
|
|
||||||
+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${GSL_LDFLAGS})
|
|
||||||
+endif(GSL_FOUND)
|
|
||||||
@@ -76,2 +71,0 @@
|
|
||||||
-pkg_check_modules(MUPDF mupdf)
|
|
||||||
-if(MUPDF_FOUND)
|
|
||||||
@@ -79,7 +73 @@
|
|
||||||
- # (includes jbig2dec, openjpeg, freetype)
|
|
||||||
- include_directories(SYSTEM ${MUPDF_INCLUDEDIR})
|
|
||||||
- message(STATUS "mupdf libraries: ${MUPDF_LDFLAGS}")
|
|
||||||
- set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${MUPDF_LDFLAGS}
|
|
||||||
- -lmupdf-js-none -lopenjpeg -ljbig2dec -ljpeg -lfreetype
|
|
||||||
- )
|
|
||||||
-endif(MUPDF_FOUND)
|
|
||||||
+set(K2PDFOPT_LIB ${K2PDFOPT_LIB} -pthread -lmupdf -lmupdf-third -lopenjp2 -ljbig2dec -lfreetype -lharfbuzz)
|
|
||||||
@@ -95,2 +91,14 @@
|
|
||||||
-# HAVE_LEPTONICA_LIB
|
|
||||||
-# HAVE_TESSERACT_LIB
|
|
||||||
+
|
|
||||||
+pkg_check_modules(LEPTONICA lept)
|
|
||||||
+if(LEPTONICA_FOUND)
|
|
||||||
+ set(HAVE_LEPTONICA_LIB 1)
|
|
||||||
+ include_directories(SYSTEM ${LEPTONICA_INCLUDEDIR})
|
|
||||||
+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${LEPTONICA_LDFLAGS} ${LEPTONICA_LIBRARIES})
|
|
||||||
+endif(LEPTONICA_FOUND)
|
|
||||||
+
|
|
||||||
+pkg_check_modules(TESSERACT tesseract)
|
|
||||||
+if(TESSERACT_FOUND)
|
|
||||||
+ set(HAVE_TESSERACT_LIB 1)
|
|
||||||
+ include_directories(SYSTEM ${TESSERACT_INCLUDEDIR})
|
|
||||||
+ set(K2PDFOPT_LIB ${K2PDFOPT_LIB} ${TESSERACT_LDFLAGS})
|
|
||||||
+endif(TESSERACT_FOUND)
|
|
||||||
@@ -100 +108 @@
|
|
||||||
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CMAKE -Wall")
|
|
||||||
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_CMAKE -Wall -Wextra")
|
|
||||||
@@ -108,0 +117,2 @@
|
|
||||||
+include_directories(${PROJECT_BINARY_DIR})
|
|
||||||
+
|
|
||||||
@@ -112 +121,0 @@
|
|
||||||
-# ms
|
|
||||||
@@ -114 +123 @@
|
|
||||||
-target_link_libraries (k2pdfopt k2pdfoptlib willuslib ${K2PDFOPT_LIB})
|
|
||||||
+target_link_libraries(k2pdfopt k2pdfoptlib willuslib ${K2PDFOPT_LIB})
|
|
||||||
@@ -115,0 +125 @@
|
|
||||||
+install(TARGETS k2pdfopt RUNTIME DESTINATION bin)
|
|
||||||
diff --git willuslib/CMakeLists.txt willuslib/CMakeLists.txt
|
|
||||||
index 463bbc95e7..104d02e360 100644
|
|
||||||
--- willuslib/CMakeLists.txt
|
|
||||||
+++ willuslib/CMakeLists.txt
|
|
||||||
@@ -9 +9 @@
|
|
||||||
- ocrjocr.c ocrtess.c pdfwrite.c point2d.c render.c strbuf.c string.c
|
|
||||||
+ ocrgocr.c ocrtess.c pdfwrite.c point2d.c render.c strbuf.c string.c
|
|
||||||
@@ -24,0 +25,4 @@
|
|
||||||
+if(TESSERACT_FOUND)
|
|
||||||
+ set(WILLUSLIB_SRC ${WILLUSLIB_SRC} ocrtess.c)
|
|
||||||
+endif(TESSERACT_FOUND)
|
|
||||||
+
|
|
||||||
@@ -29,3 +33 @@
|
|
||||||
-# HAVE_GOCR_LIB: ocrjocr.c
|
|
||||||
-# HAVE_TESSERACT_LIB: ocrtess.c
|
|
||||||
-
|
|
||||||
+# HAVE_GOCR_LIB: ocrgocr.c
|
|
|
@ -1,83 +0,0 @@
|
||||||
diff --git willuslib/gslpolyfit.c willuslib/gslpolyfit.c
|
|
||||||
index 5d2b6fbb85..f127bf054f 100644
|
|
||||||
--- willuslib/gslpolyfit.c
|
|
||||||
+++ willuslib/gslpolyfit.c
|
|
||||||
@@ -24,7 +24,10 @@
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "willus.h"
|
|
||||||
#ifdef HAVE_GSL_LIB
|
|
||||||
-#include <gsl.h>
|
|
||||||
+#include <gsl/gsl_poly.h>
|
|
||||||
+#include <gsl/gsl_vector.h>
|
|
||||||
+#include <gsl/gsl_multifit.h>
|
|
||||||
+#include <gsl/gsl_matrix.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void gslpolyfit(double *x,double *y0,int n,int d,double *c0)
|
|
||||||
diff --git willuslib/bmp.c willuslib/bmp.c
|
|
||||||
index 583644d565..b2c36d5673 100644
|
|
||||||
--- willuslib/bmp.c
|
|
||||||
+++ willuslib/bmp.c
|
|
||||||
@@ -37,7 +37,7 @@
|
|
||||||
#include <jpeglib.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_JASPER_LIB
|
|
||||||
-#include <jasper.h>
|
|
||||||
+#include <jasper/jasper.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BOUND(x,xmin,xmax) if ((x)<(xmin)) (x)=(xmin); else { if ((x)>(xmax)) (x)=(xmax); }
|
|
||||||
diff --git willuslib/ocrtess.c willuslib/ocrtess.c
|
|
||||||
index e1366e1aab..58aaf97fb9 100644
|
|
||||||
--- willuslib/ocrtess.c
|
|
||||||
+++ willuslib/ocrtess.c
|
|
||||||
@@ -24,8 +24,9 @@
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
-#include <leptonica.h>
|
|
||||||
-#include <tesseract.h>
|
|
||||||
+#include <locale.h>
|
|
||||||
+#include <leptonica/allheaders.h>
|
|
||||||
+#include <tesseract/capi.h>
|
|
||||||
#include "willus.h"
|
|
||||||
|
|
||||||
|
|
||||||
diff --git willuslib/wleptonica.c willuslib/wleptonica.c
|
|
||||||
index a4e3cfd61d..a85be0949d 100644
|
|
||||||
--- willuslib/wleptonica.c
|
|
||||||
+++ willuslib/wleptonica.c
|
|
||||||
@@ -23,7 +23,7 @@
|
|
||||||
#include "willus.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_LEPTONICA_LIB
|
|
||||||
-#include <leptonica.h>
|
|
||||||
+#include <leptonica/allheaders.h>
|
|
||||||
|
|
||||||
static void wlept_pix_from_bmp(PIX **pixptr,WILLUSBITMAP *bmp);
|
|
||||||
static void wlept_bmp_from_pix(WILLUSBITMAP *bmp,PIX *pix);
|
|
||||||
@@ -135,7 +135,7 @@ pixWrite("pixb.png",pixb,IFF_PNG);
|
|
||||||
dew1=dewarpCreate(pixb,1);
|
|
||||||
pixDestroy(&pixb);
|
|
||||||
dewarpaInsertDewarp(dewa,dew1);
|
|
||||||
- dewarpBuildPageModel_ex(dew1,debug,fit_order);
|
|
||||||
+ dewarpBuildPageModel(dew1,debug);
|
|
||||||
if (bmp1!=NULL)
|
|
||||||
{
|
|
||||||
PIX *pix2,*pix2d;
|
|
||||||
|
|
||||||
diff --git willuslib/wmupdf.c willuslib/wmupdf.c
|
|
||||||
index 81627efd4c..fcab84c1db 100644
|
|
||||||
--- willuslib/wmupdf.c
|
|
||||||
+++ willuslib/wmupdf.c
|
|
||||||
@@ -189,8 +189,8 @@ int wmupdf_remake_pdf(char *infile,char *outfile,WPDFPAGEINFO *pageinfo,int use_
|
|
||||||
pdf_write_opts.do_compress=1;
|
|
||||||
pdf_write_opts.do_linear=0;
|
|
||||||
pdf_write_opts.do_garbage=1; /* 2 and 3 don't work for this. */
|
|
||||||
- pdf_write_opts.continue_on_error=0;
|
|
||||||
- pdf_write_opts.errors=NULL;
|
|
||||||
+ //pdf_write_opts.continue_on_error=0;
|
|
||||||
+ //pdf_write_opts.errors=NULL;
|
|
||||||
write_failed=0;
|
|
||||||
wpdfpageinfo_sort(pageinfo);
|
|
||||||
xref=NULL;
|
|
|
@ -1,262 +0,0 @@
|
||||||
diff -r -u0 willuslib/ocrtess.c willuslib/ocrtess.c
|
|
||||||
--- willuslib/ocrtess.c 2018-12-31 19:59:58.000000000 +0100
|
|
||||||
+++ willuslib/ocrtess.c 2019-07-27 18:47:06.706765733 +0200
|
|
||||||
@@ -29,0 +30,258 @@
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+** ocr_type=0: OEM_DEFAULT
|
|
||||||
+** ocr_type=1: OEM_TESSERACT_ONLY
|
|
||||||
+** ocr_type=2: OEM_LSTM_ONLY
|
|
||||||
+** ocr_type=3: OEM_TESSERACT_LSTM_COMBINED
|
|
||||||
+*/
|
|
||||||
+void *tess_capi_init(char *datapath,char *language,int ocr_type,FILE *out,
|
|
||||||
+ char *initstr,int maxlen,int *status)
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ char original_locale[256];
|
|
||||||
+ TessBaseAPI *api = TessBaseAPICreate();
|
|
||||||
+
|
|
||||||
+ /* willus mod, 11-24-16 */
|
|
||||||
+ /* Tesseract needs "C" locale to correctly parse all data .traineddata files. */
|
|
||||||
+
|
|
||||||
+ strncpy(original_locale,setlocale(LC_ALL,NULL),255);
|
|
||||||
+ original_locale[255]='\0';
|
|
||||||
+ setlocale(LC_ALL,"C");
|
|
||||||
+
|
|
||||||
+ // Make the order of args a bit more forgiving than it used to be.
|
|
||||||
+ const char* lang = "eng";
|
|
||||||
+ TessPageSegMode pagesegmode = PSM_SINGLE_BLOCK;
|
|
||||||
+ if (language!=NULL && language[0]!='\0')
|
|
||||||
+ lang = language;
|
|
||||||
+
|
|
||||||
+/*
|
|
||||||
+v4.00 loads either TESSERACT enginer, LSTM engine, or both. No CUBE.
|
|
||||||
+*/
|
|
||||||
+ ocr_type=0; /* Ignore specified and use default */
|
|
||||||
+ TessBaseAPISetOutputName(api, NULL);
|
|
||||||
+ (*status)=TessBaseAPIInit2(api, datapath,lang,
|
|
||||||
+ ocr_type==0 ? OEM_DEFAULT :
|
|
||||||
+ (ocr_type==1 ? OEM_TESSERACT_ONLY :
|
|
||||||
+ (ocr_type==2 ? OEM_LSTM_ONLY :
|
|
||||||
+ (OEM_TESSERACT_LSTM_COMBINED))));
|
|
||||||
+ if ((*status)!=0)
|
|
||||||
+ {
|
|
||||||
+ /* willus mod, 11-24-16 */
|
|
||||||
+ setlocale(LC_ALL,original_locale);
|
|
||||||
+ TessBaseAPIEnd(api);
|
|
||||||
+ TessBaseAPIDelete(api);
|
|
||||||
+ return(NULL);
|
|
||||||
+ }
|
|
||||||
+ /*
|
|
||||||
+ api.Init("tesscapi",lang,tesseract::OEM_DEFAULT,
|
|
||||||
+ &(argv[arg]), argc - arg, NULL, NULL, false);
|
|
||||||
+ */
|
|
||||||
+ // We have 2 possible sources of pagesegmode: a config file and
|
|
||||||
+ // the command line. For backwards compatability reasons, the
|
|
||||||
+ // default in tesseract is tesseract::PSM_SINGLE_BLOCK, but the
|
|
||||||
+ // default for this program is tesseract::PSM_AUTO. We will let
|
|
||||||
+ // the config file take priority, so the command-line default
|
|
||||||
+ // can take priority over the tesseract default, so we use the
|
|
||||||
+ // value from the command line only if the retrieved mode
|
|
||||||
+ // is still tesseract::PSM_SINGLE_BLOCK, indicating no change
|
|
||||||
+ // in any config file. Therefore the only way to force
|
|
||||||
+ // tesseract::PSM_SINGLE_BLOCK is from the command line.
|
|
||||||
+ // It would be simpler if we could set the value before Init,
|
|
||||||
+ // but that doesn't work.
|
|
||||||
+ if (TessBaseAPIGetPageSegMode(api) == PSM_SINGLE_BLOCK)
|
|
||||||
+ TessBaseAPISetPageSegMode(api, pagesegmode);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ ** Initialization message
|
|
||||||
+ */
|
|
||||||
+ {
|
|
||||||
+ char istr[1024];
|
|
||||||
+
|
|
||||||
+// printf("tessedit_ocr_engine_mode = %d\n",tessedit_ocr_engine_mode);
|
|
||||||
+ sprintf(istr,"%s",TessVersion());
|
|
||||||
+ sprintf(&istr[strlen(istr)],"\n Tesseract data folder = '%s'",datapath==NULL?getenv("TESSDATA_PREFIX"):datapath);
|
|
||||||
+ strcat(istr,"\n Tesseract languages: ");
|
|
||||||
+ char** languages = TessBaseAPIGetAvailableLanguagesAsVector(api);
|
|
||||||
+/*
|
|
||||||
+printf("OEM=%d\n",api->oem());
|
|
||||||
+printf("Langs='%s'\n",api->GetInitLanguagesAsString());
|
|
||||||
+printf("AnyTessLang()=%d\n",(int)api->tesseract()->AnyTessLang());
|
|
||||||
+printf("AnyLSTMLang()=%d\n",(int)api->tesseract()->AnyLSTMLang());
|
|
||||||
+printf("num_sub_langs()=%d\n",api->tesseract()->num_sub_langs());
|
|
||||||
+printf("languages.size()=%d\n",(int)languages.size());
|
|
||||||
+*/
|
|
||||||
+ char* l = languages;
|
|
||||||
+ int eng = 0;
|
|
||||||
+ TessBaseAPI *lang1;
|
|
||||||
+ while (l != NULL)
|
|
||||||
+ {
|
|
||||||
+ eng=(int)TessBaseAPIOem(api);
|
|
||||||
+ sprintf(&istr[strlen(istr)],"%s%s [%s]",l==languages?"":", ",l,
|
|
||||||
+ eng==2?"LSTM+Tess":(eng==1?"LSTM":"Tess"));
|
|
||||||
+ l++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ TessDeleteTextArray(languages);
|
|
||||||
+
|
|
||||||
+ /*
|
|
||||||
+ if (ocr_type==0 || ocr_type==3)
|
|
||||||
+ sprintf(&istr[strlen(istr)],"[LSTM+] (lang=");
|
|
||||||
+ else if (ocr_type==2)
|
|
||||||
+ sprintf(&istr[strlen(istr)],"[LSTM] (lang=");
|
|
||||||
+ strncpy(&istr[strlen(istr)],language,253-strlen(istr));
|
|
||||||
+ istr[253]='\0';
|
|
||||||
+ strcat(istr,")");
|
|
||||||
+ */
|
|
||||||
+ if (out!=NULL)
|
|
||||||
+ fprintf(out,"%s\n",istr);
|
|
||||||
+ if (initstr!=NULL)
|
|
||||||
+ {
|
|
||||||
+ strncpy(initstr,istr,maxlen-1);
|
|
||||||
+ initstr[maxlen-1]='\0';
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+ /* Turn off LSTM debugging output */
|
|
||||||
+ TessBaseAPISetVariable(api,"lstm_debug_level","0");
|
|
||||||
+#if (WILLUSDEBUG & 1)
|
|
||||||
+ TessBaseAPISetVariable(api,"lstm_debug_level","9");
|
|
||||||
+ TessBaseAPISetVariable(api,"paragraph_debug_level","9");
|
|
||||||
+ TessBaseAPISetVariable(api,"tessdata_manager_debug_level","9");
|
|
||||||
+ TessBaseAPISetVariable(api,"tosp_debug_level","9");
|
|
||||||
+ TessBaseAPISetVariable(api,"wordrec_debug_level","9");
|
|
||||||
+ TessBaseAPISetVariable(api,"segsearch_debug_level","9");
|
|
||||||
+#endif
|
|
||||||
+ /* willus mod, 11-24-16 */
|
|
||||||
+ setlocale(LC_ALL,original_locale);
|
|
||||||
+ return((void *)api);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+int tess_capi_get_ocr(void *vapi,PIX *pix,char *outstr,int maxlen,int segmode,FILE *out)
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ TessBaseAPI *api;
|
|
||||||
+ static int old_segmode=-1;
|
|
||||||
+
|
|
||||||
+ api=(TessBaseAPI *)vapi;
|
|
||||||
+ if (old_segmode != segmode)
|
|
||||||
+ {
|
|
||||||
+ old_segmode=segmode;
|
|
||||||
+ TessBaseAPISetPageSegMode(api, (TessPageSegMode)segmode);
|
|
||||||
+ }
|
|
||||||
+ if (!TessBaseAPIProcessPage(api,pix,0,NULL,NULL,0,NULL))
|
|
||||||
+ {
|
|
||||||
+ /* pixDestroy(&pix); */
|
|
||||||
+ if (out!=NULL)
|
|
||||||
+ fprintf(out,"tesscapi: Error during bitmap processing.\n");
|
|
||||||
+ TessBaseAPIClear(api);
|
|
||||||
+ return(-1);
|
|
||||||
+ }
|
|
||||||
+ char* text = TessBaseAPIGetUTF8Text(api);
|
|
||||||
+ strncpy(outstr,text,maxlen-1);
|
|
||||||
+ outstr[maxlen-1]='\0';
|
|
||||||
+ TessDeleteText(text);
|
|
||||||
+ TessBaseAPIClear(api);
|
|
||||||
+ return(0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+int tess_capi_get_ocr_multiword(void *vapi,PIX *pix,int segmode,
|
|
||||||
+ int **left,int **top,int **right,int **bottom,
|
|
||||||
+ int **ybase,char **text,int *nw,
|
|
||||||
+ FILE *out)
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ TessBaseAPI *api;
|
|
||||||
+ static int old_segmode=-1;
|
|
||||||
+
|
|
||||||
+ api=(TessBaseAPI *)vapi;
|
|
||||||
+ if (old_segmode != segmode)
|
|
||||||
+ {
|
|
||||||
+ old_segmode=segmode;
|
|
||||||
+ TessBaseAPISetPageSegMode(api, (TessPageSegMode)segmode);
|
|
||||||
+ }
|
|
||||||
+ if (!TessBaseAPIProcessPage(api,pix,0,NULL,NULL,0,NULL))
|
|
||||||
+ {
|
|
||||||
+ if (out!=NULL)
|
|
||||||
+ fprintf(out,"tesscapi: Error during bitmap processing.\n");
|
|
||||||
+ TessBaseAPIClear(api);
|
|
||||||
+ (*nw)=0;
|
|
||||||
+ return(-1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ //(*nw)=api->GetOCRWords(left,top,right,bottom,ybase,text);
|
|
||||||
+
|
|
||||||
+ int iword,nwords,totlen,it8;
|
|
||||||
+ int *x0,*y0,*x1,*y1,*ybaseline;
|
|
||||||
+ char *tutf8;
|
|
||||||
+
|
|
||||||
+ TessResultIterator *res_it = TessBaseAPIGetIterator(api);
|
|
||||||
+ /* Count words */
|
|
||||||
+ iword=0;
|
|
||||||
+ totlen=0;
|
|
||||||
+ while(TessResultIteratorNext(res_it, RIL_BLOCK))
|
|
||||||
+ {
|
|
||||||
+ if(!TessResultIteratorNext(res_it, RIL_WORD))
|
|
||||||
+ {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ iword++;
|
|
||||||
+ char* textstr = TessResultIteratorGetUTF8Text(res_it, RIL_WORD);
|
|
||||||
+ totlen+=strlen(textstr)+1;
|
|
||||||
+ }
|
|
||||||
+ nwords = iword;
|
|
||||||
+
|
|
||||||
+ x0=(*left)=(int *)malloc(sizeof(int)*5*nwords);
|
|
||||||
+ y0=(*top)=&x0[nwords];
|
|
||||||
+ x1=(*right)=&y0[nwords];
|
|
||||||
+ y1=(*bottom)=&x1[nwords];
|
|
||||||
+ ybaseline=(*ybase)=&y1[nwords];
|
|
||||||
+ tutf8=(*text)=(char *)malloc(totlen);
|
|
||||||
+ iword=0;
|
|
||||||
+ it8=0;
|
|
||||||
+ TessPageIteratorBegin( (TessPageIterator *) res_it);
|
|
||||||
+ while (TessResultIteratorNext(res_it, RIL_BLOCK))
|
|
||||||
+ {
|
|
||||||
+ if (!TessResultIteratorNext(res_it, RIL_WORD))
|
|
||||||
+ {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ char* textstr = TessResultIteratorGetUTF8Text(res_it, RIL_WORD);
|
|
||||||
+ strcpy(&tutf8[it8],textstr);
|
|
||||||
+ it8 += strlen(&tutf8[it8])+1;
|
|
||||||
+
|
|
||||||
+ int bbleft, bbtop, bbright, bbbottom;
|
|
||||||
+ int u1,v1,u2,v2;
|
|
||||||
+ TessPageIteratorBoundingBox( (TessPageIterator *) res_it, RIL_WORD, &bbleft, &bbtop, &bbright, &bbbottom);
|
|
||||||
+ TessPageIteratorBaseline( (TessPageIterator *) res_it, RIL_WORD, &u1, &v1, &u2, &v2);
|
|
||||||
+ x0[iword]=bbleft;
|
|
||||||
+ x1[iword]=bbright;
|
|
||||||
+ y0[iword]=bbtop;
|
|
||||||
+ y1[iword]=bbbottom;
|
|
||||||
+ ybaseline[iword]=(v1+v2)/2;
|
|
||||||
+ iword++;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ TessResultIteratorDelete(res_it);
|
|
||||||
+
|
|
||||||
+ (*nw) = iword;
|
|
||||||
+
|
|
||||||
+ TessBaseAPIClear(api);
|
|
||||||
+ return(0);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+void tess_capi_end(void *vapi)
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ TessBaseAPI *api;
|
|
||||||
+
|
|
||||||
+ if (vapi==NULL)
|
|
||||||
+ return;
|
|
||||||
+ api=(TessBaseAPI *)vapi;
|
|
||||||
+ TessBaseAPIEnd(api);
|
|
||||||
+ TessBaseAPIDelete(api);
|
|
||||||
+ }
|
|
|
@ -1,26 +0,0 @@
|
||||||
diff -r -w -u0 willuslib/wmupdfinfo.c willuslib/wmupdfinfo.c
|
|
||||||
--- willuslib/wmupdfinfo.c 2018-11-21 10:05:22.000000000 +0100
|
|
||||||
+++ willuslib/wmupdfinfo.c 2019-07-27 19:56:23.418595275 +0200
|
|
||||||
@@ -217 +217 @@
|
|
||||||
- pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1);
|
|
||||||
+ pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1, 1);
|
|
||||||
@@ -224 +224 @@
|
|
||||||
- pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1);
|
|
||||||
+ pdf_print_obj(ctx, out, pdf_resolve_indirect(ctx, obj), 1, 1);
|
|
||||||
@@ -240 +240 @@
|
|
||||||
- n=pdf_sprint_obj(ctx,NULL,0,robj,1);
|
|
||||||
+ char* f = pdf_sprint_obj(ctx,NULL,0,&n,robj,1,1);
|
|
||||||
@@ -245 +245 @@
|
|
||||||
- pdf_print_obj(ctx,out,robj,1);
|
|
||||||
+ pdf_print_obj(ctx,out,robj,1,1);
|
|
||||||
@@ -249 +249,2 @@
|
|
||||||
- pdf_sprint_obj(ctx,buf,n+2,robj,1);
|
|
||||||
+ int len = 0;
|
|
||||||
+ char* d = pdf_sprint_obj(ctx,buf,n+2,&len,robj,1,1);
|
|
||||||
@@ -256,0 +258 @@
|
|
||||||
+ fz_free(ctx, d);
|
|
||||||
@@ -257,0 +260 @@
|
|
||||||
+ fz_free(ctx, f);
|
|
||||||
@@ -278 +281 @@
|
|
||||||
- pdf_print_obj(ctx,out, pdf_resolve_indirect(ctx,obj), 1);
|
|
||||||
+ pdf_print_obj(ctx,out, pdf_resolve_indirect(ctx,obj), 1, 1);
|
|
|
@ -1,8 +0,0 @@
|
||||||
diff -r -w -u0 willuslib/bmpmupdf.c willuslib/bmpmupdf.c
|
|
||||||
--- willuslib/bmpmupdf.c 2018-11-20 21:13:12.000000000 +0100
|
|
||||||
+++ willuslib/bmpmupdf.c 2019-07-27 20:12:37.386555334 +0200
|
|
||||||
@@ -28 +28,3 @@
|
|
||||||
-void pdf_install_load_system_font_funcs(fz_context *ctx);
|
|
||||||
+void pdf_install_load_system_font_funcs(fz_context *ctx)
|
|
||||||
+{
|
|
||||||
+}
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Template file for 'k2pdfopt'
|
|
||||||
pkgname=k2pdfopt
|
|
||||||
version=2.51
|
|
||||||
revision=1
|
|
||||||
wrksrc="${pkgname}_v${version}"
|
|
||||||
build_style=cmake
|
|
||||||
hostmakedepends="pkgconf unzip"
|
|
||||||
makedepends="zlib-devel libpng-devel libjpeg-turbo-devel jasper-devel
|
|
||||||
freetype-devel libopenjpeg2-devel jbig2dec-devel djvulibre-devel
|
|
||||||
tesseract-ocr-devel leptonica-devel gsl-devel mupdf-devel harfbuzz-devel"
|
|
||||||
depends="ghostscript"
|
|
||||||
short_desc="Optimize PDF/DJVU files for mobile e-readers and smartphones"
|
|
||||||
maintainer="John Eira <john.eira@web.de>"
|
|
||||||
license="GPL-3.0-or-later"
|
|
||||||
homepage="https://willus.com/k2pdfopt/"
|
|
||||||
distfiles="http://willus.com/k2pdfopt/src/k2pdfopt_v${version}_src.zip"
|
|
||||||
checksum="3e6e4d7aac9c9bed4c7854888a6a91213be10121be76e17f83e080e829ac5fde"
|
|
||||||
broken="https://build.voidlinux.org/builders/x86_64-musl_builder/builds/22343/steps/shell_3/logs/stdio"
|
|
Loading…
Reference in New Issue