Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion k2pdfoptlib/k2file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,7 @@ static int toclist_valid(char *s,FILE *out)
return(0);
}

#if 0

/*
** Create outline from page list
Expand Down Expand Up @@ -1713,6 +1714,8 @@ static WPDFOUTLINE *wpdfoutline_from_pagelist(char *pagelist,int maxpages)
return(outline0);
}

#endif


int get_source_type(char *filename)

Expand Down Expand Up @@ -1815,6 +1818,7 @@ void k2file_get_info(char *filename,int *pagelist,char **buf)
}
}

#if 0

int k2file_get_num_pages(char *filename)

Expand All @@ -1832,7 +1836,6 @@ int k2file_get_num_pages(char *filename)
}


#if 0
void k2file_get_overlay_bitmap(WILLUSBITMAP *bmp,double *dpi,char *filename,char *pagelist)

{
Expand Down
8 changes: 8 additions & 0 deletions k2pdfoptlib/k2master.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@
if (k2settings->dst_negative)
bmp_invert(bmp);

#if 0
/* Fix colors */
/*
if ((k2settings->dst_fgtype!=4 && k2settings->dst_bgtype!=4)
Expand All @@ -1664,6 +1665,7 @@
k2settings->dst_bgtype,
0,0,bmp->width-1,bmp->height-1);
}
#endif


/* Write sequence of OCR'd words if debugging */
Expand Down Expand Up @@ -2402,7 +2404,7 @@
#if (WILLUSDEBUGX & 0x800000)
printf(" Page break mark forces rowcount = %d\n",rowcount);
#endif
nobreak = -999;

Check warning on line 2407 in k2pdfoptlib/k2master.c

View workflow job for this annotation

GitHub Actions / Build & Lint (Debug)

Value stored to 'nobreak' is never read

Check warning on line 2407 in k2pdfoptlib/k2master.c

View workflow job for this annotation

GitHub Actions / Build & Lint (Release)

Value stored to 'nobreak' is never read
break;
}
if (mark->type==K2PAGEBREAKMARK_TYPE_NOBREAK)
Expand Down Expand Up @@ -2876,8 +2878,10 @@
printf("region %d: (%d,%d) - (%d,%d)\n",j,subregion->c1,subregion->r1,subregion->c2,subregion->r2);
*/
bmpregion_find_textrows(subregion,k2settings,0,1,-1.0,0);
#if 0
nfg=k2settings_ncolors(k2settings->dst_fgcolor);
nbg=k2settings_ncolors(k2settings->dst_bgcolor);
#endif
/*
printf("nc=%d, rcindex=%d\n",nc,masterinfo->rcindex);
printf("TEXTROWS.n=%d\n",region->textrows.n);
Expand All @@ -2891,12 +2895,14 @@
textrow=&subregion->textrows.textrow[i];
if (textrow->type==REGION_TYPE_TEXTLINE)
{
#if 0
if (k2settings->dst_fgtype==4)
strcpy(fgc,k2settings_color_by_index(k2settings->dst_fgcolor,
masterinfo->rcindex%nfg));
if (k2settings->dst_bgtype==4)
strcpy(bgc,k2settings_color_by_index(k2settings->dst_bgcolor,
masterinfo->rcindex%nbg));
#endif
masterinfo->rcindex++;
/* For some reason if it's a single text line, need to re-calc bbox. */
/* Should investigate why at some point... */
Expand All @@ -2917,6 +2923,7 @@
}
}
}
#if 0
if (k2settings->dst_fgtype!=4)
strcpy(fgc,k2settings->dst_fgcolor);
else
Expand All @@ -2929,6 +2936,7 @@
bmp_change_colors(region->bmp,bmpmask,fgc,k2settings_color_type(fgc),
bgc,k2settings_color_type(bgc),
0,0,region->bmp->width-1,region->bmp->height-1);
#endif
pageregions_free(pageregions);
bmp_free(bmpmask);
if (srcbmp->bpp!=8)
Expand Down
11 changes: 7 additions & 4 deletions k2pdfoptlib/k2ocr.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ static void k2ocr_status_line(char *buf,char *color,char *label,char *string)
strcat(buf,"\n");
}

#endif

void k2ocr_tesslang_selected(char *lang,int maxlen,K2PDFOPT_SETTINGS *k2settings)

