Tor Andersson [Thu, 17 Sep 2020 12:32:55 +0000 (14:32 +0200)]
wasm: Always call freeDocument before opening a new file.
If fetch() throws an error, we don't want the old document lying around.
Tor Andersson [Thu, 17 Sep 2020 11:34:11 +0000 (13:34 +0200)]
wasm: Rename rethrow() to wasm_rethrow() for clarity.
Tor Andersson [Thu, 17 Sep 2020 09:18:05 +0000 (11:18 +0200)]
wasm: Remove unused drawPageAsSVG function.
Tor Andersson [Wed, 16 Sep 2020 09:56:34 +0000 (11:56 +0200)]
wasm: Call mupdf.oninit() callback instead of main().
Tor Andersson [Thu, 17 Sep 2020 13:01:44 +0000 (15:01 +0200)]
wasm: Search text in document.
Update search results on visible pages while typing.
Click the next/prev buttons to find the next page with a match.
Tor Andersson [Thu, 10 Sep 2020 13:18:55 +0000 (15:18 +0200)]
wasm: Clean up HTML and CSS layout.
Don't use CSS grid layout.
We need the page list to be part of the document scrolling for history
navigation to work automatically.
Use brighter more cheerful colors.
Tor Andersson [Tue, 11 Aug 2020 12:16:10 +0000 (14:16 +0200)]
wasm: Add error checking and convert mupdf to javascript exceptions.
Tor Andersson [Mon, 10 Aug 2020 15:40:56 +0000 (17:40 +0200)]
wasm: Use ArrayBuffer and Blob to set image data faster.
ArrayBuffers can transfer between Worker and main thread without copying,
and avoiding the BASE64 encoding and stringification step means we can
more or less get the raw PNG data directly to the browser engine with as
few intermediate steps as possible.
Tor Andersson [Thu, 10 Sep 2020 13:06:03 +0000 (15:06 +0200)]
wasm: Use structured text to create selectable invisible text layer.
Tor Andersson [Fri, 7 Aug 2020 16:10:26 +0000 (18:10 +0200)]
wasm: Use JSON to return page links.
Avoid returning hard-wired HTML strings from the C code.
Generate the HTML from the JSON in the viewer code for more flexibility.
Tor Andersson [Thu, 10 Sep 2020 13:30:55 +0000 (15:30 +0200)]
wasm: Add async mupdf library and improve viewer demo.
Tor Andersson [Thu, 6 Aug 2020 14:22:47 +0000 (16:22 +0200)]
wasm: Remove obsolete demos and update Makefile.
Tor Andersson [Thu, 10 Sep 2020 13:05:20 +0000 (15:05 +0200)]
stext: Add JSON stext output format and add preserve-spans option.
Robin Watts [Mon, 14 Sep 2020 11:03:44 +0000 (12:03 +0100)]
MSVC: Hide harfbuzz warnings in all configurations.
Robin Watts [Fri, 11 Sep 2020 11:38:25 +0000 (12:38 +0100)]
mupdf-gl: Fix warnings in MSVC.
Robin Watts [Fri, 11 Sep 2020 10:53:07 +0000 (11:53 +0100)]
Add fz_warp_pixmap function.
Robin Watts [Fri, 11 Sep 2020 13:24:49 +0000 (14:24 +0100)]
MSVC Solution tweaks.
Avoid "/Gm is deprecated" warnings.
Fix Memento x64 builds.
Robin Watts [Fri, 11 Sep 2020 11:41:29 +0000 (12:41 +0100)]
Various size_t fixes for MSVC.
Tor Andersson [Tue, 11 Aug 2020 15:35:25 +0000 (17:35 +0200)]
Update CMap resources.
Tor Andersson [Fri, 4 Sep 2020 10:37:51 +0000 (12:37 +0200)]
Add docs/ecosystem.html and diagram.
Tor Andersson [Thu, 3 Sep 2020 11:56:18 +0000 (13:56 +0200)]
Add "redact" mode side panel that opens with shift-R.
Tor Andersson [Fri, 24 Apr 2020 13:16:07 +0000 (15:16 +0200)]
html: Insert <br> as flow nodes.
This fixes several issues with <br> tags interacting
badly with css margins and selectors due to how we were
splitting blocks in order to insert the new-lines from <br>.
This fixes bugs 698351 and 702856.
Julian Smith [Mon, 31 Aug 2020 15:29:34 +0000 (16:29 +0100)]
Moved test code from scripts/mutool.py into scripts/mupdfwrap.py.
Tor Andersson [Fri, 4 Sep 2020 17:13:05 +0000 (19:13 +0200)]
Remove unused submodule from gumbo-parser submodule.
Robin Watts [Thu, 3 Sep 2020 13:22:46 +0000 (14:22 +0100)]
Bug 702537: Avoid use-after-realloc in pattern handling.
The gstates are held in an array. This array can be realloced
while processing nested patterns, invalidating the current pointer.
Avoid this by reloading the pointer each time around the loop.
Robin Watts [Wed, 2 Sep 2020 18:46:27 +0000 (19:46 +0100)]
Bug 702527: Cope with nonseparable nonisolated blends of alpha only groups.
Robin Watts [Wed, 2 Sep 2020 18:16:17 +0000 (19:16 +0100)]
Bug 702524: Fix overread in nonseparable gray blending.
Don't read bp[n] if there is no alpha.
Robin Watts [Wed, 2 Sep 2020 16:29:09 +0000 (17:29 +0100)]
Bug 701180: Fix memory overwrite.
Templated function was overrunning buffer in the "no destination
alpha" case by stepping too many bytes.
Robin Watts [Tue, 1 Sep 2020 15:23:46 +0000 (16:23 +0100)]
mupdf-gl: Add "Mark for redaction" button.
Add a button to allow all the current search hits to be added
as redaction annotations.
Tor Andersson [Wed, 2 Sep 2020 10:55:27 +0000 (12:55 +0200)]
mupdf-gl: Add ui_*_aux functions.
These behave the same as ui_* functions, but allow for ui
elements to be greyed out.
Robin Watts [Tue, 1 Sep 2020 13:07:36 +0000 (14:07 +0100)]
mupdf-gl: Add 'Redact all Pages' button.
Robin Watts [Wed, 2 Sep 2020 09:01:33 +0000 (10:01 +0100)]
Update ui_slow_operation to give better feedback.
Ensure that we show the UI state before processing pages; otherwise
we end up showing page 1 when we are processing page 2 etc.
Robin Watts [Tue, 1 Sep 2020 11:47:40 +0000 (12:47 +0100)]
MuPDF-gl: Add 'High Security' saving option.
Paul Gardiner [Thu, 13 Aug 2020 09:32:31 +0000 (10:32 +0100)]
Add function to create signature form field.
Also update pdf_create_annotation_raw to place widget annotations
in the correct linked list.
Robin Watts [Tue, 1 Sep 2020 11:46:12 +0000 (12:46 +0100)]
Ensure ocr_init defaults to 'eng' if no language string passed.
api->Init will default NULL to 'eng', but not '' to 'eng', so fix
that here.
Robin Watts [Tue, 1 Sep 2020 11:45:08 +0000 (12:45 +0100)]
VS solution: Build Tesseract variant of mupdf-gl
In addition, a few configurations were incorrectly failing to build
leptonica.
Robin Watts [Tue, 1 Sep 2020 11:37:11 +0000 (12:37 +0100)]
Add fz_write_document.
Add convenience function to allow an entire document to be fed to
a document writer.
Also, add some missing prototypes for the pdfocr writer.
Tor Andersson [Fri, 28 Aug 2020 09:25:29 +0000 (11:25 +0200)]
xmltext: Format floating point numbers with variable precision.
Tor Andersson [Fri, 28 Aug 2020 09:23:38 +0000 (11:23 +0200)]
xmltext: Simplify device implementation.
Let no-op functions in the device be NULL instead of adding stubs that do
nothing.
Tor Andersson [Mon, 24 Aug 2020 11:22:16 +0000 (13:22 +0200)]
Bug 702769: Use PDF 1.7 version number when creating new PDF files.
Tor Andersson [Mon, 24 Aug 2020 11:15:14 +0000 (13:15 +0200)]
Bug 702768: Add "pdf-extract-rich-media.js" example script.
Tor Andersson [Mon, 24 Aug 2020 11:04:01 +0000 (13:04 +0200)]
Fix "no string" test in pdf_to_date.
Tor Andersson [Mon, 24 Aug 2020 11:03:34 +0000 (13:03 +0200)]
Add RichMedia and Projection annotation types to enum.
Mathieu Malaterre [Thu, 20 Aug 2020 08:33:26 +0000 (10:33 +0200)]
mutool show: Remove short syntax from man page.
The abbreviated syntax was removed in the commit "Add selector
syntax to 'mutool show'", but the man page was not updated to
reflect this.
Mathieu Malaterre [Thu, 20 Aug 2020 08:46:43 +0000 (10:46 +0200)]
Add missing trailer/pages/form to mutool show help
Signed-off-by: Mathieu Malaterre <[email protected]>
Tor Andersson [Mon, 24 Aug 2020 12:29:30 +0000 (14:29 +0200)]
Update MuJS to 1.0.8.
This includes a fix for bug 702774.
Julian Smith [Thu, 27 Aug 2020 18:06:43 +0000 (19:06 +0100)]
scripts/mupdfwrap.py: fix bug in ref-counting of Link class wrapper for fz_link.
Use fz_keep_link() when creating a Link from a fz_link*. Fixes heap errors on
some Linux systems when running -t to test things.
Julian Smith [Thu, 27 Aug 2020 18:01:05 +0000 (19:01 +0100)]
scripts/mupdfwrap.py: don't try to test .pdf file that is not in git.
Also allow specification of tests files on command line.
Julian Smith [Wed, 26 Aug 2020 14:50:09 +0000 (15:50 +0100)]
scripts/mupdfwrap*: moved test code into separate file.
Also made test run on all .pdf files in the mupdf repository.
Julian Smith [Wed, 26 Aug 2020 08:59:55 +0000 (09:59 +0100)]
Makerules: removed stray $warning.
Julian Smith [Mon, 24 Aug 2020 11:10:10 +0000 (12:10 +0100)]
source/tools/mudraw.c: fixed compile error if DISABLE_MUTHREADS defined.
Julian Smith [Fri, 21 Aug 2020 12:41:15 +0000 (13:41 +0100)]
scripts/mupdfwrap.py: fixed bad fd in --run-py.
Julian Smith [Thu, 20 Aug 2020 23:05:12 +0000 (00:05 +0100)]
scripts/mupdfwrap.py: improve wrapping of fz_lookup_metadata().
Provide extra function wrapper lookup_metadata() that returns a std::string by
value; makes things easier to use from C++, and also easier for SWIG/Python.
In generated python, replace the auto-generated Document.lookup_metadata()
method with a method that uses the new lookup_metadata() function to return a
python string directly, or None if lookup failed.
Julian Smith [Thu, 20 Aug 2020 13:56:06 +0000 (14:56 +0100)]
scripts/mupdfwrap.py: avoid unnecessary recompilation of swig-generated c++.
If generated .cpp file is identical to previously-existing file, use
previous previously-existing file's mtime so that we don't cause unnecessary
recompilation.
Julian Smith [Tue, 18 Aug 2020 14:13:58 +0000 (15:13 +0100)]
scripts/mupdfwrap.py: explain omission of auto-generated methods.
Julian Smith [Tue, 18 Aug 2020 12:40:49 +0000 (13:40 +0100)]
scripts/mupdfwrap.py: use custom wrapper for fz_copy_rectangle() to return std::string.
Julian Smith [Tue, 18 Aug 2020 12:40:33 +0000 (13:40 +0100)]
scripts/mupdfwrap.py: fixed up hard-coded test file location.
Julian Smith [Tue, 18 Aug 2020 11:14:10 +0000 (12:14 +0100)]
scripts/mupdfwrap.py: insert extra newline before forward decl of iterators.
Julian Smith [Tue, 18 Aug 2020 09:06:18 +0000 (10:06 +0100)]
scripts/mutool_draw.py: fixed mupdf.stderr() => mupdf.stderr_().
Julian Smith [Thu, 23 Jul 2020 13:50:26 +0000 (14:50 +0100)]
scripts/mutool_draw.py: minor fix to if.
Julian Smith [Wed, 22 Jul 2020 13:19:45 +0000 (14:19 +0100)]
source/fitz/trace-device.c: added adv ('advance') attribute to <g> tags.
Julian Smith [Wed, 22 Jul 2020 13:15:27 +0000 (14:15 +0100)]
Makerules: always specify -pthread on OpenBSD.
Julian Smith [Mon, 27 Jul 2020 15:45:51 +0000 (16:45 +0100)]
source/fitz/memento.c: fixed out-of-bounds array access and fd corruption.
In squeeze():
Don't write to out-of-bounds stashed_map[-1] if dup() returns -1.
Close dup-licated fds in child process to avoid possibility of them getting
corrupted by incorrect code.
Julian Smith [Mon, 20 Jul 2020 15:49:42 +0000 (16:49 +0100)]
source/fitz/memento.c: set errno after alloc failure.
Also trivial fix to allow us to run on OpenBSD.
Julian Smith [Fri, 17 Jul 2020 16:38:09 +0000 (17:38 +0100)]
source/fitz/memento.c: optionally hide multiple reallocs of same block.
Output of multiple reallocs disabled if environmental variable
MEMENTO_HIDE_MULTIPLE_REALLOCS is defined at runtime.
Reduces very verbose output if a buffer is resized many times.
Julian Smith [Fri, 17 Jul 2020 09:51:43 +0000 (10:51 +0100)]
Fixes for memento builds on OpenBSD.
Need to link with "-L /usr/local/lib -l execinfo" to get backtrace*(), and not
use -ldl.
Julian Smith [Wed, 15 Jul 2020 17:03:55 +0000 (18:03 +0100)]
scripts/mupdfwrap.py: specify HAVE_PTHREAD=yes when building mupdf.so.
Appears to fix recent breakage.
Julian Smith [Mon, 22 Jun 2020 14:04:09 +0000 (15:04 +0100)]
scripts/mutool_draw.py: added support for 'xmltext' device.
Also fixed creation of fz_infinite_rect.
Julian Smith [Thu, 23 Jul 2020 13:51:35 +0000 (14:51 +0100)]
source/tools/mudraw.c: added support for 'xmltext' device.
Julian Smith [Tue, 25 Aug 2020 15:00:40 +0000 (16:00 +0100)]
platform/win32/libmupdf.vcxproj*: added xmltext-device.c.
Julian Smith [Tue, 14 Jul 2020 18:57:41 +0000 (19:57 +0100)]
Added 'xmltext' devce, outputs low-level pdf info as xml.
Julian Smith [Wed, 15 Jul 2020 12:15:26 +0000 (13:15 +0100)]
source/fitz/printf.c: added support for %i.
Julian Smith [Thu, 25 Jun 2020 13:31:01 +0000 (14:31 +0100)]
scripts/jlib.py: various minor improvements.
Improved system_raw() and system()'s handling of <out> arg. In system_raw() and
system(), we now copy subprocess's behaviour for None (inherit file handles)
and subprocess.DEVNULL.
In system_raw(), default for <out> is None, to inherit file handles.
In system(), default for <out> is std.stdout, which allows <prefix> and
<verbose> to work as expected. also don't indent verbose by default, don't use
print() because it generates spurious newlines, special case out=log to avoid
confusion about {...}.
Fixed bug in build() if <outfiles> is a string rather than list/tuple.
expand_nv(): fixed exception text after error.
Fixed LogPrefixScope.
Allow shell programme to be specified in system() etc. E.g. executable='bash'.
Julian Smith [Mon, 6 Jul 2020 10:31:58 +0000 (11:31 +0100)]
scripts/mupdfwrap.py: call exit(1) after exception.
Julian Smith [Tue, 25 Aug 2020 15:49:51 +0000 (16:49 +0100)]
scripts/mupdfwrap.py: fixes for OpenBSD.
ClangInfo: extended search for libclang.so - also look in /usr/lib and
/usr/local/lib.
Don't call generated functions 'stdout' or 'stderr' - looks like openbsd has a
macro for these names. We call them stdout_ and stderr_ instead.
On OpenBSD, run gmake instead of make.
When compiling+linking with libpython, use pkg-config to get compile/link
flags, instead of python3-config; much simpler and works on openbsd.
Use 'c++' as C++ compiler, not 'g++'.
Julian Smith [Mon, 22 Jun 2020 13:39:35 +0000 (14:39 +0100)]
scripts/mupdfwrap.py: fixed bug in fz_rect wrapper's constructor.
Used to always throw exception.
Also added default constructor for fz_stext_options wrapper.
Julian Smith [Thu, 20 Aug 2020 23:05:12 +0000 (00:05 +0100)]
scripts/mupdfwrap.py: improve wrapping of fz_lookup_metadata().
Provide extra function wrapper lookup_metadata() that returns a std::string by
value; makes things easier to use from C++, and also easier for SWIG/Python.
In generated python, replace the auto-generated Document.lookup_metadata()
method with a method that uses the new lookup_metadata() function to return a
python string directly, or None if lookup failed.
Julian Smith [Thu, 20 Aug 2020 16:34:22 +0000 (17:34 +0100)]
Changed fz_lookup_metadata() to return required buffer size, not string length.
The returned buffer size is string length plus one.
Also patched up pdf_lookup_metadata() in same way.
Julian Smith [Fri, 21 Aug 2020 22:13:16 +0000 (23:13 +0100)]
Fixed SEGV in SWIG Python on Linux.
We need to define fz_pdfocr_write_options_usage even in non-OCR builds.
Julian Smith [Wed, 15 Jul 2020 17:02:25 +0000 (18:02 +0100)]
Makethird: fix shared=yes build of thirdparty/gumbo-parser.
Need to use -fPIC from $(LIB_CFLAGS). (Thanks to Robin for this fix.)
Robin Watts [Tue, 25 Aug 2020 11:29:14 +0000 (12:29 +0100)]
Fix Windows non-tesseract builds.
libleptonica was set to build for all configurations, rather than
just the Tesseract enabled ones.
Tor Andersson [Wed, 19 Aug 2020 13:46:47 +0000 (15:46 +0200)]
ocr: Write compact PDF syntax.
Fix typo in CMap output.
Avoid unnecessary precision in text scaling and positioning.
Use Td instead of Tm for smaller output.
Tor Andersson [Wed, 19 Aug 2020 13:54:45 +0000 (15:54 +0200)]
ocr: Flip order of y1/y2 when converting to PDF coordinate space.
We want to end up using a positive font size, so y2 must be
larger than y1.
Tor Andersson [Wed, 19 Aug 2020 13:21:38 +0000 (15:21 +0200)]
ocr: Clean up enum names and mudraw usage message.
Robin Watts [Fri, 17 Jul 2020 15:47:22 +0000 (16:47 +0100)]
OCR device.
Robin Watts [Thu, 16 Jul 2020 14:21:08 +0000 (15:21 +0100)]
Tesseract integration.
(Includes fixes from both Tor and Sebastian).
Sebastian Rasmussen [Tue, 18 Aug 2020 17:11:05 +0000 (01:11 +0800)]
Bug 702728: Destroy mutexes after dropping base context.
Previously the mutexes were destroyed before dropping the base
context. When reference counted objects, e.g. document handler
contexts, were dropped mupdf would call fz_drop_imp() which tried to
take the allocation lock. The allocation lock is one of the destroyed
mutexes causing an error or crash in pthreads.
Reversing the order such that the base context is dropped before
the mutexes are freed resolves this issue.
Robin Watts [Thu, 6 Aug 2020 15:41:41 +0000 (16:41 +0100)]
Fix windows build of mupdf-gl.
pid_t doesn't exist on WIN32.
Robin Watts [Wed, 29 Jul 2020 16:24:52 +0000 (17:24 +0100)]
Ensure we use the correct fz_context when dropping jbig2_globals.
Robin Watts [Mon, 27 Jul 2020 14:58:49 +0000 (15:58 +0100)]
Ensure that packed paths can be repacked.
This is needed for when you run display lists into display lists.
Robin Watts [Thu, 23 Jul 2020 13:37:09 +0000 (14:37 +0100)]
Move call to file_level_headers into fz_try().
This ensures that output is properly cleaned up if file_level_headers
throws.
Sebastian Rasmussen [Tue, 28 Jul 2020 20:04:28 +0000 (04:04 +0800)]
jni: Expose MuPDF version number to Java.
Tor Andersson [Tue, 14 Jul 2020 15:39:21 +0000 (17:39 +0200)]
mutool run: Add text span grouping to Text.walk.
Tor Andersson [Thu, 23 Jul 2020 11:35:38 +0000 (13:35 +0200)]
Always write unicode character as text for trace device text objects.
Tor Andersson [Mon, 27 Jul 2020 11:30:29 +0000 (13:30 +0200)]
gl: Fix encryption options in PDF save dialog.
Check pdf_can_be_saved_incrementally before setting do_incremental.
Don't reset the password fields each time through the event loop.
Tor Andersson [Tue, 21 Jul 2020 10:25:00 +0000 (12:25 +0200)]
Bug 702573: Add missing check for "magic" text nodes in fz_xml_find.
Tor Andersson [Tue, 14 Jul 2020 13:00:32 +0000 (15:00 +0200)]
Bug 702542: Relax parsing of CMap streams.
Allow garbage at the end of keywords.
Tor Andersson [Mon, 13 Jul 2020 14:10:41 +0000 (16:10 +0200)]
Bug 702558: Call _exit instead of exit when fork/exec fails.
Calling exit invokes atexit registered functions, which will tear down
and mess up the X11 connection for the main process.
Call _exit instead to avoid the atexit cleanup.
Also use the double-fork method to avoid zombie processes in mupdf-gl,
as is done in mupdf-x11 to fix bug 695701.
Robin Watts [Thu, 16 Jul 2020 11:36:20 +0000 (12:36 +0100)]
Bug 702565: Fix painter selection for overprint mask case.
If the destination had an alpha plane, we were getting the offsets
wrong.
Robin Watts [Thu, 16 Jul 2020 08:43:36 +0000 (09:43 +0100)]
Squash some signed/unsigned warnings.
And a couple of double -> float ones.