k2pdfopt Changelog

What's new in k2pdfopt 2.55

Dec 27, 2023
  • ENHANCEMENTS:
  • Windows version compiled with MinGW, gcc v13.2.0 on Windows 11 core i9-9900 CPU.
  • Mac arm-64 version compiled with clang 17 on macOS 14 Sonoma
  • Mac x64 version cross-compiled on M1-CPU Mac mini with clang 17on macOS 14 Sonoma
  • Linux version compiled with gcc 13.2.1 on Fedora 39 (virtual box)
  • Library updates: Tesseract 5.3.3, Leptonica 1.83, Mupdf 1.23.7, Freetype 2.13.2, libpng 1.6.40, jpeg-turbo 2.1.5.1, openjpeg 2.5.0, jbig2dec 0.20, zlib 1.3
  • BUG FIXES:
  • Bookmarks / TOC page numbering fixed in wmupdf.c (broke in v2.54 due to change in mupdf library).

New in k2pdfopt 2.53 (Jul 19, 2020)

  • NEW FEATURES:
  • Added more support for DJVU input files, including OCR-layer text extraction, reading of bookmarks, and information viewing (-i or GUI "Info" view).
  • Added support for CBZ input files.
  • ENHANCEMENTS:
  • The multithreaded Tesseract OCR capability has been significantly improved. The images for OCR processing are now queued up into larger groups so that the multithreading is more effective. Since the introduction of the -ocrd option in v2.50 (Dec 2018), the default OCR method of OCRing an entire line of text at a time had effectively turned off OCR multithreading since only one row of text at a time was passed to the OCR engine.
  • Updated many of the support libraries to their latest releases:
  • Tesseact 4.1.1, Leptonica 1.79, Mupdf 1.17, Freetype 2.10.2 libpng 1.6.37, jpeg-turbo 2.0.4, openjpeg 2.3.1
  • When previewing "marked up" pages, the preview now only processes the desired preview page, making it much faster for previewing pages above page 1.
  • Added -ocrvbb option to more precisely determine OCR layer text bounding boxes in pre-existing OCR layers.
  • BUG FIXES:
  • Fixed bug in ocr layer sorting algorithm in wtextchars_group_by_words() function in k2ocr.c
  • Fixed a bug where one of my png image reading functions was notthread safe (not re-entrant). This had the potential to cause very random crashing.
  • Fixed multiple issues with text selection of a pre-existing OCR layer. Some text wasn't always included in certain cases, and sometimes the selection box was over-sized.
  • Altered the detection of words in a row of text to work better / more consistently in obvious cases. See v2.53 comments in get_word_gap_threshold() in bmpregion.c.

New in k2pdfopt 2.52 (Jun 12, 2020)

  • NEW FEATURES:
  • Automatically downloads Tesseract v4.0 training files from github.
  • Use -y for no prompting. See -ocrlang command usage for full details.
  • Added new -go (grid order) option to specify the order in which
  • Areas in gridded pages are processed. Grid area processing also
  • Defaults to right-to-left if -r is specified.
  • ENHANCEMENTS:
  • Prints Tesseract init info at the beginning of each file conversion
  • Now--in the GUI also.
  • Redirects Tesseract library debug statements to a log file. Prints
  • Them out if it cannot initialize correctly.
  • Re-edited a lot of the -mode usage descriptions.
  • CMakeLists.txt files updated.
  • Added Kobo Clara HD, Kobo Forma, and Kobo Libra H2O to device list
  • (using preliminary resolution numbers).
  • Windows version now compiled with gcc 9.3.1 on a core i9-9900.
  • MS WINDOWS GUI
  • Tesseract language selection and download fully supported.
  • Added three more preset buttons for a total of seven.
  • Added "View" button to GUI to view PDF source file.
  • BUG FIXES:
  • Fixed issue where OCR layer placement from an already generated
  • OCR layer was not correct if a document scale factor not equal
  • To 1 was used (e.g. -ds 2).
  • Hopefully improved detection of out-of-family small rows.
  • Modified textrows_remove_small_rows() in textrows.c and also added
  • Rhmin option to remove any row w/text height less than a certain value.
  • Https://www.mobileread.com/forums/showthread.php?p=3693210#post3693210
  • Https://www.mobileread.com/forums/showthread.php?p=2781815#post2781815
  • Fixed some issues with -fr option. Added -ddr option (-ddr- to turn
  • Off double-row detect) to prevent tall figures from potentially
  • Getting broken up inadvertently. Modified k2proc.c to
  • "rotate the trow" structure next the end of bmpregion_add() function.
  • Https://www.mobileread.com/forums/showthread.php?p=3549163#post3549163
  • Fixed issue where the output margins weren't exactly right in the
  • Case of -mode trim. See k2settings_adjust_devdims_for_om() function
  • In k2settings.c. (PM from Tex2002ans on MR.)
  • Added textrows_remove_defects() function to bmpregion_find_textrows()
  • In bmpregion.c. This helped fix an issue where rows were not
  • Getting selected properly in a document due to small scanning
  • Defects.
  • Fixed implementation of -bp <gap>. This had been broken for some
  • Time. It was getting overridden by other features. See mods to
  • K2proc.c and k2master.c.