{
xstrncpy(lang,ocrtess_lang_by_index(k2settings->dst_ocr_lang,0),maxlen);
}

#endif


static void k2ocr_tesslang_init(char *lang,int assume_yes)

Expand Down Expand Up @@ -378,9 +378,9 @@ static void k2ocr_tesslang_init(char *lang,int assume_yes)
k2printf(TTEXT_NORMAL " ... download successful." TTEXT_NORMAL "\n");
}
}



#if 0

static void *otinit(void *data)

{
Expand Down Expand Up @@ -423,6 +423,9 @@ static void *otinit(void *data)
pthread_exit(NULL);
return(NULL);
}

#endif

#endif

#if 0
Expand Down
23 changes: 23 additions & 0 deletions k2pdfoptlib/k2pdfopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@
#endif
#endif

#undef HAVE_DJVU_LIB
#undef HAVE_GOCR_LIB
#undef HAVE_MUPDF_LIB
#undef HAVE_OCR_LIB

/* Compile w/Windows GUI? */
#if (defined(HAVE_WIN32_API) && !defined(K2PDFOPT_KINDLEPDFVIEWER))
#define HAVE_K2GUI
Expand Down Expand Up @@ -266,10 +271,12 @@ typedef struct
char show_usage[32];
int src_left_to_right;
int src_whitethresh;
#if 0
char dst_fgcolor[MAXFILENAMELEN];
char dst_fgtype; /* 0=none, 1=gray, 2=color, 3=bitmap */
char dst_bgcolor[MAXFILENAMELEN];
char dst_bgtype; /* 0=none, 1=gray, 2=color, 3=bitmap */
#endif
int src_paintwhite; /* Paint everything above src_whitethresh white */
int text_only; /* Do not send figures to output file */

Expand Down Expand Up @@ -331,9 +338,11 @@ typedef struct
int dst_sharpen;
int dst_color;
int dst_bpc;
#if 0
int dst_landscape;
char dst_landscape_pages[1024];
char dst_opname_format[MAXFILENAMELEN];
#endif
int src_autostraighten;
/*
double dst_mar;
Expand Down Expand Up @@ -372,12 +381,14 @@ typedef struct
int text_wrap;
double word_spacing; /* Negative for auto */
double display_width_inches; /* Device width = dst_width / dst_dpi */
#if 0
char pagelist[1024];
char pagexlist[1024]; /* exclude these pages */
char bpl[2048]; /* Page break list--see -bpl option */
int use_toc;
char toclist[2048];
char tocsavefile[MAXFILENAMELEN];
#endif
int column_fitted;
double dpi_org;
double contrast_max;
Expand Down Expand Up @@ -405,7 +416,9 @@ typedef struct
/* v2.35--change overlap from int to double */
double src_grid_overlap_percentage;
/*int src_grid_order;*/ /* 0=down then across, 1=across then down */
#if 0
K2CROPBOXES cropboxes; /* Crop boxes */
#endif
K2NOTESET noteset;
/*
** Preview options
Expand All @@ -429,8 +442,10 @@ typedef struct
int info; /* 1 = info only about source files */
int pagebreakmark_breakpage_color; /* v2.33, #RRGGBB, 0 = no mark */
int pagebreakmark_nobreak_color; /* v2.33, #RRGGBB, 0 = no mark */
#if 0
char dst_author[256];
char dst_title[256];
#endif
/* v2.34 */
double dst_fontsize_pts; /* 0=not used */
int assume_yes; /* 1 = assume yes to overwrite */
Expand Down Expand Up @@ -992,7 +1007,11 @@ int k2settings_output_is_bitmap(K2PDFOPT_SETTINGS *k2settings);
int k2settings_columns_left_to_right(K2PDFOPT_SETTINGS *k2settings);
int k2settings_valid_grid_order(K2PDFOPT_SETTINGS *k2settings);
K2NOTES *page_has_notes_margin(K2PDFOPT_SETTINGS *k2settings,MASTERINFO *masterinfo);
#if 0
int k2pdfopt_settings_landscape(K2PDFOPT_SETTINGS *k2settings,int pageno,int maxpages);
#else
# define k2pdfopt_settings_landscape(...) 0
#endif
void k2pdfopt_conversion_init(K2PDFOPT_CONVERSION *k2conv);
void k2pdfopt_conversion_close(K2PDFOPT_CONVERSION *k2conv);
void k2pdfopt_settings_copy(K2PDFOPT_SETTINGS *dst,K2PDFOPT_SETTINGS *src);
Expand All @@ -1015,9 +1034,13 @@ void k2pdfopt_settings_set_margins_and_devsize(K2PDFOPT_SETTINGS *k2settings,
double src_fontsize_pts,int trimmed);
char *k2pdfopt_settings_unit_string(int units);
void k2pdfopt_settings_clear_cropboxes(K2PDFOPT_SETTINGS *k2settings,int flagmask,int flagtype);
#if 0
void k2cropboxes_init(K2CROPBOXES *cropboxes);
int k2cropboxes_count(K2CROPBOXES *cropboxes,int flagmask,int flagtype);
int k2settings_has_cropboxes(K2PDFOPT_SETTINGS *k2settings);
#else
# define k2settings_has_cropboxes(S) 0
#endif
int k2settings_need_color_initially(K2PDFOPT_SETTINGS *k2settings);
int k2settings_need_color_permanently(K2PDFOPT_SETTINGS *k2settings);
int k2settings_ncolors(char *s);
Expand Down
12 changes: 12 additions & 0 deletions k2pdfoptlib/k2proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void k2proc_init_one_document(void)
bmpregion_vertically_break(NULL,NULL,NULL,0.,0,0,NULL);
}

