GNU bug report logs -
#73638
31.0.50; doc-view: imenu index cannot be made for LaTeX PDFs
Previous Next
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Sat, 5 Oct 2024 11:07:02 UTC
Severity: normal
Found in version 31.0.50
Done: Tassilo Horn <tsdh <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
[ஞாயிறு அக்டோபர் 06, 2024] Eli Zaretskii wrote:
>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: 73638 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
>> Date: Sat, 05 Oct 2024 21:56:24 +0200
>>
>> Eli, the executive summary is this. We already can read a PDFs outline
>> mutool and use that for quick access to chapters and sections through
>> imenu. However, it turned out that it depends on the PDF at hand if the
>> outline is usable for our purpose where "usable" means we get page
>> references. And it seems that many PDFs (e.g., those produced by LaTeX)
>> have no page references but named references which won't do the trick
>> for doc-view.
>>
>> Visuwesh figured out that one can run a JS script using "mutool run
>> <script> foo.pdf" for accessing the PDFs internal structure using the JS
>> mupdf API and wrote the below simple script which spits out the outline
>> with page references as sexp structure.
>>
>> Would it be ok to distribute the below JS helper script with Emacs so
>> that doc-view can use it? If so, how? Maybe the simplest way would be
>> to just put it in some doc-view--mutool-outline-script variable and copy
>> it to doc-view-cache-directory when invoking imenu on a PDF file the
>> first time?
>
> Can't we invoke the JS interpreter with this script as the command, or
> invoke it as async subprocess and pipe the script to it via standard
> input?
When "mutool run" is called without any script argument, it opens a
REPL. We would need to `process-send-string' to the REPL but the REPL
reports syntax error when I try to do so. This is after trying to
"minify" the JS script. Maybe I am doing something wrong. I've
attached my test lisp at the end.
I do not understand what you suggest by the former however.
[Message part 2 (text/plain, attachment)]
This bug report was last modified 227 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.