New in k2pdfopt 2.51 (Jan 5, 2019)

  • Fixed issue with Tesseract and SSE/AVX support
  • Added -ocrdpi option to optimize Tesseract v4.0.0 performance
  • Added code modes from: https://gitlab.com/axet/android-k2pdfopt/commit/163d9c9248f9ac00068ecb60af33f1ae7ec17540

New in k2pdfopt 2.50 (Dec 28, 2018)

  • ENHANCEMENTS:
  • Compiled w/Tesseract v4.0.0, MuPDF v1.14, Freetype v2.9.1,
  • Leptonica 1.74.4, OpenJPEG 2.3.0, Turbo JPEG 2.0.1, and PNG lib v1.6.35.
  • New OCR detection methods for Tesseract--can have Tesseract analyze entire lines (default) or even the entire page of text rather than just individual words as was done in previous versions.This should improve OCR accuracy when using Tesseract.
  • See -ocrd option.
  • New debugging diagnostic for Tesseract training files: -lang ? (Or in MS Windows GUI, select Help -> Tesseract Training File Info)
  • The default device is now a 6-inch 300 dpi screen a la the Kindle Paperwhite 3+
  • Added Kindle Oasis 2 device (7-inch 300 dpi screen)
  • Page straightening feedback added to MS WINDOWS GUI log
  • Fixed Android source code issues pointed out in this post:
  • https://www.mobileread.com/forums/showthread.php?p=3655291#post3655291
  • MS WINDOWS:
  • Compiled with gcc 7.3.
  • LINUX:
  • Compiled in Fedora 29 with gcc 8.2.
  • MAC OSX:
  • Compiled with gcc 8.2.

New in k2pdfopt 2.42 (May 22, 2017)

  • NEW FEATURES:
  • Bitmap output. The -o <namefmt> option now takes names ending in .jpg and .png to tell k2pdfopt to write out bitmaps instead of a PDF file. E.g. -o .png writes pages to srcfile0001.png, srcfile0002.png, etc.
  • Added de-warp (-dw) option to de-warp scanned pages a la ScanTailor. This is most useful for books that have been pressed against the glass of a copier and the scans still have some curvature (warping) in them. Or for photographs of pages taken at a slight angle. Uses Leptonica's built-in functions.
  • ENHANCEMENTS:
  • Improved autocrop (-ac) algorithm and added an "aggressiveness" factor to it. It is now called more efficiently as well (it used to be called multiple times per source page).
  • Added Kobo Aura One to built-in device list
  • Improved straightening/deskew algorithm. Faster and uses weighted average / fine grain search (25 Mar 2017). ~20% faster for 64-bit. Keyboard shortcut change: 'i' key now brings up file info. PDF information shows dates and page size more clearly now.
  • BUG FIXES:
  • The -ocrout function works even if native output mode is specified.
  • Pressing ESC key when file overwrite is requested now results in a "no" response (it used to result in a "yes" response).

New in k2pdfopt 2.41 (May 22, 2017)

  • ENHANCEMENTS:
  • Updated libraries: MuPDF v1.10a, Tesseract 3.05.00, Leptonica 1.74.1, FreeType 2.7.1, libpng v1.6.28, zlib 1.2.11.
  • Compiled with MinGW/GNU C 6.3 (MS Windows version)
  • NEW FEATURE:
  • Added bitmap erosion filter (-er option) as an alternative to gamma correction (-g) to make text thicker/darker (idea from the original "Yet Another PDF to LRF Converter" program).

New in k2pdfopt 2.40 (Jan 30, 2017)

  • NEW FEATURE:
  • OCR processing is now multithreaded. This may provide a significant boost in OCR processing speed depending on how many CPU threads you have available. See the -nt option. As part of this upgrade, the OCR and total CPU time are now echoed for each run (using the clock() function). Include MS Windows GUI control for number of CPUS.
  • BUG FIXES:
  • Fixed a couple of minor places in the usage where options were not in alphabetical order.
  • k2printf() flushes stdout.
  • MS Windows GUI crop selection does not ask for page range if document only has one page.
  • MS Windows GUI no longer exceeds size of desktop when maximized.