#if 0

/*
** Determine median font size (based on row heights) in a region.
Expand Down Expand Up @@ -139,6 +140,7 @@ printf("Calling bmpregion_find_textrows for font size eval\n");
bmpregion_free(region);
}

#endif

/*
** First break the source page into cropboxes and/or gridded rectangles based
Expand All @@ -154,6 +156,7 @@ void bmpregion_source_page_add(BMPREGION *region,K2PDFOPT_SETTINGS *k2settings,
MASTERINFO *masterinfo,int level,int pages_done)

{
#if 0
PAGEREGIONS *pageregions,_pageregions;
int i,gridded;

Expand Down Expand Up @@ -189,8 +192,12 @@ void bmpregion_source_page_add(BMPREGION *region,K2PDFOPT_SETTINGS *k2settings,
bmpregion_source_box_process(&pageregions->pageregion[i].bmpregion,
k2settings,masterinfo,level,pages_done);
pageregions_free(pageregions);
#else
bmpregion_source_box_process(region, k2settings, masterinfo, level, pages_done);
#endif
}

#if 0

void bmpregion_add_cover_image(BMPREGION *coverimage,K2PDFOPT_SETTINGS *k2settings,
MASTERINFO *masterinfo)
Expand Down Expand Up @@ -264,6 +271,7 @@ void bmpregion_add_cover_image(BMPREGION *coverimage,K2PDFOPT_SETTINGS *k2settin
bmpregion_free(newregion);
}

#endif

/*
** Process a rectangular source page bitmap determined from either a cropbox or
Expand Down Expand Up @@ -485,6 +493,7 @@ printf("Restoring DPI?\n");
pageregions_free(pageregions);
}

#if 0

/*
** Set up gridded pageregion array
Expand Down Expand Up @@ -786,6 +795,7 @@ static void bmpregion_set_cropbox_pixels(BMPREGION *dstregion,K2CROPBOX *cropbox
dstregion->r2=srcregion->bmp8->height-1;
}

#endif

/*
** Return sorted list (by display order) of page regions up to appropriate level
Expand Down Expand Up @@ -2499,6 +2509,7 @@ region_height_inches);
#if (WILLUSDEBUGX & 1)
printf("Added_region.force_scale = %g\n",added_region.force_scale);
#endif
#if 0
if (added_region.force_scale < -1.5 && region_width_inches > MIN_REGION_WIDTH_INCHES
&& region_width_inches/k2settings->max_region_width_inches < 1.25
&& region_height_inches > 0.5)
Expand All @@ -2510,6 +2521,7 @@ printf("Added_region.force_scale = %g\n",added_region.force_scale);
added_region.allow_text_wrapping = 0;
}
else
#endif
revert=0;
#if (WILLUSDEBUGX & 0x201)
k2printf("Entering vert region loop, %d regions.\n",n);
Expand Down
Loading
Loading