New in k2pdfopt 2.36 (Dec 26, 2016)

  • ENHANCEMENTS:
  • The -colorfg and -colorbg options can take an array of colors, in which case each array element is used for the next row of text. See usage. Suggested in a 5 Nov 2016 e-mail.
  • BUG FIXES:
  • If using -mode trim with -bp, blank pages are passed through to the output file as if -mode copy. From 11-16-2016 e-mail.
  • Minimum dpi allowed from k2settings_settings_set_margins_and_devsize is 1.
  • Fixed bug where -bp was not recognized if at the end of a command line. ocrvis b did not work before without 's'. Now it does.
  • Fixed Tesseract to correctly parse .traineddata files when certain locales are set. It was not correctly parsing Chinese .traineddata files on my Windows 10 system because of the locale.
  • Updated GOCR library to GOCR v0.50. Not convinced it is improved.
  • Re-ordered some command line options in usage to keep them alphabetical.

New in k2pdfopt 2.35 (Oct 26, 2016)

  • ENHANCEMENTS:
  • Also, the binaries are compressed with a newer version of UPX which
  • is compatible with Mac OSX 10.12 Sierra.
  • Windows binaries compiled with GCC 6.2.0 (MinGW).
  • Compiled with the latest versions of libpng (1.6.25), freetype (2.7),
  • turbo JPEG (1.5.1).
  • I tried newer versions of MuPDF (v1.9a and v1.10 pre-release), but
  • they broke more things than I was comfortable with, so I've stayed
  • with MuPDF v1.8 for this release.
  • NEW FEATURES:
  • Added -jfc- option to prevent trying to join figure captions to the
  • figures.
  • http://www.mobileread.com/forums/showthread.php?p=3342105#post3342105
  • Added new conversion mode, -mode concat, which keeps the output at
  • the same dimensions as the source file and concatenates crop-boxes
  • (red boxes) together--as many as can fit on each page without breaking
  • them apart.
  • Added option -f2p -3 to support -mode concat.
  • BUG FIXES:
  • No longer crashes in native PDF output mode if there is no output.
  • Writes more informative message to screen if output file not written.
  • Makes sure output file can be opened for writing before proceeding
  • with the conversion. Warns user if file cannot be opened.
  • http://www.mobileread.com/forums/showthread.php?p=3343367#post3343367
  • Correctly processes blank/empty pages in .djvu files.
  • http://www.mobileread.com/forums/showthread.php?p=3350691#post3350691
  • The -title option now substitutes the file name for %s or %b, like
  • the -o option.
  • http://www.mobileread.com/forums/showthread.php?p=3389292#post3389292
  • The -grid overlap percentage is more precise now.
  • Warning message to use -fc- with -odpi, -fs, or -mag. Not sure this
  • is the best way--should I just turn off -fc if those are specified?
  • Reported in 22 April 2016 e-mail.
  • Also: http://www.mobileread.com/forums/showthread.php?p=3354548#post3354548
  • Wide-char (UTF-8) DJVU file names now work.
  • http://www.mobileread.com/forums/showthread.php?p=3351085#post3351085
  • Blank pages no longer cause an improper conversion with -mode trim.
  • E-mail from 17 Mar 2016.
  • Clarified usage of -mode copy, explaining about gamma and contrast
  • settings (how they are not reset to 1 with -mode copy).
  • In the function where the 2-column divider is detected, a special
  • call is made to find_textrows() so that figure caption joining is
  • disabled unless -jfc+ is specified. This helps 2-column detection
  • work more reliably.
  • http://www.mobileread.com/forums/showthread.php?p=3351808#post3351808
  • http://www.mobileread.com/forums/showthread.php?p=3342105#post3342105
  • MS WINDOWS GUI BUG FIXES:
  • The GUI now correctly selects the "crop" conversion mode.

New in k2pdfopt 2.34b (Mar 28, 2016)

  • Native conversions correctly generate unicode file names
  • GUI correctly provides right-click help on the output folder widgets

New in k2pdfopt 2.33a (Oct 6, 2015)

  • BUG FIX:
  • Fixed MS Windows GUI bug where preview page controls were missing.

New in k2pdfopt 2.33 (Oct 6, 2015)

  • NEW FEATURES
  • Compiled with GCC v5.2.0 and MuPDF v1.7a (released May 7, 2015).
  • The MuPDF upgrade involved modifying a significant amount of the MuPDF interface code in the willus library since Artifex changed the APIs on several functions, but the bulk of the logic did not change.
  • I uncovered a bug in the pdf_dict_del() function as well (reported).
  • The -i option displays information about the source PDF file. Added to MS Windows GUI also.
  • Added -fr option to rotate wide-aspect-ratio figures to landscape.
  • Added Kindle Paperwhite 3 (2015 release) and Pocketbook Basic 2 to dev list (from http://www.mobileread.com/forums/showthread.php?t=253579)
  • Smarter sorting of red regions on a multiple-column page. See pageregion_sort() function in pageregions.c.
  • New -ibox option has same format as -cbox, but these boxes are ignored ** by k2pdfopt--they are "whited out" in the source file. For native output, the contents may still be visible in the output.
  • The -neg option now attempts to only negate text passages to white on black and to leave figures alone. Use -neg+ to negate everything.
  • Added option -ehl to erase horizontal lines in the document. Works exactly like the -evl option.
  • Added -author and -title options to specify the author and title of the output PDF.
  • Added -px option to exclude a set of pages, e.g. -px 4,7,10-20.
  • User can use color markings to tell k2pdfopt where to apply page breaks to the output file.
  • The -? option can now be followed by a (wildcard) matching string to show the usage of a particlar option, e.g. -? -ws.
  • NEW MS WINDOWS GUI FEATURES:
  • Crop margins replaced by three crop-box entries.
  • These entries can act as either -cbox or -ibox.
  • Added an "INFO" button to show information on the selected PDF file.
  • If a wildcard is specified for a PDF source file on the command line (e.g. *.pdf), and the GUI is launched, all matching entries are placed into the GUI file list.
  • BUG FIXES:
  • With notes options turned on (-nl / -nr), k2pdfopt will still search for multiple columns if no notes are found on the page. In addition, the -crgh option now more directly affects column divider finding.
  • See textrows_remove_small_rows() call in bmpregion_find_multicolumn_divider().
  • Fixed multiple file select (broke when I converted to wide chars in v2.30).
  • Modified bmpregion_hyphen_detect() to be less strict about rejecting hyphens that aren't exactly centered. Also modified calculation of lcheight in bmpregion_calc_bbox()--see the function.
  • The k2pdfopt web site and help pages work again from the help menu.
  • Turned off some debugging text from the bmp_autocrop2 function in k2bmp.c.
  • Not really a bug fix, but the command-line help is now shown in ** Courier New in MS Windows (a mono-spaced font).
  • In info_update() in wmupdf.c in the willus library, I check to see if I can resolve the Info dictionary. This checks to see if it can be parsed correctly. If not, I discard the dictionary. This was causing a bug that a user submitted to me in an e-mail on 15 April 2015. The users had a PDF file with a corrupt "Info" dictionary.
  • IWPDFOUTLINE structures correctly freed.
  • MuPDF v1.7 stores ligatured characters differently than previous versions in its internal character arrays, so I had to compensate for this.

New in k2pdfopt 2.32 (Mar 7, 2015)

  • NEW FEATURES:
  • A new auto-cropping feature (-ac) has been added where k2pdfopt will attempt to crop out dark edges due to scanning / copying artifacts.
  • There is a checkbox for it in the MS Windows GUI.
  • MS Windows GUI: graphical selection of crop margins has now been implemented. When you click the "Select Margins" button, k2pdfopt will overlay all of the pages in the "Pages to Convert" box and allow you to select a rectangular crop region with the mouse, which it will then use to populate the "Crop Margins" values.
  • The -ls option now takes an optional page range so that it can be applied to specified pages. A control was added to the MS Windows GUI for this.
  • Improved the context sensitive help in the MS Windows GUI.
  • OTHER:
  • Update the list of devices and their dimension from the information collected at http://www.mobileread.com/forums/showthread.php?t=253579
  • Clarified -cbox usage.
  • Added source code flow description to k2pdfopt.c.
  • BUG FIXES:
  • Fixed a bug with notes in the margins (-nl/-nr options), checking for notesrows->n==0 (was causing a crash).
  • Clarified usage for -m option.
  • Added MS Windows GUI confirmation of Tesseract initialization (in the conversion dialog box).
  • -cbox- did not work correctly if was beyond the last page of the source PDF. This is fixed.
  • Fixed a preview error noted by a mobileread member. Was due to not correctly clearing a WTEXTCHARS structure in ocrlayer_bounding_box_inches().
  • Fixed some issues with masterinfo_should_flush() where it wasn't correctly figuring out the next page.
  • Fixed issues selecting the text in text edit boxes as they gain focus (either through tabbing or mouse clicks).
  • The number of inserted rows added by textrows_find_doubles() is now limited to a reasonable number. This was going out of control in one oddball case and (I think) causing k2pdfopt to crash.

New in k2pdfopt 2.31 (Dec 29, 2014)

  • NEW FEATURES:
  • Added -ppgs option to post process output with ghostscript pdfwrite device. This can improve text selection when there are overlapping cropped regions.
  • In MS Windows GUI, added context-sensitive help. If you right-click most controls in the main window, you will get a dialog box explaining what that control does.
  • NEW DEVICES:
  • Added separate Kindle Paperwhite 2 resolution: 710x960.
  • Added kindle voyage.
  • BUG FIXES:
  • Erase vertical lines correctly works from MS Windows GUI again.
  • OTHER:
  • Compiled with MuPDF v1.6 library.
  • Separated out functions in wmupdf.c that do not depend on MuPDF.
  • Those are now in wpdf.c. This helps the KOReader build.
  • No longer assumes that WIN32 = GUI. To compile so as not to use the WIN32 API, define NO_WIN32_API from the compile command line.

New in k2pdfopt 2.30 (Dec 5, 2014)

  • NEW FEATURES:
  • MS Windows version (including GUI) now supports wide-character file names (UTF16), so names with non-ASCII characters in them (e.g. Chinese characters) should be correctly handled.
  • Added -colorfg and -colorbg options to adjust the foreground (text) and background colors of the output file (only works for bitmapped output files--doesn't work for native PDF output). You can even use a background bitmap (which will be tiled). Suggested in mobileread.com private message, 24 Nov 2014. (beta4).
  • Windows versions compiled with gcc 4.9.2 (MinGW).
  • MS WINDOWS GUI UPDATES:
  • As mentioned above, the MS Windows GUI supports wide characters now.
  • Added "Get Folder" button. (beta1)
  • BUG FIXES:
  • Marking corners now works for color bitmapped output.
  • Compiled with OpenJPEG v2.1.0--fixed some cases with incorrectly reading PDF files. (beta2) The typical symptom is reported as "JPX stream not read coorectly."
  • Removed "wrectmaps->n=..." debugging output from k2ocr.c. (beta3)
  • Clarified intended use of -rt vs. -ls.
  • Fixed buffer overrun in k2gui_cbox_set_pages_completed().
  • Preview mode correctly turns on color for native PDF output (also turns off gamma). If the user tries to turn off color output in the MS Windows GUI while native PDF output is checked, a dialog box will pop up explaining why it won't uncheck.
  • Preview mode correctly puts up alert box when source file is not found.
  • File open / folder open puts up alert box if file or folder is not found.
  • The -ocrsp+ command-line option is now correctly recognized.
  • GOCR is correctly used if Tesseract cannot be initialized.

New in k2pdfopt 2.21 (Jul 30, 2014)

  • Compiled with MuPDF v1.5 (a highly recommened, mostly-bug-fix upgrade recommended by the MuPDF folks)

New in k2pdfopt 2.20 (Jul 26, 2014)

  • NEW FEATURES:
  • Added k2ocr_ocrwords_get_from_ocrlayer() and supporting functions to more intelligently extract all of the OCR-layer text from a major ("red box") region (rather than parsing for the words graphically, the OCR layer is queried for any words which are within the box). This should eliminate the need to use the -ocrcol option on PDF files which already have their own text layer.
  • There is a new option optimized for PDFs that have notes in the left or right margins. This option (-nl for notes in the left margin or -nr for notes in the right margin) tells k2pdfopt to look for notes and intersperse them with the main text. The notes can even alternate, e.g. left margin for odd pages and right margin for even pages would be -nlo -nre.
  • The word spacing (-ws) option now defaults to -0.20 (the old default was 0.375). When a negative value is given, an automatic word spacing detection algorithm now used to break apart words in lines. The algorithm will try to choose a natural word spacing value, with the minimum allowed being the absolute value of the setting (e.g. 0.2 for the default). If you want k2pdfopt to aggressively break lines (e.g. break apart long words if they don't fit on a line), use a smaller absolute value, e.g. -ws -0.01.
  • You can use a positive value for the older style of line breaking, and the lines are only broken where a gap exceeds that fraction of the height of a lower-case 'o'. There is also a new Windows GUI checkbox for this option.
  • Entire rows of text within the OCR layer can either have the words within rendered individually (the default and original behavior of k2pdfopt), or the entire row can be rendered at once with spaces used between each word. This may improve the text selection behavior for certain readers. The option that controls this is -ocrsp:
  • ocrsp puts one space between each word in the row.
  • -ocrsp+ puts multiple spaces between each word in the row in order to better position the words since k2pdfopt does not typically match the exact font used by the source document when doing the OCR layer (it always uses arial). -ocrsp- reverts to the original (default) behavior.
  • The -m and -om options now can use units, e.g. pixels, inches, cm, and "s" for page/screen size. In addition, -m can use the other units used by -cbox, -w, and -h ("t" and "x").
  • The new "x" unit of measure corresponds to the OCR Layer bounding box, e.g. -cbox 0x,0x,1x,1x will correspond to a crop box that matches the bounding box of the OCR layer. This can be used by the -w, -h, and -m options as well. See -h usage.
  • New option -to[-] for text-only output, removes all figures as determined by a height limit (see -jf option). Use with -bp m to avoid text selection issues if using in conjunction with native output.
  • If -wt+ is specified for the white threshold, all pixels >= the specified value will be painted pure white (255).
  • While not a perfect work-around, large, stylized first letters which frequently begin a book chapter (typically the height of 2 or 3 normal-sized text rows) are now detected when wrapping text lines so that the lines adjacent to them are more-or-less correctly wrapped. Still needs improvement.
  • MS-WINDOWS GUI ENHANCEMENTS:
  • If the custom buttons are not used, a "2-column" and a "Fit Width" button are automatically assigned.
  • New MS-Windows GUI check box for -bp m option (Avoid text select overlap).
  • New MS-Windows GUI check box for defects (sets -de 1.5).
  • New MS-Windows GUI check box / text box for line break setting (-ws option)
  • The last settings (other than the custom button presets) are remembered between settings (stored in the K2PDFOPT_CUSTOM0 env var). (4-15-14 e-mail)
  • There is now a "Restore Defaults" button since k2pdfopt remembers its last settings.
  • New option for GUI: -rls[+|-]. Forces/disables restoration of last settings from K2PDFOPT_CUSTOM0 environment variable.
  • Environment variables related to the MS Windows GUI are only read and set through Windows calls (not through getenv() and putenv())-- this was causing problems in trying to clear them.
  • Command-line options that don't impact the GUI are put into the "additional options" box upon launch.
  • For file overwriting, the user is now given a "Yes to All" option and a "No to all" option.
  • There are two new menu options--to save and restore the settings (stored in environment variables) to and from a file. This is done in the k2gui_save_settings_to_file() and k2gui_restore_settings_from_file() functions in k2gui.c.
  • If the output file cannot be opened (e.g. because another application already has it open), a message box is shown informing the user rather than just quitting the program.
  • BUG FIXES:
  • Tabbing between crop margin text fields in the MS Windows GUI keeps the entire text field selected even when you change a value before tabbing.
  • Fixed bug in window positioning at startup.
  • Fixed bug where -ds did not get properly applied in native mode.
  • Fixed bug where tesseract was incorrectly initializing languages that do not have CUBE/COMBINED data (e.g. Russian). If that initialization fails, it now tries CUBE-only (and then no CUBE at all). This required a couple minor mods to the Tesseract library itself, which are included in the latest k2pdfopt source code distribution.
  • SOURCE CODE MODIFICATIONS:
  • The bmpregion_add() function and some others use a new parameter data structure rather than having so many arguments passed to them (ADDED_REGION_INFO).
  • Copied web text at top of main k2 page to k2pdfopt.c intro.

New in k2pdfopt 2.18 (Jun 17, 2014)

  • Fixed problem when scaling sometimes gets out of control with tall regions. Was causing excessively large bitmaps to be allocated which would sometimes run the system out of memory.

New in k2pdfopt 2.17a (Jun 3, 2014)

  • Fixes MuPDF v1.4 problem where it was not correctly using MS Windows system fonts (introduced in v2.17).
  • Compiled w/gcc 4.8.3.

New in k2pdfopt 2.17 (May 19, 2014)

  • ENHANCEMENTS
  • Compiled with the latest versions of MuPDF (1.4), Turbo JPEG (1.3.1), libpng (1.6.10), and freetype (2.5.3).

New in k2pdfopt 2.16 (May 5, 2014)

  • BUG FIXES:
  • Avoid zero-value return from masterinfo_break_point(). (5-2-14 e-mail).
  • TOC positioning fixed when source pages aren't large enough to cause a new destination page (see k2publish.c). Also, wmupdf output now correctly handles UTF-8 outline/TOC titles.

New in k2pdfopt 2.15 (Apr 9, 2014)

  • ENHANCEMENTS:
  • The -cbox option usage has been rewritten and hopefully clarified.
  • It is a very powerful and useful new option as of v2.10.
  • BUG FIXES:
  • Specific variable to track Tesseract initialization (it was sometimes getting missed if it was turned on after a conversion in the GUI).
  • Mode selection works in GUI (wasn't correctly selecting "fitpage") and in text menu again.
  • Fixed memory leak in bmp_detect_vertical_lines() in k2bmp.c.
  • Fixed several memory leaks--made sure bmpregion_free() is called for each declared BMPREGION, and also patched wmupdf.c to fix two memory leaks. The most significant memory leak was in the dtcompress.c library function, though, which has also been fixed.
  • Fixed incorrectly formed #ifdef HAVE_OCR_LIB in k2publish.c.

New in k2pdfopt 2.14 (Apr 9, 2014)

  • Compiled using dtcompress.c module in willus library which avoids requiring my custom modification to zlib.
  • willus lib modules use more standard include callouts for MuPDF and DjVu. Added CMakeLists.txt files to source distribution (also from Dirk).
  • Correctly re-compiled Win32 build (wasn't done correctly in v2.13).

New in k2pdfopt 2.13 (Apr 9, 2014)

  • ENHANCEMENTS:
  • Added kobo mini to device profile:
  • Applied patches from KOReader team:
  • >> rectmap.patch.txt (only on if K2PDFOPT_KINDLEPDFVIEWER defined)
  • >> indent_calibration.patch.txt (with modifications so that the example case that resulted in the patch still works, but so that most of my regression tests don't break.)
  • >> word_gap_calculation.patch.txt, auto-gap not on by default per this post: http://www.mobileread.com/forumsshowthread.php?p=2708795#post2708795
  • >> static.patch.txt
  • >> debug.patch.txt
  • The -ws option can take a negative value to turn on automatic word spacing from the KOReader team.
  • can have even 'e' and odd 'o' specifiers, e.g.
  • -p e (process all even pages numbers)
  • -p 1-100e,1-100o (process all even pages from 1-100, then all odd ones.)
  • Cropboxes and gridded areas can now be processed fully into separate columns if desired.
  • The -cbox option now takes an optional page list to specify a specific range of pages to apply the crop box to. e.g.
  • -cbox1-99o applies the crop box to pages 1,3,5,...,99.
  • The -cbox option takes units as well, so you can specify the crop box size in pixels, inches, cm, or a fraction of the source page size. The units work the same as for the -w and -h options.
  • GUI is smarter about creating command-line versions of margins when they are all the same.
  • New "-bp m" option will force page break at end of each major (red-box) region. This can improve text selection problems in native mode by avoiding the text selection overlap that can occur when multiple cropped source regions are placed on to a single output page.
  • BUG FIXES:
  • Error checking done on K2PDFOPT_WINPOS variable.
  • Makes sure "(all)" doesn't get put in for the -p option (GUI).

New in k2pdfopt 2.12 (Apr 9, 2014)

  • BUG FIXES:
  • No longer writes k2pdfopt_out.png when previewing in the GUI.
  • Removed DLL dependencies from 64-bit Windows compile.

New in k2pdfopt 2.11 (Apr 9, 2014)

  • BUG FIXES (MW WINDOWS GUI):
  • Several routines in k2gui_cbox.c which are called from k2file.c during the conversion were not correctly working during a preview and were resulting in garbage sometimes being sent to the desktop screen if the preview button was clicked after a file conversion. This has been fixed.

New in k2pdfopt 2.10 (Apr 9, 2014)

  • NEW FEATURES:
  • The PDF "Outlines" tree (often called "bookmarks" by PDF viewers) that helps you navigate the PDF file and is usually shown in the left pane of the PDF viewer is now preserved in the converted file. Or you can create your own bookmarks from a simple text file if your PDF source file doesn't have one (or if you want to change it).
  • See the -toc, -toclist, and -tocsave command-line options. (toc = Table of Contents.) Destination page breaks are forced at outline anchor pages by default (see -bp option).
  • A new -cbox option allows you to specify a crop box to be applied to each page. You can specify more than one, and each separate crop box will be rendered to a different output page, similar to the way the -grid option works. See -cbox in the command usage.
  • Using -mode crop with -cbox, you can crop a source PDF file to a destination PDF file. You can specify different crop boxes for even and odd pages, as well.
  • The -bpl option now allows you to specify a list of source pages where destination page breaks will be forced.
  • Three new modes: -mode trim causes the source page to be trimmed and the destination to be sized to the trimmed source.
  • -mode fitpage is similar, but squeezes the trimmed source page into the specified device output screen size.
  • -mode crop is a complement to the -cbox option and causes each cropped box to be placed on a new page the size of the cropped box.
  • ENHANCEMENTS:
  • Windows versions are compiled with gcc 4.8.2.
  • The Win64 binary is now compressed with UPX 3.91w which finally is able to compress the Win64/PE format.
  • BUG FIXES:
  • In native output, consecutive streams now delimited by white space.
  • Pages with no "/Contents" entry are correctly handled.
  • Re-wrote masterinfo_break_point() to make use of bmpregion_find_textrows() so that decisions on where to break pages in the "fitwidth" mode should be more consistent and also will be affected by the -gtr option.
  • Removed last vestiges of -pi option (interactive menu 'w' option was incorrectly still using it).
  • The vert_line_erase() function in k2bmp.c correctly handle the cbmp pointer when it is an 8-bit bitmap now.
  • Fixed a flow problem in k2file.c (k2pdfopt_proc_one() function) which was causing the GUI preview not to work with -mode copy.
  • The textrows_remove_small_rows() function no longer includes figures (REGION_TYPE_FIGURE) when doing statistics on the row heights.

New in k2pdfopt 2.03 (Apr 9, 2014)

  • ENHANCEMENTS:
  • MuPDF library now uses the Sumatra versions of pdf-font.c and pdf-fontfile.c so that it correctly checks Windows system fonts for non-embedded fonts in the PDF file.
  • BUG FIXES:
  • Native mode is correctly turned off as the default setting.
  • Native mode output works correctly from the MS Windows GUI.
  • Check boxes made consistent (native/wrap/OCR) with quick sanity check call.

New in k2pdfopt 2.02 (Apr 9, 2014)

  • ENHANCEMENTS:
  • The main bitmap resampling function in the willus library, bmp_resample(), now uses an alternate fixed-precision version (with virtually no accuracy loss) on non-64-bit compiles, where it has been tested to be significantly (50% to 100%) faster (on 64-bit modern Intel CPUs, the floating-point version is actually fastest). This should improve k2pdfopt performance on 32-bit and ARM implementations, including on the KOReader, for example.
  • The resample routine also checks to see if no size change is required--if so, it does a simple bmp_copy() call instead of resampling.
  • GENERIC BUG FIXES:
  • Echo_source_page_count correctly initialized to zero.
  • Hyphen detection turned on (has been disabled since at least v1.66).
  • Gap_sorted variable in textwords_add_word_gaps() is no longer static.
  • Changed kindle paperwhite dims to 658 x 889 based on 9-15-13 e-mail feedback.
  • MS WINDOWS GUI BUG FIXES:
  • Minimize/Maximize/Restore/Close buttons added to GUI convert dialog box so that users can get k2pdfopt out of the way while it is working.
  • GUI Conversion box no longer stays on top of other windows.
  • Text displayed in GUI conversion box is limited in number of lines until the very end to speed up scrolling on long conversions.
  • The GUI file list is not cleared the file list after a successful conversion anymore in case the user wants to try some different command-line options for the conversion.

New in k2pdfopt 2.01 (Apr 9, 2014)

  • BUG FIXES:
  • Fixed significant memory leak in wmupdf.c (added wtextchars_free call in wtextchars_text_inside()). Was causing k2pdfopt to crash on conversions of large PDF files.
  • Better feedback after preview button is pressed. Also works correctly when re-sizing the window during a preview.
  • Inserted 0.1-second sleep at end of k2gui_preview_start()--seems to prevent occasional problems with the preview.

New in k2pdfopt 2.00 (Apr 9, 2014)

  • MAJOR NEW FEATURES:
  • Added a GUI for the MS Windows version. In MS Windows, k2pdfopt now has a dual-mode operation: it runs as a GUI or a console program depending on the situation and command-line arguments: Use -gui to force the GUI, -guimin to minimize the GUI, use -gui- for no GUI.
  • Window size / position stored in K2PDFOPT_WINPOS env. var.
  • Custom presets stored in K2PDFOPT_CUSTOM env. vars. (=1-4).
  • For PDF documents that contain text (not scanned); MuPDF text analysis functions so that even on re-flowed documents (i.e. not using native PDF output) the text can be included from the source for searching and highlighting without resorting to OCR.
  • "Virtual OCR". You explicitly turn it on with -ocr m (m for MuPDF), though it is on by default since it adds very little time to the PDF file processing. It is not necessary if you are using native PDF output (-n).
  • OTHER NEW FEATURES:
  • Windows 64-bit version compiled with gcc 4.7.3 (on core i5-670).
  • The optimized Windows 32-bit version still uses gcc 4.6.3 (it does not compile correctly in gcc 4.7.3 on my MinGW platform due to some issue with with the Tesseract library). The generic Windows 32-bit version uses gcc 4.7.3.
  • Compiled with latest versions of MuPDF (v1.3), OpenJPEG, FreeType,
  • Turbo-JPEG, PNG, and Z libraries.
  • A new option, -bmp, will write out a preview bitmap of the specified page, e.g. -bmp 2 will write out the 2nd converted page to the file k2pdfopt_out.png.
  • New option -sp simply echos the page counts of the source files and exits.
  • OCR text can be written to a separate text file now with the -ocrout option. E.g. -ocrout %s.txt will write the OCR from myfile.pdf to myfile.txt.
  • SOURCE CODE RE-WRITE:
  • New way a number of data structures store information (BMPREGION, TEXTROWS) and eliminated the BREAKINFO structure.
  • The way gaps are placed between regions of text has been substantially re-done.
  • BUG FIXES:
  • In k2pdfopt_settings_set_margins_and_devsize(), doesn't flush the master bitmap unless the width changes.
  • Mode -f2p -2 (put every new red-box region onto a new page) no longer add is exactly the region size.
  • When expected numeric arguments on the command-line don't occur, that parameter is not set, a warning is printed, and the non-numeric argument is processed as if it were the next argument on the command line
  • Modified tessedit.cpp in Tesseract library to automatically detect if .cube files are present so that it uses them even for multiple language specification. Correspondingly modified ocrtess_init() in willus library.
  • v1.65 was crashing after not finding the Tesseract language file and switching to GOCR: This is fixed (tesseract status now stored in global static variable in k2ocr.c).